GAMS:卡片运算符超过子集

时间:2016-09-28 13:29:53

标签: subset operator-keyword gams-math

我正在尝试模拟Cross Dock问题。它有以下几组:

j for Outbound Trucks,

用于分拣站和

l for Outbound Docks。

此外,还有一个二进制变量z(j,s),如果将出境卡车j分配给分拣站,则为一个。

在计算之前,您必须将出站码头分配给分拣站。为此,我定义了一个子集k(s,l)。我的例子如下:

Sets

j      /J1*J27/
s      /S1*S4/
l      /L1*L30/
;

Sets  k(s,l)

        /S1.(L1,L2,L3,L4,L5,L6)
         S2.(L7,L8,L9,L10,L11,L12)
         S3.(L13,L14,L15,L16,L17,L18,L19,L20)
         S4.(L21,L22,L23,L24,L25,L26,L27,L28,L29,L30)/ 

我遇到的问题是对以下等式进行建模:

This restriction says, that you cannot assign more Outbound Trucks to Sorting Station s, than there are Outbound Docks assigned to this Station. L(s) is the amount of Outbound Docks assigned to Sorting Station s.

我该如何建模?我这样试过:

等式.. sum(j, z(j,s)) =l= card(k);

但它不起作用,因为'card(k)'不代表分配给分拣站的出站码头数量。所以我的问题是,如果可以通过子集对卡片操作员进行建模吗?

或者有人知道另一种可能的方法来模拟这个等式吗?

1 个答案:

答案 0 :(得分:0)

首先,k不是子集,而是多维集。

不,不可能使用多维集卡。

您似乎希望计算每个分拣站有多少出站码头。约束应表述为:

equation(s).. sum(j,z(j,s))= l = sum(l $ k(s,l),1);