The results of the gurobi solution do not satisfy the constraints
AnsweredThe constraints are clearly violated, but the model is feasible and the result can be derived.
Can you please tell me what the problem is, I'm using matlab+yalmip+gurobi
The violated constraint is:
for i = 1:flow_num
for p = 1:port
for j = 1:flow_num + flow.flow_num
cons = [cons; aa(p, j, i) <= bb(p, j, i)];
cons = [cons; bb(p, j, i) <= cc(p, j, i)];
end
end
end
where a matrix of aa is
val(:,:,1) =
1 1 1 1 1 1 0 1 1 1 0 0 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
cc:
val(:,:,1) =
列 1 至 10
1000 1000 1000 1000 1000 1000 -1 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 0 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
列 11 至 15
0 -1 1000 1000 -1
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
aa(1, 1, 7) = 0 cc(1, 1, 7) = -1
-
I'm sorry I made a mistake.
where a matrix of bb is
val(:,:,1) =1 1 1 1 1 1 0 1 1 1 0 0 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0a matrix of cc is
val(:,:,1) =
列 1 至 10
1000 1000 1000 1000 1000 1000 -1 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 0 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000列 11 至 15
0 -1 1000 1000 -1
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0
0 0 1000 1000 0bb(1, 1, 7) = 0 cc(1, 1, 7) = -1
0 -
I am not familiar with YALMIP but from Gurobi's MATLAB API, you could call the gurobi_write() function to write a human-readable LP file. You can then open this file with any standard text editor and inspect whether the model you generated is correct. I would assume that YALMIP has a possibility to call Gurobi's write function or even has its own.
A next step would be to find the seemingly violated constraint in the LP file and try to find out why it is violated.
0 -
Additionally, our article How do I diagnose a wrong result? may be a good starting place. -G
0
Please sign in to leave a comment.
Comments
3 comments