1/5
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Write the code in Python/Gurobi to import “Gurobipy”
from gurobipy import
Write the code in Python/Gurobi to define/create a Gurobi model named
“Exam1_Problem4”
model = Model("Exam1_Problem4")
Write the code in Python/Gurobi to add the decision variables to the Gurobi model. Do not forget to indicate their respective coefficients (for the objective function) when defining the variables
x = model.addVar(S, D, obj = C, name = “x”)
Write the code in Python/Gurobi to set the “sense” of the Gurobi model to “Minimize
model.modelSense = GRB.Minimzie
Write the code in Python/Gurobi to add the constraints (c1, c2, and c3) to the Gurobi model
model.addConstrs((x.sum(‘*’, j) ==b[j] for j in D, “C1”)
model.addConstrs((x.sum(i,’*’)==a[i]) for i in S1, “C2”)
model.addConstrs((x[i,j] <= u[i,j] for i in S for j in D, “C3”)
Write the code in Python/Gurobi to solve (optimize) the Gurobi model
model.optimize