Initializing the auxiliary gurobi variables
AnsweredHi,
i am using t3[j,i] as auxiliary variable, i need to initialize it with zero. This variable t3 is updated using constraints when optimized variable C is set. I am sharing here partial code where CR and data are the input (python variable). Please help me whether this is the correct way or not thank you.
t3=m.addVars(range(1,R+1),range(1,P+1),vtype=GRB.CONTINUOUS,name="t3")
C=m.addVars(range(1,P+1),range(1,M+1),lb=0,ub=1,vtype=GRB.BINARY, name="C")
for j in range(1,R+1):
for i in range(1,P+1):
t3[j,i].START=0
for i in range(1,P+1):
for k in range(1,M+1):
m.addConstr((C[i,k]==1) >> (t3[CR[k],i]==data[i]))
-
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 Ramesh,
You don't have to initialize variables. Gurobi will anyway try the zero solution and check whether this is feasible. The START attribute really makes sense when you have a valid (non-zero) starting solution available - even if it may only contain a subset of the variables. Then Gurobi will try to complete this solution and use it to have an initial primal bound to speed up the solving process.
Please check out this guide on MIP Starts: How do I use MIP starts? – Gurobi Help Center
I hope that helps.
Cheers,
Matthias0
Post is closed for comments.
Comments
2 comments