IBM CPLEX 累积中脉冲部分的错误

问题描述 投票:0回答:1

IBM CPLEX ILOG 中的约束编程:

The code for the following Cumulative(Zi|i ∈ I, Resiv, ARv) ∀v ∈ V

我在 IBM CPLEX 中编写。但是我的脉冲部分出现错误。你们能帮帮我吗?

forall(v in Resources) {
    cumulative(i in Jobs) pulse(Zi[i], resourceNeed[i][v]) <= resourceAvail[v];
}

获得合适的建议

constraint-programming
1个回答
0
投票

为了计算累积值,请使用“sum”

using CP;

range Jobs=1..2;
range Resources=1..3;
int  resourceNeed[i in Jobs][v in Resources]=i*v;
int resourceAvail[v in Resources]=v;

dvar interval Zi[Jobs];

subject to
{
forall(v in Resources) {
    sum(i in Jobs) pulse(Zi[i], resourceNeed[i][v]) <= resourceAvail[v];
}
}

工作正常

© www.soinside.com 2019 - 2024. All rights reserved.