sets:
month/1..6/;
count/1..5/:p,pr;
many(month,count):price,x,y;
endsets
max <a href="mailt=@sum(many(i,j):1500*y(i,j)-25*y(i,j)-price(i,j)*x(i,j)-(i-1)*50*(x(i,j)-y(i,j)))-500*50*6" target="_blank" >=@sum(many(i,j):1500*y(i,j)-25*y(i,j)-price(i,j)*x(i,j)-(i-1)*50*(x(i,j)-y(i,j)))-500*50*6</A>;
@for(many(i,j):@sum(month(i):x(i,j)-y(i,j))=0);
@for(many(i,j):@for(count(j)|j#le#2:price(i,j)=pr(j)*(1+v*(i-1))));
@for(many(i,j):@for(count(j)|j#ge#3:price(i,j)=pr(j)*(1+2*v*(i-1))));
@for(month(i):y(i,1)+y(i,2)<200);
@for(month(i):y(i,3)+y(i,4)+y(i,5)<250);
@for(many:x<1000);
@for(month(i):@sum(count(j):p(j)*y(i,j))<@sum(count(j):y(i,j))*6);
@for(month(i):@sum(count(j):p(j)*y(i,j))>@sum(count(j):y(i,j))*3);
@for(many:@gin(x));!整数;
@for(many:@gin(y));!整数;
@for(count(j):x(1,j)-y(1,j)+500>0);
@for(count(j):x(1,j)-y(1,j)+500<1000);
@for(count(j):x(1,j)+x(2,j)-y(1,j)-y(2,j)+500>0 );
@for(count(j):x(1,j)+x(2,j)-y(1,j)-y(2,j)+500<1000 );
@for(count(j):x(1,j)+x(2,j)+x(3,j)-y(1,j)-y(2,j)-y(3,j)+500>0);
@for(count(j):x(1,j)+x(2,j)+x(3,j)-y(1,j)-y(2,j)-y(3,j)+500<1000);
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)+500>0);
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)+500<1000);
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)+x(5,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)-y(5,j)+500>0);
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)+x(5,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)-y(5,j)+500<1000);
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)+x(5,j)+x(6,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)-y(5,j)-y(6,j)+500>0 );
@for(count(j):x(1,j)+x(2,j)+x(3,j)+x(4,j)+x(5,j)+x(6,j)-y(1,j)-y(2,j)-y(3,j)-y(4,j)-y(5,j)-y(6,j)+500<1000 );
data:
pr=1100 1200 1300 1100 1150;
p=8.8 6.1 2.0 4.2 5;
v=?;
enddata
end
</P>
回复:(沧海一月)高手帮我看一下,程序怎么出错了,...
<P><FONT face=宋体>你的程序基本没有错误。我试了。</FONT></P><P><FONT face=宋体>计算的部分结果为:</FONT></P>
<P><FONT face=宋体>Global optimal solution found at iteration: 23
Objective value: 3083.200</FONT></P>
<P>
<FONT face=宋体> Variable Value Reduced Cost
LEVEL( 1, 2, 3) 512.6400 0.000000
LEVEL( 1, 2, 4) 499.9667 0.000000
LEVEL( 1, 2, 5) 492.6867 0.000000
LEVEL( 1, 2, 6) 514.1167 0.000000
LEVEL( 1, 2, 7) 509.7600 0.000000
LEVEL( 1, 2, 8) 494.1600 0.000000
LEVEL( 1, 2, 9) 497.6400 0.000000
LEVEL( 1, 2, 10) 521.2800 0.000000
LEVEL( 1, 2, 11) 504.5733 0.000000
LEVEL( 1, 2, 12) 485.1933 0.000000
LEVEL( 1, 2, 13) 499.7000 0.000000
LEVEL( 1, 2, 14) 504.3133 0.000000
LEVEL( 1, 2, 15) 501.9600 0.000000
LEVEL( 1, 2, 16) 501.8533 0.000000
LEVEL( 1, 2, 17) 515.6433 0.000000
LEVEL( 1, 2, 18) 498.3067 0.000000
LEVEL( 1, 3, 4) 516.8800 0.000000
LEVEL( 1, 3, 5) 507.6000 0.000000
LEVEL( 1, 3, 6) 531.0800 0.000000
LEVEL( 1, 3, 7) 526.9433 0.000000
LEVEL( 1, 3, 8) 506.3500 0.000000
LEVEL( 1, 3, 9) 512.7733 0.000000
LEVEL( 1, 3, 10) 525.9800 0.000000
LEVEL( 1, 3, 11) 519.6500 0.000000
LEVEL( 1, 3, 12) 500.0800 0.000000
LEVEL( 1, 3, 13) 516.7067 0.000000
LEVEL( 1, 3, 14) 518.5133 0.000000
LEVEL( 1, 3, 15) 512.2300 0.000000
LEVEL( 1, 3, 16) 513.0933 0.000000
LEVEL( 1, 3, 17) 532.8000 0.000000
LEVEL( 1, 3, 18) 515.1200 0.000000
LEVEL( 1, 4, 5) 488.4433 0.000000
LEVEL( 1, 4, 6) 501.2700 0.000000
LEVEL( 1, 4, 7) 504.5733 0.000000
LEVEL( 1, 4, 8) 493.7333 0.000000
LEVEL( 1, 4, 9) 493.5000 0.000000
LEVEL( 1, 4, 10) 518.7733 0.000000
LEVEL( 1, 4, 11) 501.2000 0.000000
LEVEL( 1, 4, 12) 483.8267 0.000000
LEVEL( 1, 4, 13) 497.3700 0.000000
LEVEL( 1, 4, 14) 501.0200 0.000000
LEVEL( 1, 4, 15) 500.4000 0.000000
LEVEL( 1, 4, 16) 500.3400 0.000000
LEVEL( 1, 4, 17) 503.7400 0.000000
LEVEL( 1, 4, 18) 490.2900 0.000000
LEVEL( 1, 5, 6) 497.6767 0.000000
LEVEL( 1, 5, 7) 481.2800 0.000000
LEVEL( 1, 5, 8) 467.0400 0.000000
LEVEL( 1, 5, 9) 462.9333 0.000000
LEVEL( 1, 5, 10) 487.8600 0.000000
LEVEL( 1, 5, 11) 477.2333 0.000000
LEVEL( 1, 5, 12) 455.5833 0.000000
LEVEL( 1, 5, 13) 470.5800 0.000000
LEVEL( 1, 5, 14) 475.0667 0.000000
LEVEL( 1, 5, 15) 487.6000 0.000000
LEVEL( 1, 5, 16) 495.8300 0.000000
LEVEL( 1, 5, 17) 505.8000 0.000000
LEVEL( 1, 5, 18) 466.5833 0.000000
LEVEL( 1, 6, 7) 517.8267 0.000000
LEVEL( 1, 6, 8) 507.7333 0.000000
LEVEL( 1, 6, 9) 506.6600 0.000000
LEVEL( 1, 6, 10) 532.0267 0.000000
LEVEL( 1, 6, 11) 506.8000 0.000000
LEVEL( 1, 6, 12) 498.6000 0.000000
LEVEL( 1, 6, 13) 508.6100 0.000000
LEVEL( 1, 6, 14) 515.1200 0.000000
LEVEL( 1, 6, 15) 514.3000 0.000000
LEVEL( 1, 6, 16) 513.3600 0.000000
LEVEL( 1, 6, 17) 514.1167 0.000000
LEVEL( 1, 6, 18) 502.2933 0.000000
LEVEL( 1, 7, 8) 484.5000 0.000000
LEVEL( 1, 7, 9) 485.9867 0.000000
LEVEL( 1, 7, 10) 511.5300 0.000000
LEVEL( 1, 7, 11) 503.5000 0.000000
LEVEL( 1, 7, 12) 474.7000 0.000000
</FONT></P>
<P><FONT face=宋体>model:</FONT><FONT face=宋体>
!init:
endinit;
sets:
mumbers/1..18/;
pairs(mumbers,mumbers,mumbers)|&1#lt#&2#and#&2#lt#&3:level,binx;
endsets
</FONT><a href="mailtmax=@sum(pairs(i,j,k):level(i,j,k)*binx(i,j,k" target="_blank" ><FONT face=宋体>max=@sum(pairs(i,j,k):level(i,j,k)*binx(i,j,k</FONT></A><FONT face=宋体>)); !目标;
</FONT><a href="mailt!@for(mumbers(i" target="_blank" ><FONT face=宋体>!@for(mumbers(i</FONT></A><FONT face=宋体>):
@sum(pairs(l,m,n)|l#eq#i#or#m#eq#i#or#k#eq#i:binx(l,m,n))=1);
@sum(pairs(l,m,n)|l#eq#1:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#2#or#m#eq#2:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#3#or#m#eq#3#or#n#eq#3:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#4#or#m#eq#4#or#n#eq#4:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#5#or#m#eq#5#or#n#eq#5:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#6#or#m#eq#6#or#n#eq#6:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#7#or#m#eq#7#or#n#eq#7:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#8#or#m#eq#8#or#n#eq#8:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#9#or#m#eq#9#or#n#eq#9:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#10#or#m#eq#10#or#n#eq#10:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#11#or#m#eq#11#or#n#eq#11:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#12#or#m#eq#12#or#n#eq#12:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#13#or#m#eq#13#or#n#eq#13:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#14#or#m#eq#14#or#n#eq#14:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#15#or#m#eq#15#or#n#eq#15:binx(l,m,n))=1;
@sum(pairs(l,m,n)|l#eq#16#or#m#eq#16#or#n#eq#16:binx(l,m,n))=1;
@sum(pairs(l,m,n)|m#eq#17#or#n#eq#17:binx(l,m,n))=1;
@sum(pairs(l,m,n)|n#eq#18:binx(l,m,n))=1;
@for(pairs:@bin(binx));
data:
level=
512.6400499.9667492.6867514.1167509.7600494.1600497.6400521.2800504.5733485.1933499.7000504.3133501.9600501.8533515.6433498.3067516.8800507.6000531.0800526.9433506.3500512.7733525.9800519.6500500.0800516.7067518.5133512.2300513.0933532.8000515.1200488.4433501.2700504.5733493.7333493.5000518.7733501.2000483.8267497.3700501.0200500.4000500.3400503.7400490.2900497.6767481.2800467.0400462.9333487.8600477.2333455.5833470.5800475.0667487.6000495.8300505.8000466.5833517.8267507.7333506.6600532.0267506.8000498.6000508.6100515.1200514.3000513.3600514.1167502.2933484.5000485.9867511.5300503.5000474.7000487.1533493.6400493.3633504.5733512.6400474.7000471.6667499.7000488.9400460.5533478.4600483.9300491.0400500.2667509.3067473.5267495.5533485.8167460.1333476.1733481.6500492.6867501.0200510.9867471.3333507.3000486.9200497.6400496.5100506.5700515.9333539.5200496.3200477.2333491.6200495.2500499.4100507.7333518.7733488.3533467.7900473.2000480.2400489.3667499.2433463.8333479.9600490.0000498.3067513.9500472.4400491.7500501.0200521.4733477.8667491.1333511.3600479.3200513.1733492.1367502.0533517.7500511.2867532.9500527.8000508.1267515.5200529.7333523.3800502.7967517.5567519.3600513.0933513.9500533.6867516.0033496.6933508.6667512.0500496.4333498.0800525.3500508.6100487.4267501.0200504.6833504.0600503.0667508.3600500.4000505.0333508.4567492.9000492.6867513.1733495.6900483.9200493.7333497.3700500.4467499.4733514.1800493.1200525.3500514.2300514.1167534.8500
513.2933505.0333512.3000517.8900517.0800516.1333521.6133509.6667500.5000509.7600537.4667520.5200497.1367509.9033515.5200503.6267507.3000511.5300502.7967494.1600521.4733504.7800481.7400497.1367500.7867496.5333498.3067506.3500496.6200521.2800504.5733485.1933496.8500500.5000501.9600500.9100515.6433496.4333522.4267512.2300522.3400522.2400522.5600522.5000543.3200521.6633495.6900505.6267508.3600512.4000511.4200526.3000504.9900488.1333491.7500489.3667489.2800502.9000487.6000501.6000502.0533501.0200515.7533495.6000504.7800503.7400521.3833502.0533493.8300509.4000495.8300513.0933496.6933508.5400513.3600525.4700531.9600512.3000517.8267531.9600525.4600506.8500519.7767521.6133517.0667517.0400528.2000518.0100521.7300525.4000504.9333507.6000517.8267510.5333498.6000510.4833511.3600510.5933510.5700531.0967509.6800542.4467527.3400531.0800541.4933530.1600521.7300529.2100532.0267527.3333527.3433538.6500526.3800522.3400529.8333544.1700537.6467516.8800528.9600532.7233518.7000521.4733537.4667520.6667509.2000523.2967516.9467496.5333512.1467513.9500507.6733508.5400528.1467510.5333525.9800519.6500502.9000515.7533517.5567515.0600514.9867535.6800514.1800527.1233516.8800528.9600528.8700529.1500529.1000550.0333528.2400510.5333522.5600522.5000522.6600522.6400543.4000521.7333506.7367508.5400502.2533503.1300522.6067505.0633517.6600514.1800514.1167534.7767513.2933517.8900517.8267538.5600517.0000506.8000524.4533506.8867527.2500508.7100526.3800491.3733503.1300489.5000
487.5200513.3600492.2500480.5333493.1200497.6767500.5000499.5933499.4733487.7867509.5467499.5233499.4100526.4067501.3700493.2000503.1800509.6400508.7500507.8400505.8667495.9400501.0200501.7333534.8200517.0000493.8300507.5133511.2000503.0667503.9267500.6500494.7600488.1333523.5800503.1800480.3333498.4800501.2000500.4800499.5233497.3700493.1667521.6133501.2000480.1333496.4333499.1400500.4000499.4100498.0800491.2133522.6400512.4300520.7200519.7200519.8667519.8500533.9000518.9400492.2500504.9900508.6667512.4400511.5267513.2933501.4167487.6000490.2900489.5800488.6333490.2067484.1600500.1800500.4467499.4733505.7200493.1200499.4733499.4100510.3433498.6000490.4167502.2000492.3100503.0667494.1133493.9133507.7800497.7500496.7533522.6600497.7500489.6000499.5600505.9867505.0500504.1600504.1067492.3200482.5333480.3400506.4667494.6667473.6700483.3200489.7400494.8400504.9900510.3433471.8233466.1133491.8667480.2400459.5500472.7467477.2333489.5467497.7500506.8500467.7400487.8600477.2333455.5833470.5800475.0667487.6000495.8300504.8633465.6667498.4000479.2100491.7500491.6200501.3267510.5700531.0967491.2133468.6500482.9033486.5000490.4600498.6667509.6400479.5700462.1467466.5833478.7667486.8800497.7200459.0000475.2300485.8333494.0400507.7333468.5400488.5200496.7533514.2300474.8333491.4000509.6800479.6700510.5933489.6000495.8800511.3600515.9333543.4000517.9400509.6400519.7767526.3467521.7333522.6600515.8500507.7800505.8667532.9800507.8133499.5833509.6400
516.1333515.2000514.2967511.4200502.3333532.0267506.8000498.6000508.6100515.1200514.3000513.3600512.2300501.3700528.2800522.6600530.1533532.0267528.2667528.2800539.6000527.3100497.7500507.7800513.3333513.3600512.4500514.2300502.3333499.5600505.9867505.0500504.1600505.9600494.1333513.2933512.4500511.5200516.0600504.1600515.2267514.2900522.6067510.6033508.7500518.0100505.9600518.9333506.9000504.1067478.8000516.6000505.6267470.4000488.4800493.0500488.9400502.9000495.7333476.9333514.4200503.5000471.8800486.2000490.7700492.4200503.6267506.8800474.7000525.2100505.5200510.7200511.5300513.9500525.2867545.2000502.6800494.6667504.5733510.1500506.7367517.0000524.3333494.6667477.7000482.2200480.9400491.9700498.0800468.1300490.0133494.4400504.6833516.6000476.7633494.3067504.5733521.2800483.1600491.8667506.4667486.5000512.0500496.6200504.6833499.7000488.9400448.5067466.2400478.2700487.3200496.5333503.6267470.7467510.3433490.9333501.7333501.6000511.4200520.7600541.4933501.2000480.2400493.7333497.3700501.3700509.6667520.7600490.3600457.9733469.8200475.8467484.9167494.7600464.1000481.2800491.1333499.4100513.1733474.5933491.9700500.2667517.8267481.8667489.4400504.0000484.9800508.6100495.0000501.2700507.3000486.9200499.5467499.3800509.4000518.7733539.5200499.1400477.2333491.6200495.2500499.4100507.7333518.7733488.3533455.7000467.6000477.4800485.6733496.4333462.0000479.0133489.0667497.3700511.1000472.4400489.8767498.2000515.7533479.7333490.2067507.6000
483.0000509.4000493.0600499.2433498.4000510.2533510.1500510.4833519.8200540.5400509.6000490.8133490.6800500.4000509.6400530.1533490.2900497.6400505.7200515.0600537.6467495.4967506.5700515.9333539.5200496.3200510.5333532.0267498.5467533.9000509.6400530.1533482.9033486.5000490.4600498.6667509.6400479.5700495.3800497.6200505.9200519.7767489.3667499.4100507.7333525.4000494.8400503.2400521.7333491.3733522.6600501.4167509.6400470.5800480.3333488.5200502.1333463.9733481.1600489.3667506.7367471.1667478.6600495.8300474.2500497.6200484.1600492.2000489.0667497.3700516.8000476.1600491.2133511.4200480.3333512.3000490.3600503.0667491.1333512.3000482.0800513.1733493.0600510.4833500.3400484.1200504.1400505.0333;
enddata
end</FONT></P>