0

I get the objective value h=3 with the following CPLEX code:

using CP;

dvar interval lot1 in 10..19;
dvar interval lot2 in 20..29;

cumulFunction cumulFunc1 = stepAtStart(lot1, 1);
cumulFunction cumulFunc2 = stepAtStart(lot2, 2);
cumulFunction func = cumulFunc1 + cumulFunc2;

dexpr int h1 = heightAtStart(lot1, func);
dexpr int h2 = heightAtStart(lot2, func);

dexpr int h = h1 + h2;

minimize h;

But my expectation is h=4, because func is 1 at the point of 10 (start of lot1) and is 3 at the point of 20 (start of lot2). What is the reason of the different behaviour from my expectation?

shira
  • 1

1 Answers1

0

you can see in the documentaiton of this function (https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_heightAtStart.html):

The expression heightAtStart(a, f) returns the contribution of interval a to cumulFunction expression f at the interval's starting point.

Regards,

ol

  • Thank you, I understood. I thought h2 = 3, but heightAtStart returns not the value of the function but only the contribution of the interval, so correctly h2 = 2 and thus h = 3. – shira Sep 29 '20 at 07:01