Display Constraints Generated in CPLEX ILOG Studio

681 Views Asked by At

I would simply like to know whether it is possible to display all the constraints generated for a particular optimization problem in CPLEX ILOG Studio and how to do it.

1

There are 1 best solutions below

1
On BEST ANSWER

I think that the best thing to do is to get CPLEX to save a copy of its model as a text file in the LP file format. Then you can look at the model with any text editor you want. You can also read that LP file back into the CPLEX command line interface and re-solve it. You can also of course edit that file and re-solve it, so you can explore in detail the effect of changing e.g. a variable's bounds or fixing its value.

To enable this (it's not obvious) you can add a settings file to your project in OPL Studio. Edit the settings file by double-clicking on it. Then inside that settings file, at the bottom of the tree look for Language -> Run, and there should be an entry for the Export format. Select 'LP'. Then add that settings file to your particular run configuration.

Obviously it will help if you set names on your variables and constraints too. Then it will be simpler to navigate around the LP file that gets generated.

Be aware that the LP file format will lose some precision in the numerical representation compared to the internal model inside CPLEX, so you may find slight differences from your original model and solution, but its not normally an issue if your model is numerically reasonable.