微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用CPLEXCP Optimizer进行意外的cumulFunction评估

如何解决使用CPLEXCP Optimizer进行意外的cumulFunction评估

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

解决方法

您可以在此功能的文档中看到{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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。