LINGO学习《运筹学模型与实验》.doc
文本预览下载声明
LinGo 学习(运筹学模型与实验)
线性规划问题(Linear Programming)
max =2*x1+3*x2;
2*x1+2*x2=12;
x1+2*x2=8;
4*x1=16;
4*x2=12;
Solve
Global optimal solution found.
Objective value: 14.00000
Infeasibilities: 0.000000
Total solver iterations: 1
Variable Value Reduced Cost
X1 4.000000 0.000000
X2 2.000000 0.000000
Row Slack or Surplus Dual Price
1 14.00000 1.000000
2 0.000000 0.000000
3 0.000000 1.500000
4 0.000000 0.1250000
5 4.000000 0.000000
最优解为X1=4.000000,X2=2.000000,最优值为Z=14.
Generate \Display Model
MODEL:
[_1] MAX= 2 * X1 + 3 * X2 ;
[_2] 2 * X1 + 2 * X2 = 12 ;
[_3] X1 + 2 * X2 = 8 ;
[_4] 4 * X1 = 16 ;
[_5] 4 * X2 = 12 ;
END
程序形式(可得对偶问题的解)
model:
sets:
stral1/1..4/:b;
stral2/1..2/:x,c;
matrix(stral1,stral2):A;
endsets
max=@sum(stral2(i):c(i)*x(i));
@for(stral1(i):@sum(stral2(j):A(i,j)*x(j))=b(i));
data:
A=2 2
1 2
4 0
0 4;
b=12 8 16 12;
c=2
3;
enddata
end
Global optimal solution found.
Objective value: 14.00000
Infeasibilities: 0.000000
Total solver iterations: 1
Variable Value Reduced Cost
B( 1) 12.00000 0.000000
B( 2) 8.000000 0.000000
B( 3) 16.00000 0.000000
B( 4) 12.00000 0.000000
X( 1) 4.000000 0.000000
显示全部