Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Bug in CPLEX 22.1.1 (Java API)

    Posted Thu July 06, 2023 06:44 PM

    I ran into a very curious bug. The context is a model with seven integer variables (IloIntVar) and a single range constraint. I run different scenarios, which vary only in the bounds on the variables. Some variables have a lower bound of 1 and an upper bound of infinity (more on that in a moment) while others have a lower bound of 0 and an upper bound of 0 (removing them from the model). In addition to the variable bounds, I have tried changing the lower and upper limits of the single range constraints. 

    For the upper bound of "infinity" I have tried Double.MAX_VALUE and Integer.MAX_VALUE. In all scenarios, using Double.MAX_VALUE works fine, and in most scenarios Integer.MAX_VALUE works fine ... but in at least one instance, using Integer.MAX_VALUE, I get the following error message:

    CPLEX Error  3018: Magnitude of variable %s: %g exceeds integer limit %d.

    At least one bug is pretty clear: I got the format statement rather than the formatted result. Beyond that, I'm inclined to say that whatever exception is being thrown here is likely to be an error since changing the limit to Double.MAX_VALUE works fine (and the values of the nonzero variables in the solution are 1, 1, 2, and 9).



    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------


  • 2.  RE: Bug in CPLEX 22.1.1 (Java API)

    Posted Wed July 12, 2023 09:39 AM

    Hi Paul, yes this look like a bug.

    Can you send us or post here a code that creates the problem ? 

    Thanks.

    Philippe



    ------------------------------
    Philippe Refalo
    IBM ILOG CP Optimizer
    ------------------------------



  • 3.  RE: Bug in CPLEX 22.1.1 (Java API)

    Posted Wed July 12, 2023 11:38 AM

    Philippe,

    I've attached a zip file. In it is a Java package  containing three files: the main class (which sets the problem data and runs the problem); the scenario class (which holds and dispenses problem data); and the class containing the IP model. You'll find some lines commented out where I tried different combinations of things. For instance, in IP.java around line 55 you'll see one line (commented out) that uses Double.MAX_VALUE as an upper bound and another (active) that uses Integer.MAX_VALUE.

    The built in scenario is one that produces the error message, and I've included my output log. The IP model is solved repeated for a series of scenarios, and the error does not manifest until around the 75th scenario.

    Hope this helps,

    Paul



    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------



  • 4.  RE: Bug in CPLEX 22.1.1 (Java API)

    Posted Wed July 12, 2023 11:40 AM

    Reposting because the uploaded file does not seem to be attached to my previous response.



    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------



  • 5.  RE: Bug in CPLEX 22.1.1 (Java API)

    Posted Thu July 13, 2023 11:30 AM

    Paul,

    The value of Integer.MAX_VALUE is actually too big for CPLEX.  The value can be at most 2100000000 (https://www.ibm.com/docs/en/icos/22.1.1?topic=api-cpx-bigint).

    I hope that this can unblock your development.

    Regards,


    Paul



    ------------------------------
    Paul Shaw
    ------------------------------



  • 6.  RE: Bug in CPLEX 22.1.1 (Java API)

    Posted Thu July 13, 2023 11:58 AM

    Paul,

    Thanks. I was unaware of the existence of CPX_BIGINT. There is still something odd about this. I ran the following in CP Optimizer 22.1.1:

    IloCP model = new IloCP();
    IloIntVar v = model.intVar(0, Integer.MAX_VALUE);
    model.addMaximize(v);
    if (model.solve()) {
      System.out.println((long) model.getValue(v));
    }
    

    It runs without any errors and outputs 2147483647, which is the value of Integer.MAX_VALUE. So I'm confused why CPO, which deals with explicit integers, can go that high while CPLEX (where everything internally is double precision) cannot.

    Paul



    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------