Answers for "how to use ceiling function?"
https://developer.ibm.com/answers/questions/256399/how-to-use-ceiling-function.html
The latest answers for the question "how to use ceiling function?"Answer by GuangFeng
https://developer.ibm.com/answers/answers/295783/view.html
Try to define an integer variable ceilofa
dvar int ceilofa;
and constraint it by
a <= ceilofa;
If your model tends to minimize ceilofa, the above would be enough. Otherwise, try to add a new constraint
ceilofa<=a+0.9999;
The number of 9s depends on the precision you want to achieve. Using too many 9s may create numerical issues.Wed, 17 Aug 2016 00:18:02 GMTGuangFengAnswer by rajamec28
https://developer.ibm.com/answers/answers/256405/view.html
Thank you Mr. DanielJunglas
I used as 'dexpr float ceilofa = ceil(a)'. Since a is a dexpr,
but the error occurs as "cannot extract expression".Fri, 04 Mar 2016 09:28:03 GMTrajamec28Answer by DanielJunglas
https://developer.ibm.com/answers/answers/256404/view.html
Use 'dexpr float ceilofa = ceil(a)'. Since a is a dexpr, ceilofa cannot be a constant float but must be a 'dexpr' instead. The following works for me
dvar float+ x;
dvar float+ y;
dexpr float a = x + y;
dexpr float c = ceil(a);
maximize x + y;
subject to { x <= 1.2; y <= 1.3; }
main {
thisOplModel.generate();
cplex.solve()
writeln(thisOplModel.a)
writeln(Opl.ceil(thisOplModel.a))
writeln(thisOplModel.c);
}Fri, 04 Mar 2016 09:20:24 GMTDanielJunglas