Optimal solution violates constraint
ユーザーの入力を待っています。I have a MILP that I wrote with pulp. When I run my model with Gurobi solver, I get an optimal solution that satisfies most of the constraints but clearly violates one inequality. I don't understand what is wrong with my formulation because it is not the only constraint of that type and all other constraints are respected.
This is the constraint :
for i in range(len(storage_lcts))[1:]:
for k in delivery_days:
problem+=lpSum(qty_client[(f,i,j,k)] for f in product_types)<=served[(i,j,k)]*1e2
and this is the output that I get:
storage 1 :
served 204.0
number of non-zero qty clients 286
storage 2 :
served 0.0
number of non-zero qty clients 36
storage 3 :
served 141.0
number of non-zero qty clients 135
storage 4 :
served 0.0
number of non-zero qty clients 48
storage 5 :
served 0.0
number of non-zero qty clients 36
storage 6 :
served 228.0
number of non-zero qty clients 182
storage 7 :
served 226.0
number of non-zero qty clients 86
storage 8 :
served 0.0
number of non-zero qty clients 35
If the constraint was respected, the amount of served and the amount of non-zero qty clients should be the same. I already checked the quality of the model and it says that it is perfect...
Solution quality statistics for model Location-Allocation :
Maximum violation:
Bound : 0.00000000e+00
Constraint : 0.00000000e+00
Integrality : 0.00000000e+00
I would appreciate any insight for that.
Best regards,
Laetitia
-
正式なコメント
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 Laetitia,
Please try writing your model to a human-readable LP file via the write method
model.write("myModel.lp")You can open the file \(\texttt{myModel.lp}\) in any standard text editor. This way you can analyze whether the constraints you have constructed actually look as they should.
Best regards,
Jaromił0 -
In addition to Jaromil's suggestion, please have a look at our KB article How do I diagnose a wrong result? for more suggestions.
0
投稿コメントは受け付けていません。
コメント
3件のコメント