Non linear programming float decision variable in CPLEX

19 views Asked by At

I m working in a non linear programming and got some problems that explain me that we can't use float decision variable in CPLEX when using solver CP. Help me, if there is some approach or other methods to solve this problem. Thanks

I had just try to use CP in CPLEX studio:

1

There are 1 answers

0
Alex Fleischer On

with CPOptimizer you can use float expressions and that way you can use decimal decision variables.

See https://github.com/AlexFleischerParis/zooopl/blob/master/zoodecimalcpo.mod

using CP;

int nbKids=310;
float costBus40=500;
float costBus30=400;
int scale=100;

 
dvar int+ scalenbBus40;
dvar int+ scalenbBus30;

dexpr float nbBus40=scalenbBus40/scale;
dexpr float nbBus30=scalenbBus30/scale;
 
minimize
 costBus40*nbBus40  +nbBus30*costBus30;
 
subject to
{
 40*nbBus40+nbBus30*30>=nbKids;
}

execute
{
  writeln("nbBus40 = ",nbBus40);
  writeln("nbBus30 = ",nbBus30);
}