我有一个二进制决策变量x[l][c][f]
。 F
的范围为1-6。现在,我希望f
在每个解决方案中都相等。因此,每当二进制变量等于1时,对于所有非零二进制变量,f
必须相同(1-6)。因此,在解决方案中,每个x
都具有f
的相同索引。
Range F = 1..6;
Range L = 1..28;
Range C = 1..6;
dvar boolean x[L][C][F]; // bin decision variable equal to 1 if line l is jused with c carriages at a frequency of f
Forall (l in L, c in C, f in F)
(x[l][c][f]==1) => ??
答案 0 :(得分:1)
可以
range F = 1..6;
range L = 1..28;
range C = 1..6;
dvar boolean x[L][C][F]; // bin decision variable equal to 1 if line l is jused with c carriages at a frequency of f
subject to
{
forall (l in L, c in C) sum(f in F) x[l][c][f]==1 ;
}
帮助?
或有您的评论吗?
range F = 1..6;
range L = 1..28;
range C = 1..6;
dvar boolean x[L][C][F]; // bin decision variable equal to 1 if line l is jused with c carriages at a frequency of f
dvar int nbFrequencyUsed[F];
subject to
{
forall(f in F) nbFrequencyUsed[f]==sum (l in L, c in C) x[l][c][f];
1>=sum(f in F) (nbFrequencyUsed[f]>=1);
}