How to use for loop for a specific or range of values in constraint formulation?
回答済みEndresources=steel.addConstrs((gp.quicksum(Resources[res,t] for t in x)==1 for res in res_list3),name="Endresources")
My Variables are:
time = list()
for x in range(0,int(num_t)):
time.append(x)
Resources=steel.addVars(res_list,time,vtype=GRB.INTEGER,name="Resources")
Tasks=steel.addVars(task_list,time,vtype= GRB.BINARY,name="Tasks")
I have used :
x=[]
x.append(time[95])
Instead I want to use 95th Value from time in my constraint:
Right now my constraint looks like:
R[150],R[151]....
It should look like..
R[150,95],R[151,95]......
Endresources=steel.addConstrs((gp.quicksum(Resources[res,t] for t in x)==1 for res in res_list3),name="Endresources")
0
-
正式なコメント
This post is more than three 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. -
Duplicate of Using a for loop for a single or specific value...
0
投稿コメントは受け付けていません。
コメント
2件のコメント