functioncplexexpln

Does Cplex support using of ln or exponential function for a decision variable?


I am trying to write constraints using ln and exp function, yet I received an error that Cplex can't extract the expression.

forall (t in time)
   Gw_C["Mxr"] == 20523 + 17954 * ln(maxl(pbefore[t]));

  Ed_c ["RC"]== 0.0422* exp(0.1046* (maxl(pbefore[t])));
   
   Gw_C["RC"] == 3590* pow((maxl(pbefore[t]), 0.6776);

Is there any other possible way to code these constraints on cplex? Thanks


Solution

  • You may use exp and log if you rely on Constraint Programming within CPLEX:

    using CP;
    
    int scale=1000;
    
    dvar int scalex in 1..10000;
    dexpr float x=scalex/scale;
    
    maximize x;
    
    subject to
    {
      exp(x)<=100;
    }
    
    execute
    {
      writeln("x=",x);
    }
    

    works fine and gives:

    x=4.605
    

    But with Math Programming within CPLEX you cannot use exp like that.

    What you can do instead if go through linearization.