注:为什么我用手找出来可行解了,而程序却说无可行解。
model:
sets:
country/co1..co11/:a,d;
city/c1..c6/;
link(country,city):x,c,b;
endsets
max=@sum(link:x*b);
@sum(link:c*x)<=12;
@for(country(i):d(i)=@sum(city(j):x(i,j)));
@for(country(i):a(i)=@if(d(i)#ge#1,1,0));
@sum(country(i):a(i))=3;@for(link:@bin(x););
data:
c= 2 2 1 1 0 0 3 1 2 1 1 1 2 1 2 0 0 0 3 1 0 0 0 0 2 2 2 0 0 0 2 1 0 0 0 0 1 1 1 0 0 0 2 1 0 0 0 0 2 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0;
b= 0.6222 0.2188 0.1459 0.3788 0 0 0.6108 0.1043 0.1586 0.1155 0.1324 0.3646 0.6768 0.4811 0.5188 0 0 0 0.9318 0.2339 0 0 0 0 0.1054 0.7149 0.5773 0 0 0 0.4232 0.2336 0 0 0 0 0.2500 0.2164 0.0920 0 0 0 0.4762 0.2982 0 0 0 0 0.2887 0 0 0 0 0 0.5718 0.1757 0 0 0 0 0.0685 0.0481 0 0 0 0;
enddata
end
model:
sets:
country/co1..co11/:a,d;
city/c1..c6/;
link(country,city):x,c,b;
endsets
max=@sum(link:x*b);
@sum(link:c*x)<=12;
@for(country(i):d(i)=@sum(city(j):x(i,j)));
@for(country(i):a(i)=@if(d(i)#ge#1,1,0));
@sum(country(i):a(i))=3;@for(link:@bin(x););
data:
c= 2 2 1 1 0 0 3 1 2 1 1 1 2 1 2 0 0 0 3 1 0 0 0 0 2 2 2 0 0 0 2 1 0 0 0 0 1 1 1 0 0 0 2 1 0 0 0 0 2 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0;
b= 0.6222 0.2188 0.1459 0.3788 0 0 0.6108 0.1043 0.1586 0.1155 0.1324 0.3646 0.6768 0.4811 0.5188 0 0 0 0.9318 0.2339 0 0 0 0 0.1054 0.7149 0.5773 0 0 0 0.4232 0.2336 0 0 0 0 0.2500 0.2164 0.0920 0 0 0 0.4762 0.2982 0 0 0 0 0.2887 0 0 0 0 0 0.5718 0.1757 0 0 0 0 0.0685 0.0481 0 0 0 0;
enddata
end