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];
}
获得合适的建议
为了计算累积值,请使用“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];
}
}
工作正常