Originally posted by: SystemAdmin
Hi,
it seems that there is a different interpretation of breakpoints for piecewise() and stepwise().
Consider the following small model:
dvar int+ x; dexpr
float obj_pwf = piecewise
{ 0->10; 1
} (0, 0) x; dexpr
float obj_swf = stepwise
{ 0->10; 10
} x; dexpr
float obj = obj_pwf + obj_swf; minimize obj; subject to
{ x == 10;
} execute
{ writeln(
" x = ", x); writeln(
" obj = ", obj); writeln(
" obj_pwf = ", obj_pwf); writeln(
" obj_swf = ", obj_swf);
}
which yields some strange output :
// solution (optimal) with objective 0 x = 10 obj = 10 obj_pwf = 0 obj_swf = 10
First, OPL claims "solution (optimal) with objective 0" although we have "obj=10"
(what changes to "solution (optimal) with objective 10" if we maximize instead)
Moreover, what is the reason for handling the breakpoints differently? In case
of pwf the "old slope" is applied whereas for swf the "new step" is applied?
Quite confusing ...
Best regards
Norbert
#DecisionOptimization#OPLusingCPLEXOptimizer