Home > Software design >  CEIL in objective function CPLEX C
CEIL in objective function CPLEX C

Time:11-15

As per my knowledge, there's a tutorial that shows that ILOG can use ceil function (here). However, when I tried to implement it to calculate my objective function in CPLEX C (concert), it was failed. What I am looking for is as per below:

for (i=0; i<I; i  ){
  for (j=0; j<J; j  ){
      TO  = ceil(DecisionVariable[i][j]/parameter[j]);
  }
}

Any advises would be appreciated. Thank you so much.

Best regards,

CodePudding user response:

In OPL we have ceil but in concert C the equivalent function is IloCeil.

But we need to remember that this function is not linear.

In How to with OPL ? we can read How to use ceil of a decision variable in a CPLEX constraint ?

range r=1..4;

float x[r]=[1.5,4.0,2.0001,5.9999];

dvar int y[r];
dvar float f[r] in 0..0.9999999;

subject to
{
forall(i in r) y[i]==x[i] f[i];


}

execute
{
writeln(x," ==> ",y);
}

assert forall(i in r) y[i]==ceil(x[i]);

CodePudding user response:

The content of the document you mentioned is too much. I couldn't quickly locate the content you are referencing. Please point out their location. But as far as I know, ceil is a round-up function, please check:

  1. Does the code contain the header files needed by the ceil function?

  2. Whether the parameters of the ceil function are set correctly?

  3. If you use a function as a parameter, make sure that the return value of the function is double.

  • Related