簡體   English   中英

如何在每個解決方案中確保二進制決策變量的第二個索引相等?

[英]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)。 因此,在解決方案中,每個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) => ??

可以

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM