1

This is a follow-up from this post. In short, I am using IBM ILOG CPLEX CP Optimizer in Python to solve a constraint programming problem. One of the optimization objectives is to maximize the product of integers x_1 * x_2 * ... * x_n. As the problem scales up (e.g. n is around 300), the product will apparently get very large and CP Optimizer seemed to be unable to handle this large integer. For different values of n, the returned product was always 1.79769e+308.

Integers are unlimited in size and have no maximum value in native Python, so I guess CP Optimizer handles large integers differently. Is there any way to deal with large integers in CP Optimizer?

Some side notes:

  • My program worked fine with smaller data sizes (small n).
  • I tried maximizing log(x_1) + log(x_2) + ... + log(x_n) but the program was running non-stop. I reckon the log makes things complicated.
  • For those who are interested, my source code and sample data is here.

Thanks a lot!

Community
  • 1
  • 1
foo
  • 157
  • 1
  • 1
  • 11
  • 1
    That is the upper limit of float64 (so even this data-type fails for you; and is silently used in the core). As there is probably no support for arbitrary arithmetic, you might try to add upper bounds on that sum, coming from additional model-assumptions. Of course this somewhat assumes, that you are expecting a solution in this valid range. – sascha Oct 21 '18 at 08:05

1 Answers1

1

in https://www.ibm.com/support/knowledgecenter/SSSA5P_12.7.0/ilog.odms.ide.help/refcppopl/html/variables/IlcIntMax.html

you may read

On 64-bit platforms, the largest positive integer which can be represented as a 64-bit floating point number according to IEEE 754, or the constant 2^53-1. On 32-bit platforms, the constant 2^31-1.

This upper limit should be respected when specifying domain values for the IlcIntVar class.

Alex Fleischer
  • 9,276
  • 2
  • 12
  • 15