Putting the value of the variables back to the equation to check, but the constraint does not meet.
回答済みHi,
The model I was running declared that it is unbounded but still provides the best objective.
In order to check whether I set the formulation right, I try to go through each variable's values. However, I found some formulations that the left-hand side's value does not equal the RHS. The following code block shows the constraint in the model.
def initial_queue():
movement=['TH']
sub_cycle=[1,2]
for c in sub_cycle:
for i in sub_intersection:
for mov in movement:
m.addConstr(Q[i,c,mov]==Q0[i,c,mov]+(Q1[1,i,c,mov]+Q2[1,i,c,mov]+Q3[1,i,c,mov]+Q4[1,i,c,mov])+(Q1[2,i,c,mov]+Q2[2,i,c,mov]+Q3[2,i,c,mov]+Q4[2,i,c,mov])+(Q1[3,i,c,mov]+Q2[3,i,c,mov]+Q3[3,i,c,mov]+Q4[3,i,c,mov]))
The value of Q[3,3,'TH'] is 0.

But if I try to add every term together, the value is 43.45

When I directly copy the constraint in the model and replace all the indices with the number, it shows "false".

Does it have anything to do with the fact that the model is unbounded?
And is there any way to see how to solve the unbounded problem?
(Something like IIS for an infeasible model)
Thank you so much.
-
正式なコメント
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. -
In the definition of your constraint Q[i,c,mov] is only defined for c=1,2. But later you access for c=3. So it looks like the constraint you checked with the solution was not added to the model. Could you please check that?
If there are any issues it often helps to write the model with m.write("model.lp") and check the LP file.For unboundedness please check this article How do I resolve the error "Model is infeasible or unbounded"? – Gurobi Help Center
To get a continuous relaxation of a MIP model you can use model.relax().
0
投稿コメントは受け付けていません。
コメント
2件のコメント