∑((i,j∈A_2))(x_ij)+∑_((i、j,k)∈A_3)(y_ijk)=1,i ∈ V^a∪ V^s
我不知道如何为所有人写V^a和V^s的交集,对吗?
{int} Arr_node;
{int} Loco_start;
{int} Exp1= Arr_node inter Loco_start;
Forall(i in Exp1)(sum(<i,j> in A2)x[<i,j>]) + (sum(<i,j,k> in A3)y[<i,j,k>]) == 1;
您可以使用inter或&;
参见
{string} cities={"A","B","C"};
{string} departures={"A","B"};
{string} arrivals={"B","C"};
dvar boolean x[cities];
{string} bothdepandarr=departures inter arrivals;
minimize sum(c in cities) x[c];
subject to
{
forall(c in bothdepandarr) x[c]==1;
}
或
{string} cities={"A","B","C"};
{string} departures={"A","B"};
{string} arrivals={"B","C"};
dvar boolean x[cities];
minimize sum(c in cities) x[c];
subject to
{
forall(c in departures inter arrivals) x[c]==1;
}
或
{string} cities={"A","B","C"};
{string} departures={"A","B"};
{string} arrivals={"B","C"};
dvar boolean x[cities];
minimize sum(c in cities) x[c];
subject to
{
forall(c in cities : c in departures && c in arrivals) x[c]==1;
}