0

我使用以下 CPLEX 代码得到目标值 h=3:

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;

但我的期望是 h=4,因为 func 在 10 点(lot1 开始)为 1,在 20 点(lot2 开始)为 3。行为与我的预期不同的原因是什么?

4

1 回答 1

0

您可以在此函数的文档中看到(https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_heightAtStart.html):

表达式 heightAtStart(a, f) 返回区间 a 在区间起点对 cumulFunction 表达式 f 的贡献。

问候,

奥尔

于 2020-09-28T10:44:43.780 回答