运筹学第三版(刁在钧)光盘中的内容
第二章 线性规划本章, 我们介绍三种解决线性规划问题的软件:第一种: MATLAB软件中的optimization toolbox中的若干程序;第二种: LINDO软件;第三种: LINGO软件.1. MATLAB程序说明程序名: lprogram执行实例:file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.gif 在命令窗口的程序执行过程和结果如下:the program is with the linear programmingPlease input the constraints number of the linear programming m=7m =7Please input the variant number of the linear programming n=4n =4Please input cost array of the objective function c(n)_T=[-2,-1,3,-5]'c =-2
-1
3
-5Please input the coefficient matrix of the constraints A(m,n)=1,0,1,1;-1,0,0,0;0,-1,0,0;0,0,-1,0;0,0,0,-1]A =
1
2
4
-1
2
3
-1
1
1
0
1
1
-1
0
0
0
0
-1
0
0
0
0
-1
0
0
0
0
-1Please input the resource array of the program b(m)_T='b =
6
12
4
0
0
0
0Optimization terminated successfully.The optimization solution of the programming is:x =
0.0000
2.6667
-0.0000
4.0000The optimization value of the programming is:opt_value = -22.6667 注: 红色字表示计算机的输出结果. 程序的相关知识:Solve a linear programming problemfile:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image003.gifwhere f, x, b, beq, lb, and ub are vectors and A and Aeq are matrices. 相关的语法:x = linprog(f,A,b,Aeq,beq)x = linprog(f,A,b,Aeq,beq,lb,ub)x = linprog(f,A,b,Aeq,beq,lb,ub,x0)x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) = linprog(...) = linprog(...) = linprog(...) = linprog(...) 解释:linprog solves linear programming problems. x = linprog(f,A,b) solves min f'*x such that A*x <= b. x = linprog(f,A,b,Aeq,beq) solves the problem above while additionally satisfying the equality constraints Aeq*x = beq. Set A=[] and b=[] if no inequalities exist. x = linprog(f,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that the solution is always in the range lb <= x <= ub. Set Aeq=[] and beq=[] if no equalities exist. x = linprog(f,A,b,Aeq,beq,lb,ub,x0) sets the starting point to x0. This option is only available with the medium-scale algorithm (the LargeScale option is set to 'off' using optimset). The default large-scale algorithm and the **x algorithm ignore any starting point. x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) minimizes with the optimization options specified in the structure options. Use optimset to set these options. = linprog(...) returns the value of the objective function fun at the solution x: fval = f'*x. = linprog(...) returns a value exitflag that describes the exit condition. = linprog(...) returns a structure output that contains information about the optimization. = linprog(...) returns a structure lambda whose fields contain the Lagrange multipliers at the solution x. 2.LINDO 程序说明程序名:linear执行实例:file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image005.gif 在命令窗口键入以下内容:max 10x+15y !也可以直接解决min问题subject tox<10y<12x+2y<16end
!注释符号; 系统默认为自变量>0, 若不要求用free命令.
!在出来report windows之前可选择显示对此规划进行灵敏度分析等 按solve键, 在reports window中出现以下内容:LP OPTIMUM FOUND AT STEP
2
OBJECTIVE FUNCTION VALUE
1)
145.0000
VARIABLE
VALUE
REDUCED COST
X
10.000000
0.000000
Y
3.000000
0.000000
ROW
SLACK OR SURPLUS
DUAL PRICES
2)
0.000000
2.500000
3)
9.000000
0.000000
4)
0.000000
7.500000
NO. ITERATIONS=
2
RANGES IN WHICH THE BASIS IS UNCHANGED:
OBJ COEFFICIENT RANGES
VARIABLE
CURRENT
ALLOWABLE
ALLOWABLE
COEF
INCREASE
DECREASE
X
10.000000
INFINITY
2.500000
Y
15.000000
5.000000
15.000000
RIGHTHAND SIDE RANGES
ROW
CURRENT
ALLOWABLE
ALLOWABLE
RHS
INCREASE
DECREASE
2
10.000000
6.000000
10.000000
3
12.000000
INFINITY
9.000000
4
16.000000
18.000000
6.000000 3.LINGO 程序说明3.1 程序名: linearp1(求极小问题)linearp1运行实例:file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image007.gif在model window中输入以下语句:min=5*x1+21*x3;x1-x2+6*x3-x4=2;x1+x2+2*x3-x5=1; 按运行按钮在solution
report 窗口得到以下结果:
Global optimal solution found at iteration:
2
Objective value:
7.750000
Variable
Value
Reduced Cost
X1
0.5000000
0.000000
X3
0.2500000
0.000000
X2
0.000000
0.5000000
X4
0.000000
2.750000
X5
0.000000
2.250000
Row
Slack or Surplus
Dual Price
1
7.750000
-1.000000
2
0.000000
-2.750000
3
0.000000
-2.250000 3.2 程序名: linearp2(求极大问题)linearp2运行实例:file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image009.gif 在model window中输入以下语句:max=100*x+150*y;
! this is a commnent;x<=100;y<=120;x+2*y<=160; 按运行按钮在solution report 窗口得到以下结果: Global optimal solution found at iteration:
2
Objective value:
14500.00
Variable
Value
Reduced Cost
X
100.0000
0.000000
Y
30.00000
0.000000
Row
Slack or Surplus
Dual Price
1
14500.00
1.000000
2
0.000000
25.00000
3
90.00000
0.0000004
0.000000
75.00000 先下下来看看
页:
[1]