简体   繁体   中英

Printing all constraints using DOcplex

I am actually running a MILP on Python using DOcplex and it is my very first time using it. It is saying that my model which I ran on Lindo is infeasible. Therefore, I am guessing that I erroneously entered my constraints, but I cannot view them. I used "mdl.print_information()", but it is not helping much. Does anyone know how I can solve my problem?

Thanks in advance.

You can export the model to LP format (a human readable LP format), by Model.export_as_lp() . You can also export the model to a string in LP format with Model.lp_string , to get a complete view of the model.

In addition, this notebook: https://github.com/IBMDecisionOptimization/docplex-examples/blob/master/examples/mp/jupyter/infeasible.ipynb gives hints on how to investigate infeasible models, in particular with the Relaxer class.

Knowing which constraint is infeasible (and by how much slack) may lead you to the root cause of the infeasibility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM