Skip to content Skip to sidebar Skip to footer

Cplex Gives Two Different Results?

I use Python API in Cplex to solve a Linear programing problem. When using Cplex, I had the result below: But then I saved my LP prolem as a lp file and use Cplex to solve again,

Solution 1:

If I understand correctly, you are solving the second time using the LP file you exported in the first run. You can loose precision when writing to LP format. Try with SAV format instead.

Solution 2:

Just to add to rkersh's comment. CPLEX when run in deterministic mode should give identical answers every time. However, if you write the model out as an LP file you will lose some precision in some of the numbers and this will perturb the problem even if only slightly, and that will often lead to different answers. The SAV format is the closest you can get to a faithful copy of the model that was inside CPLEX at the time it was saved. But even then I am not certain that the behaviour of CPLEX through the interactive solver will be identical to that through the API. If you run them on the same hardware, I would hope that they would be the same, but on a different machine you might still get different behaviour (different cpu, memory etc)

Post a Comment for "Cplex Gives Two Different Results?"