如何确保我的二元决策变量的第二个索引在每个解决方案中都相等?

How can I ensure that the 2nd index of my binary decision variable is equal in every solution?

我有一个二元决策变量x[l][c][f]F 可以介于 1-6 之间。现在我希望 f 在每个解决方案中都相等。因此,每当二进制变量等于 1 时,f 对于所有非零二进制变量必须相同 (1-6)。所以在解决方案中,每个 xf.

都有相同的索引
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) => ??

可以

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);
}