怎样在lingo中定义一个0-1矩阵
model:sets:channel:quality;user:demand;links(channel,user):capacity,x;endsetsdata:cha...
model:
sets:
channel:quality;
user:demand;
links(channel,user):capacity,x;
endsets
data:
channel = ch1 ch2 ch3 ch4 ch5 ch6;
user = ce1 ce2 ce3 d1 d2;
capacity = 0.0516 0.0862 0.1610 0.0529 0.0674
0.0862 0.0460 0.1050 0.0833 0.0727
0.0828 0.1334 0.0193 0.1465 0.0353
0.0701 0.0287 0.1145 0.1420 0.1287
0.0190 0.0739 0.0888 0.0274 0.0808
0.0819 0.1209 0.0245 0.0574 0.0911;
enddata
the objective;
max = @sum(links(i,j):capacity(i,j)*x(i,j));
the demand constraints;
@for(user(j):@sum(channel(i):x(i,j)) = demand(j));
@for(channel(i):@sum(user(j):x(i,j))<quality(i));
end
我想加一个约束条件,就是x这个矩阵是0,1矩阵,该怎么定义? 展开
sets:
channel:quality;
user:demand;
links(channel,user):capacity,x;
endsets
data:
channel = ch1 ch2 ch3 ch4 ch5 ch6;
user = ce1 ce2 ce3 d1 d2;
capacity = 0.0516 0.0862 0.1610 0.0529 0.0674
0.0862 0.0460 0.1050 0.0833 0.0727
0.0828 0.1334 0.0193 0.1465 0.0353
0.0701 0.0287 0.1145 0.1420 0.1287
0.0190 0.0739 0.0888 0.0274 0.0808
0.0819 0.1209 0.0245 0.0574 0.0911;
enddata
the objective;
max = @sum(links(i,j):capacity(i,j)*x(i,j));
the demand constraints;
@for(user(j):@sum(channel(i):x(i,j)) = demand(j));
@for(channel(i):@sum(user(j):x(i,j))<quality(i));
end
我想加一个约束条件,就是x这个矩阵是0,1矩阵,该怎么定义? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询