【问题标题】:unexpected cumulFunction evaluation with CPLEX (CP Optimizer)使用 CPLEX(CP Optimizer)进行意外的 cumulFunction 评估
【发布时间】:2020-09-28 03:12:35
【问题描述】:

我使用以下 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。 行为与我的预期不同的原因是什么?

【问题讨论】:

    标签: cplex cp-optimizer


    【解决方案1】:

    你可以在这个函数的文档中看到(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 的贡献。

    问候,

    ol

    【讨论】:

    • 谢谢,我明白了。我认为 h2 = 3,但 heightAtStart 不返回函数的值,而只返回区间的贡献,所以正确的是 h2 = 2,因此 h = 3。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-07-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-19
    • 1970-01-01
    • 1970-01-01
    • 2014-01-18
    相关资源
    最近更新 更多