Hello everyone, I’m using docplex, CPLEX library for python to solve ILP models, whereas I realized feeding the same model to CPLEX does not necessarily guarantee to return the same result. Even the worse, sometimes it returns me no feasible solution. Any idea on why CPLEX being so nondeterministic? Thanks a lot in advance.

asked 30 Dec '16, 17:46

NNING's gravatar image

accept rate: 0%

There are several possible reasons. One is that CPLEX uses a random number stream for some decisions. Try setting the random number seed (it's an integer parameter) and see if that helps. You might also try running in a single thread, in case thread synchronization is a factor.


answered 31 Dec '16, 16:51

Paul%20Rubin's gravatar image

Paul Rubin ♦♦
accept rate: 19%

Thanks Paul, but I'm not sure where and what is the most appropriate setting for the random seed and I couldn't find useful reference. Solutions varying from run to run is okay, but having no solution returned is not acceptable. Also won't single thread significantly compromise the performance? Currently each instance has 32 threads. Is it also possible that my model is ill-formed if there are too many indicator constraints?

(02 Jan '17, 22:13) NNING

There's no "appropriate setting" for the random seed. Pick an arbitrary value and hope for the best. The key is that using the same value every time should encourage CPLEX to behave the same every time (assuming the problem instance is held constant). I also suggest looking at the "parallel mode switch" in the CPLEX parameters manual. Having indicator constraints might affect solution time, but I'm not sure it would account for different behaviors on multiple runs of the same problem instance.

(03 Jan '17, 09:59) Paul Rubin ♦♦

CPLEX and docplex should both be deterministic, unless the solve timeout or other user interaction occurs. Could you please post your question in our support forum and someone will help you.


answered 03 Jan '17, 07:06

Bo%20Jensen's gravatar image

Bo Jensen ♦
accept rate: 14%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 30 Dec '16, 17:46

Seen: 1,292 times

Last updated: 03 Jan '17, 09:59

OR-Exchange! Your site for questions, answers, and announcements about operations research.