Decision Optimization

 View Only
Expand all | Collapse all

Cp Optimizer and floating-point Variables

  • 1.  Cp Optimizer and floating-point Variables

    Posted Thu June 16, 2022 11:49 AM
    Hello,

    I was using Ilog Solver CP 1.7 with visual studio 2010 to solve design problems (mechanical systems). as this version is no longer updated I installed CPLEX 22.1 with visual studio 2022 to use cp optimizer.

    When I run an optimization with one of my design problem I get the following message:
    "At least one floating-point variable is not fixed"

    Does this mean that I can't search for real solutions with iloCP like I did with IloSolver?
    in this case are there additional libraries to use?

    Thank you in advance for your help

    Nicolas

    ------------------------------
    Nicolas Tchertchian
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Cp Optimizer and floating-point Variables

    Posted Mon June 20, 2022 03:09 AM

    Hello Nicolas,

    That's correct.  CP Optimizer does not support floating point variables like it does integer variables.  The way to do what you want is to approximate the floating point variables using discrete variables.  For example, in our Python interface (docplex.cp) you could create a floating point variable with a certain granularity g (number of different possible values), like this:

    def floatVar(mdl, min, max, g, name) :
    v = mdl.integer_var(0, g - 1, name)
    step = (max - min) / (g - 1)
    return min + v * step

    Regards,

    Paul



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