|
sets:
!yongshui/yong/1A,Q2A,Q1B,Q2B,PA,PB,XA,XB,SA;
jieshui/1..3/:XA,XB,SB,SA;
ganliu/1..12/:vj,xia,xib,Q1A,Q2A,Q1B,Q2B,PA,PB;
zhiliu/1,2/:xia2,xib2;
links1(ganliu,jieshui): wij;
links(ganliu,jieshui): xia1,xib1;
endsets
!目标函数;
@FOR(ganliu(i):
max=2000*(Q1A(i)+Q1B(i))+1200*(Q2A(i)+Q2B(i)));
!限制条件;
@if(@for(ganliu(i):vj(i)+@sum(jieshui(j):wij(i,j))#ge#500));
@FOR(ganliu(i)1A(i)+Q1B(i)=20*PA(i));
@for(ganliu(i)1B(i)+Q2B(i)=15*PB(i));
@for(ganliu(i):Q1A(i)+Q1B(i)<=9000);
@for(ganliu(i)A(i)<=SA(i)+XA(i)+@SUM(ganliu(i):xia(i)));
@for(ganliu(i):20*PA(i)<=1200);
@for(ganliu(i)|i#gt#1:2200+SA(i-1)+XA(i-1)+@sum(zhiliu(i):xia2(i-1))<=2500);
@for(ganliu(i)B(i)<=SB(i)+XB(i)+@sum(jieshui(i):xib(i)));
@for(ganliu(i):15*PB(i)<=800);
@for(ganliu(i)|i#gt#1:1300<=SB(i-1)+XB(i-1)+@sum(jieshui(i):xib(i)));
@for(ganliu(i)|i#gt#1:SB(i-1)+XB(i-1)+@sum(jieshui(i):xib(i))<=1600);
@for(ganliu(i):XA(i)+XB(i)<=vj(i));
@for(links(i,j):xia1(i,j)+xib1(i,j)<=wij(i,j));
@if(@for(ganliu(i):vj(i)+@sum(jieshui(j):wij(i,j))#lt#500));
@FOR(ganliu(i):Q1A(i)+Q1B(i)=20*PA(i));
@for(ganliu(i):Q1B(i)+Q2B(i)=15*PB(i));
@for(ganliu(i):Q1A(i)+Q1B(i)<=9000);
@for(ganliu(i)A(i)<=SA(i)+XA(i)+@SUM(ganliu(i):xia(i)));
@for(ganliu(i):20*PA(i)<=1200);
@for(ganliu(i)|i#gt#1:2200+SA(i-1)+XA(i-1)+@sum(zhiliu(i):xia2(i-1))<=3000);
@for(ganliu(i):PB(i)<=SB(i)+XB(i)+@sum(jieshui(i):xib(i)));
@for(ganliu(i):15*PB(i)<=800);
@for(ganliu(i)|i#gt#1:1300<=SB(i-1)+XB(i-1)+@sum(jieshui(i):xib(i)));
@for(ganliu(i)|i#gt#1:SB(i-1)+XB(i-1)+@sum(jieshui(i):xib(i))<=2100);
@for(ganliu(i):XA(i)+XB(i)<=vj(i));
@for(links(i,j):xia1(i,j)+xib1(i,j)<=wij(i,j));
!这里是数据;
data:
vj=417.7575
51.9156
298.7572
584.5667
367.2415
620.6028
516.1856
306.4603
751.7399
545.4762
186.7592
217.3451;
wij=125.2722 140.8795 23.0709
177.3198 72.7826 60.3576
133.471 131.8624 59.2441
170.6446 153.9466 16.6118
253.3656 192.0216 18.493
226.819 192.0261 87.8238
178.8254 191.458 40.5921
142.7199 134.1288 203.8025
146.2138 104.5679 6.5488
119.834 115.7186 133.3922
165.9355 32.878 89.3362
40.8715 145.2462 9.7968;
enddata
end
另外if(@for(ganliu(i):vj(i)+@sum(jieshui(j):wij(i,j))#ge#500));
这语句是想用来实现:当(@for(ganliu(i):vj(i)+@sum(jieshui(j):wij(i,j))这条语句大于或等于500时继续执行下面的语句.而@if(@for(ganliu(i):vj(i)+@sum(jieshui(j):wij(i,j))#lt#500));则是想实现小于500是执行下面的语句.
请问lingo只能解决单目标规划吗?那是一个循环.这样也不行吗? | 该如何解决这类.以12个月利润最大为目标函数的线形规划问题呢? | |
|
|