Constraints in Gurobi
Answeredi have the following variable of:
b = {}
for m in M:
for demand_index in range(100):
for t in range(tt):
b1["O+", "1", m, demand_index, t] = model.addVar(vtype=GRB.INTEGER, name=f'b_{"O+"}_{"1"}_{m}_{demand_index}_{t}')
in which M = list(range(41, 0, -1))
Does the following constraint correspond to the attached constraint for different demand values?
term = gp.quicksum(b["O+", "1", m, demand_index, t] * weight[m] for m in M for demand_index in range(10))

-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Shahrzad,
Your term variable is currently being assigned the following (which is not a constraint, as discussed on another post):
\[\sum_{demand=0}^{9}\sum_{m=1}^{41}b_{O+, 1, m, demand, t}weight_m\]
Also note you can set M = range(1, 42) which is a bit cleaner. Hope this helps.
- Riley
0
Post is closed for comments.
Comments
2 comments