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?