MBA课程 线性规划 Linear Programing 英文原版
线性规划模型
线性规划模型线性规划的英文全称为:Linear Programming ,可简称为LP .一、线性规划所属学科线性规划是“运筹学”中应用最广泛、理论最成熟的一个分支.0-1⎧⎧⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩⎪⎪⎪⎩⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩线性规划非线性规划静态规划整数规划规划论规划多目标规划动态规划运筹学对策论决策论排队论图论存储论模型论 二、线性规划发展简史早在19世纪法国数学家傅里叶关于线性不等式的研究表明,他对线性规划已有所了解,还提出了单纯形法求解线性逼近中的线性规划20世纪三是年代末,苏联数学家康托洛维奇开始研究生产组织中的线性规划问题,并写出了线性规划应用于工业生产问题的经典著作《生产组织与计划中的数学方法》.1947年美国数学家丹奇格提出了单纯形(Simplex)方法及有关理论,为线性规划奠定了理论基础.五十年代,线性规划成为经济学家分析经济问题的重要工具.随着计算机的迅猛发展,线性规划现被广泛应用于工业、农业、商业等各个领域.三、用线性规划方法解决实际问题的两大特点1、全局性——从全局出发,将全局目标作为追求目标;2、定量性——通过建立数学模型,对实际问题进行定量分析,而不是只做定性分析. 数学模型指:将实际问题用一系列数学表达式(函数、方程、不等式等)表示出来,称这一系列数学表达式为该实际问题的数学模型.四、线性规划方法解决的两类问题1、任务一定,如何安排,可使人、财、物最省;2、人、财、物一定,如何安排,可使任务完成量最多.五、线性规划可解决以下几方面的问题1、运输问题:某产品有若干个产地、若干个销地,如何运输,使总运费最省;2、生产组织问题:⎩⎨⎧产,使成本最低产值一定,如何安排生最高或利润产,使产值资源一定,如何安排生)(3、配料问题:如何搭配各种原料,既符合质量(营养)要求,又使成本最低;4、投资问题:资金一定,投向谁、投多少、期限多长,使若干年后本利和最高;5、库存问题:在仓库容量有限情况下,如何确定库存物资的品种、数量、期限,使库存效益最佳;6、合理播种问题:在土地资源有限的情况下,种什么、种多少,使效益最高;……第一节 线性规划模型的基本概念一、建立模型的方法1 根据影响所要达到的目的的因素找到决策变量2 由决策变量和所要到的目的之间的函数关系确定的目标函数3 由决策变量所受到的限制条件确定决策变量所要满足的约束条件若模型满足:1 目标函数是线性函数 2 约束条件是线性等式或不等式;则称为线性规划模型二、常用模型例1: 生产计划莫工厂生产I II 两种产品需要A 、B 两种原料,问怎样生产获利最大?1) 决策变量:设12,x x 分别生产I II 的数量2) 目标函数:获利最大 12max 24x x +3) 约束条件:1228x x +≤ 设备约束12416,412x x ≤≤ 原料约束12,0x x ≥ 基本约束则我们可以建立模型12121212max 24.28416412,0z x x s t x x x x x x =++≤≤≤≥例2: 配料问题某养鸡场有一万只鸡,用动物饲料和谷物饲料混合喂养,每天每只鸡平均吃混合饲料一斤,其中动物饲料不少于1/5,动物饲料每斤0.25元,谷物饲料每斤0.2元,饲料公司每周至多能供应谷物饲料5万斤,问怎样混合饲料才能使每周成本最低?解:1)决策变量 设动物饲料1x 斤,谷物饲料2x 斤。
MBA2 管理运筹学讲义:线性规划
• 约束条件
任何管理决策问题都是限定在一定的条件下求解 把各种限制条件表示为一组等式或不等式,称之为约束条件 约束条件是决策方案可行的保障 LP的约束条件,都是决策变量的线性函数
• 目标函数
衡量决策方案优劣的准则,如时间最省、利润最大、成本最低 目标函数是决策变量的线性函数 有的目标要实现极大,有的则要求极小
24
上海财经大学国际工商管理学院 上海财经大学国际工商管理学院
4
SHUFE
第一节 线性规划的标准型
≤8 2x2 ≤12 3x1 +4 x2 ≤36 x1 ≥0, x2 ≥0 x1
x1 ≥0, x2 ≥0
• 例2. 运输问题 某名牌饮料在国内有三个生产厂,分布在城市A1、A2、 A3, 其一级承销商有 4 个,分布在城市 B1 、 B2 、 B3 、 B4,已知各厂的产量、各承销商的销售量及从Ai到Bj 的每吨饮料运费为 Cij ,为发挥集团优势,公司要统 一筹划运销问题,求运费最小的调运方案。
二、非标准型向标准型转化
• 目标函数极小化问题
minZ=CTX,只需将等式两端乘以 -1 即变为极大化问题。
• 右端常数项非正
两端同乘以 -1
• 为了求解方便,特规定一种线性规划的标准形式, 非标准型可以转化为标准型。标准形式为:
目标函数极大化 约束条件为等式 右端常数项bi≥0 决策变量非负
12
x1
17
上海财经大学国际工商管理学院 上海财经大学国际工商管理学院
18
3
SHUFE
第二节 线性规划的图解法
SHUFE
第二节 线性规划的图解法
二 、解的可能性 • 唯一最优解:只有一个最优点。 • 多重最优解:无穷多个最优解。若在两个顶点同时 得到最优解,则它们连线上的每一点都是最优解。
线性规划问题(Linear Programming)
3.解:设每周播放连续剧甲x次,播放连续剧乙y次,收视率为z,则 约束条件为 80 x 40 y 320 x y 6 x 0 y 0
目标函数为
z=60x+20y
做出可行域如图所示: 作
l0 :3x y 0
将l向上平移,当l过M点时,z取得最大 值。
由于直线同侧的点的坐标代入Ax+By+C中,所得 2、 2、点定域(代入特殊点验证) 实数符号相同,所以只需在直线的某一侧取一个 特别地,当C≠0时常把原点作为特殊点。 特殊点代入Ax+By+C中,从所得结果的正负即可 判断Ax+By+C>0表示哪一侧的区域。
练习
1:画出下列不等式所表示的平面区域:
解:设x,y分别是计划生产甲、乙两种
混合肥料的车皮数,则x,y所满足的数
学关系式为
4 x y ≤ 10 18 x 15 y ≤ 66 x≥0 y≥0
分别画出不等式组中, 各不等式所表示的区域.
y
然后取交集,就是不等 式组所表示的区域。
10 9 8 7 6 5 4 3 2 1 O
关于x,y一次不等 式组的约束条件
2 x y 50 x 10 y 20
时,求z的最大值和最小值. 线性规 划问题
所有的
任何一个满足 不等式组的 (x,y)
可行解
可行域
解线性规划问题的步骤:
1.找: 找出线性约束条件、目标函数; 2.画:画出线性约束条件所表示的可行域; 3.移:在线性目标函数所表示的一组平行线 中,利用平移的方法找出与可行域有公共点 且纵截距最大或最小的直线; 4.求:通过解方程组求出最优解; 5.答:作出答案。
LINEAR PROGRAMMING
A patient of limited financial means was advised by his doctor to increase the consumption of liver and chicken in his diet. In each meal he must get no less than200calories from this combination and no more than15units of fat. When he consulted his diet book, he found the following information: there are200calories in a pound of chicken and150calories in a pound of liver. However, there are15units of fat in a pound of liver and5units of fat in a pound of chicken. The price of chicken is£5a poundand the price of liver is£1.50a pound.The patient wants to minimize the total cost subject to the medical constraints imposed by his doctor.
Total number of hours spent at divisionD2= 4x(UnitP1)+3y(UnitP2)+3z(UnitP3)200
Total number of hours spent at divisionD3= 2x(UnitP1)+3y(UnitP2)+0z(UnitP3)30
LINEAR PROGRAMMING(线性规划)
LINEAR PROGRAMMINGA Concise IntroductionThomas S.FergusonContents1.Introduction (3)The Standard Maximum and Minimum Problems (4)The Diet Problem (5)The Transportation Problem (6)The Activity Analysis Problem (6)The Optimal Assignment Problem (7)Terminology (8)2.Duality (10)Dual Linear Programming Problems (10)The Duality Theorem (11)The Equilibrium Theorem (12)Interpretation of the Dual (14)3.The Pivot Operation (16)4.The Simplex Method (20)The Simplex Tableau (20)The Pivot Madly Method (21)Pivot Rules for the Simplex Method (23)The Dual Simplex Method (26)5.Generalized Duality (28)The General Maximum and Minimum Problems (28)Solving General Problems by the Simplex Method (29)Solving Matrix Games by the Simplex Method (30)6.Cycling (33)A Modification of the Simplex Method That Avoids Cycling (33)7.Four Problems with Nonlinear Objective Function (36)Constrained Games (36)The General Production Planning Problem (36)Minimizing the Sum of Absolute Values (37)Minimizing the Maximum of Absolute Values (38)Chebyshev Approximation (39)Linear Fractional Programming (39)Activity Analysis to Maximize the Rate of Return (40)8.The Transportation Problem (42)Finding a Basic Feasible Shipping Schedule (44)Checking for Optimality (45)The Improvement Routine (47)9.Solutions to the Exercises (50)Related Texts (65)LINEAR PROGRAMMING1.Introduction.A linear programming problem may be defined as the problem of maximizing or min-imizing a linear function subject to linear constraints.The constraints may be equalitiesor inequalities.Here is a simple example.Find numbers x1and x2that maximize the sum x1+x2subject to the constraintsx1≥0,x2≥0,andx1+2x2≤44x1+2x2≤12−x1+x2≤1In this problem there are two unknowns,andfive constraints.All the constraints areinequalities and they are all linear in the sense that each involves an inequality in some linear function of the variables.Thefirst two constraints,x1≥0and x2≥0,are special. These are called nonnegativity constraints and are often found in linear programmingproblems.The other constraints are then called the main constraints.The function to bemaximized(or minimized)is called the objective function.Here,the objective function isx1+x2.Since there are only two variables,we can solve this problem by graphing the set of points in the plane that satisfies all the constraints(called the constraint set)and thenfinding which point of this set maximizes the value of the objective function.Each inequality constraint is satisfied by a half-plane of points,and the constraint set is the intersection of all the half-planes.In the present example,the constraint set is thefive-sidedfigure shaded in Figure1.We seek the point(x1,x2),that achieves the maximum of x1+x2as(x1,x2)ranges over this constraint set.The function x1+x2is constant on lines with slope−1,for example the line x1+x2=1,and as we move this line further from the origin up and to the right,the value of x1+x2increases.Therefore,we seek the line of slope−1that is farthest from the origin and still touches the constraint set.This occurs at the intersection of the lines x1+2x2=4and4x1+2x2=12,namely,(x1,x2)=(8/3,2/3).The value of the objective function there is(8/3)+(2/3)=10/3.Exercises1and2can be solved as above by graphing the feasible set.It is easy to see in general that the objective function,being linear,always takes onits maximum(or minimum)value at a corner point of the constraint set,provided thex2x1Figure1.constraint set is bounded.Occasionally,the maximum occurs along an entire edge or face of the constraint set,but then the maximum occurs at a corner point as well.Not all linear programming problems are so easily solved.There may be many vari-ables and many constraints.Some variables may be constrained to be nonnegative and others unconstrained.Some of the main constraints may be equalities and others inequal-ities.However,two classes of problems,called here the standard maximum problem and the standard minimum problem,play a special role.In these problems,all variables are constrained to be nonnegative,and all main constraints are inequalities.We are given an m-vector,b=(b1,...,b m)T,an n-vector,c=(c1,...,c n)T,and anm×n matrix,A=⎛⎜⎜⎝a11a12 (1)a21a22 (2)............a m1a m2···a mn⎞⎟⎟⎠of real numbers.The Standard Maximum Problem:Find an n-vector,x=(x1,...,x n)T,to maximizec T x=c1x1+···+c n x nsubject to the constraintsa11x1+a12x2+···+a1n x n≤b1a21x1+a22x2+···+a2n x n≤b2...a m1x1+a m2x2+···+a mn x n≤b m(or Ax≤b)andx1≥0,x2≥0,...,x n≥0(or x≥0).The Standard Minimum Problem:Find an m-vector,y=(y1,...,y m),to minimizey T b=y1b1+···+y m b msubject to the constraintsy1a11+y2a21+···+y m a m1≥c1y1a12+y2a22+···+y m a m2≥c2(or y T A≥c T)...y1a1n+y2a2n+···+y m a mn≥c nandy1≥0,y2≥0,...,y m≥0(or y≥0).Note that the main constraints are written as≤for the standard maximum problem and≥for the standard minimum problem.The introductory example is a standard maximum problem.We now present examples of four general linear programming problems.Each of these problems has been extensively studied.Example1.The Diet Problem.There are m different types of food,F1,...,F m, that supply varying quantities of the n nutrients,N1,...,N n,that are essential to good health.Let c j be the minimum daily requirement of nutrient,N j.Let b i be the price per unit of food,F i.Let a ij be the amount of nutrient N j contained in one unit of food F i. The problem is to supply the required nutrients at minimum cost.Let y i be the number of units of food F i to be purchased per day.The cost per day of such a diet isb1y1+b2y2+···+b m y m.(1) The amount of nutrient N j contained in this diet isa1j y1+a2j y2+···+a mj y mfor j=1,...,n.We do not consider such a diet unless all the minimum daily requirements are met,that is,unlessa1j y1+a2j y2+···+a mj y m≥c j for j=1,...,n.(2) Of course,we cannot purchase a negative amount of food,so we automatically have the constraintsy1≥0,y2≥0,...,y m≥0.(3) Our problem is:minimize(1)subject to(2)and(3).This is exactly the standard minimum problem.Example 2.The Transportation Problem.There are I ports,or produc-tion plants,P1,...,P I,that supply a certain commodity,and there are J markets, M1,...,M J,to which this commodity must be shipped.Port P i possesses an amount s i of the commodity(i=1,2,...,I),and market M j must receive the amount r j of the commodity(j=1,...,J).Let b ij be the cost of transporting one unit of the commodity from port P i to market M j.The problem is to meet the market requirements at minimum transportation cost.Let y ij be the quantity of the commodity shipped from port P i to market M j.The total transportation cost isI i=1Jj=1y ij b ij.(4)The amount sent from port P i is Jj=1y ij and since the amount available at port P i iss i,we must haveJj=1y ij≤s i for i=1,...,I.(5)The amount sent to market M j is Ii=1y ij,and since the amount required there is r j,we must haveIi=1y ij≥r j for j=1,...,J.(6) It is assumed that we cannot send a negative amount from P I to M j,we havey ij≥0for i=1,...,I and j=1,...,J.(7) Our problem is:minimize(4)subject to(5),(6)and(7).Let us put this problem in the form of a standard minimum problem.The number of y variables is IJ,so m=IJ.But what is n?It is the total number of main constraints. There are n=I+J of them,but some of the constraints are≥constraints,and some of them are≤constraints.In the standard minimum problem,all constraints are≥.This can be obtained by multiplying the constraints(5)by−1:Jj=1(−1)y ij≥−s j for i=1,...,I.(5 )The problem“minimize(4)subject to(5 ),(6)and(7)”is now in standard form.In Exercise3,you are asked to write out the matrix A for this problem.Example3.The Activity Analysis Problem.There are n activities,A1,...,A n, that a company may employ,using the available supply of m resources,R1,...,R m(labor hours,steel,etc.).Let b i be the available supply of resource R i.Let a ij be the amountof resource R i used in operating activity A j at unit intensity.Let c j be the net value to the company of operating activity A j at unit intensity.The problem is to choose the intensities which the various activities are to be operated to maximize the value of the output to the company subject to the given resources.Let x j be the intensity at which A j is to be operated.The value of such an activity allocation isnj=1c j x j.(8)The amount of resource R i used in this activity allocation must be no greater than the supply,b i;that is,j=1a ij x j≤b i for i=1,...,m.(9) It is assumed that we cannot operate an activity at negative intensity;that is,x1≥0,x2≥0,...,x n≥0.(10) Our problem is:maximize(8)subject to(9)and(10).This is exactly the standard maximum problem.Example4.The Optimal Assignment Problem.There are I persons available for J jobs.The value of person i working1day at job j is a ij,for i=1,...,I,and j=1,...,J.The problem is to choose an assignment of persons to jobs to maximize the total value.An assignment is a choice of numbers,x ij,for i=1,...,I,and j=1,...,J,where x ij represents the proportion of person i’s time that is to be spent on job j.Thus,Jj=1x ij≤1for i=1,...,I(11)Ii=1x ij≤1for j=1,...,J(12)andx ij≥0for i=1,...,I and j=1,...,J.(13) Equation(11)reflects the fact that a person cannot spend more than100%of his time working,(12)means that only one person is allowed on a job at a time,and(13)says that no one can work a negative amount of time on any job.Subject to(11),(12)and(13),we wish to maximize the total value,I i=1Jj=1a ij x ij.(14)This is a standard maximum problem with m =I +J and n =IJ .Terminology.The function to be maximized or minimized is called the objective function .A vector,x for the standard maximum problem or y for the standard minimum problem,is said to be feasible if it satisfies the corresponding constraints.The set of feasible vectors is called the constraint set .A linear programming problem is said to be feasible if the constraint set is not empty;otherwise it is said to be infeasible .A feasible maximum (resp.minimum)problem is said to be unbounded if the ob-jective function can assume arbitrarily large positive (resp.negative)values at feasible vectors;otherwise,it is said to be bounded .Thus there are three possibilities for a linear programming problem.It may be bounded feasible,it may be unbounded feasible,and it may be infeasible.The value of a bounded feasible maximum (resp,minimum)problem is the maximum (resp.minimum)value of the objective function as the variables range over the constraint set.A feasible vector at which the objective function achieves the value is called optimal .All Linear Programming Problems Can be Converted to Standard Form.A linear programming problem was defined as maximizing or minimizing a linear function subject to linear constraints.All such problems can be converted into the form of a standard maximum problem by the following techniques.A minimum problem can be changed to a maximum problem by multiplying the objective function by −1.Similarly,constraints of the form n j =1a ij x j ≥b i can be changed into the form n j =1(−a ij )x j ≤−b i .Two other problems arise.(1)Some constraints may be equalities.An equality constraint n j =1a ij x j =b i maybe removed,by solving this constraint for some x j for which a ij =0and substituting this solution into the other constraints and into the objective function wherever x j appears.This removes one constraint and one variable from the problem.(2)Some variable may not be restricted to be nonnegative.An unrestricted variable,x j ,may be replaced by the difference of two nonnegative variables,x j =u j −v j ,where u j ≥0and v j ≥0.This adds one variable and two nonnegativity constraints to the problem.Any theory derived for problems in standard form is therefore applicable to general problems.However,from a computational point of view,the enlargement of the number of variables and constraints in (2)is undesirable and,as will be seen later,can be avoided.Exercises.1.Consider the linear programming problem:Find y1and y2to minimize y1+y2 subject to the constraints,y1+2y2≥32y1+y2≥5y2≥0.Graph the constraint set and solve.2.Find x1and x2to maximize ax1+x2subject to the constraints in the numerical example of Figure1.Find the value as a function of a.3.Write out the matrix A for the transportation problem in standard form.4.Put the following linear programming problem into standard form.Find x1,x2, x3,x4to maximize x1+2x2+3x3+4x4+5subject to the constraints,4x1+3x2+2x3+x4≤10x1−x3+2x4=2x1+x2+x3+x4≥1,andx1≥0,x3≥0,x4≥0.2.Duality.To every linear program there is a dual linear program with which it is intimately connected.We first state this duality for the standard programs.As in Section 1,c and x are n -vectors,b and y are m -vectors,and A is an m ×n matrix.We assume m ≥1and n ≥1.Definition.The dual of the standard maximum problemmaximize c T xsubject to the constraints Ax ≤b and x ≥0(1)is defined to be the standard minimum problemminimize y T bsubject to the constraints y T A ≥c T and y ≥0(2)Let us reconsider the numerical example of the previous section:Find x 1and x 2to maximize x 1+x 2subject to the constraints x 1≥0,x 2≥0,andx 1+2x 2≤44x 1+2x 2≤12−x 1+x 2≤ 1.(3)The dual of this standard maximum problem is therefore the standard minimum problem:Find y 1,y 2,and y 3to minimize 4y 1+12y 2+y 3subject to the constraints y 1≥0,y 2≥0,y 3≥0,and y 1+4y 2−y 3≥12y 1+2y 2+y 3≥1.(4)If the standard minimum problem (2)is transformed into a standard maximum prob-lem (by multiplying A ,b ,and c by −1),its dual by the definition above is a standard minimum problem which,when transformed to a standard maximum problem (again by changing the signs of all coefficients)becomes exactly (1).Therefore,the dual of the stan-dard minimum problem (2)is the standard maximum problem (1).The problems (1)and(2)are said to be duals.The general standard maximum problem and the dual standard minimum problem may be simultaneously exhibited in the display:x 1x 2···x n y 1a 11a 12···a 1n ≤b 1y 2a 21a 22···a 2n ≤b 2...............y m a m 1a m 2···a mn ≤b m ≥c 1≥c 2···≥c n (5)Our numerical example in this notation becomesx1x2y112≤4(6)y242≤12y3−11≤1≥1≥1The relation between a standard problem and its dual is seen in the following theorem and its corollaries.Theorem1.If x is feasible for the standard maximum problem(1)and if y is feasible for its dual(2),thenc T x≤y T b.(7)Proof.c T x≤y T Ax≤y T b.Thefirst inequality follows from x≥0and c T≤y T A.The second inequality follows from y≥0and Ax≤b.Corollary1.If a standard problem and its dual are both feasible,then both are bounded feasible.Proof.If y is feasible for the minimum problem,then(7)shows that y T b is an upper bound for the values of c T x for x feasible for the maximum problem.Similarly for the converse.Corollary2.If there exists feasible x∗and y∗for a standard maximum problem(1)and its dual(2)such that c T x∗=y∗T b,then both are optimal for their respective problems.Proof.If x is any feasible vector for(1),then c T x≤y∗T b=c T x∗.which shows that x∗is optimal.A symmetric argument works for y∗.The following fundamental theorem completes the relationship between a standard problem and its dual.It states that the hypothesis of Corollary2are always satisfied if one of the problems is bounded feasible.The proof of this theorem is not as easy as the previous theorem and its corollaries.We postpone the proof until later when we give a constructive proof via the simplex method.(The simplex method is an algorithmic method for solving linear programming problems.)We shall also see later that this theorem contains the Minimax Theorem forfinite games of Game Theory.The Duality Theorem.If a standard linear programming problem is bounded feasible, then so is its dual,their values are equal,and there exists optimal vectors for both problems.There are three possibilities for a linear program.It may be feasible bounded (f.b.),feasible unbounded (f.u.),or infeasible (i).For a program and its dual,there are therefore nine possibilities.Corollary 1states that three of these cannot occur:If a problem and its dual are both feasible,then both must be bounded feasible.The first conclusion of the Duality Theorem states that two other possiblities cannot occur.If a program is feasible bounded,its dual cannot be infeasible.The x’s in the accompanying diagram show the impossibilities.The remaining four possibilities can occur.Standard Maximum Problemf.b. f.u.i.f.b.x xDual f.u.x xi.x(8)As an example of the use of Corollary 2,consider the following maximum problem.Find x 1,x 2,x 2,x 4to maximize 2x 1+4x 2+x 3+x 4,subject to the constraints x j ≥0for all j ,andx 1+3x 2+x 4≤42x 1+x 2≤3x 2+4x 3+x 4≤3.(9)The dual problem is found to be:find y 1,y 2,y 3to minimize 4y 1+3y 2+3y 3subject to the constraints y i ≥0for all i ,andy 1+2y 2≥23y 1+y 2+y 3≥44y 3≥1y 1+y 3≥1.(10)The vector (x 1,x 2,x 3,x 4)=(1,1,1/2,0)satisfies the constraints of the maximum prob-lem and the value of the objective function there is 13/2.The vector (y 1,y 2,y 3)=(11/10,9/20,1/4)satisfies the constraints of the minimum problem and has value there of 13/2also.Hence,both vectors are optimal for their respective problems.As a corollary of the Duality Theorem we haveThe Equilibrium Theorem.Let x ∗and y ∗be feasible vectors for a standard maximum problem (1)and its dual (2)respectively.Then x ∗and y ∗are optimal if,and only if,y ∗i =0for all i for which n j =1a ij x ∗j <b i (11)andx ∗j =0for all j for whichmi =1y ∗i a ij>c j(12)Proof.If:Equation (11)implies that y ∗i=0unless there is equality inja ij x ∗j ≤b i .Hencem i =1y ∗i b i =m i =1y ∗i n j =1a ij x ∗j =mi =1n j =1y ∗i a ij x ∗j .(13)Similarly Equation (12)impliesm i =1n j =1y ∗i a ij x ∗j =n j =1c j x ∗j .(14)Corollary 2now implies that x ∗and y ∗are optimal.Only if:As in the first line of the proof of Theorem 1,n j =1c j x ∗j ≤m i =1n j =1y ∗i a ij x ∗j ≤m i =1y ∗i b i .(15)By the Duality Theorem,if x ∗and y ∗are optimal,the left side is equal to the right sideso we get equality throughout.The equality of the first and second terms may be written as n j =1c j −mi =1y ∗i a ij x ∗j =0.(16)Since x ∗and y ∗are feasible,each term in this sum is nonnegative.The sum can be zero only if each term is zero.Hence ifm i =1y ∗i a ij >c j ,then x ∗j =0.A symmetric argument shows that if nj =1a ij x ∗j <b i ,then y ∗i =0.Equations (11)and (12)are sometimes called the complementary slackness con-ditions .They require that a strict inequality (a slackness)in a constraint in a standard problem implies that the complementary constraint in the dual be satisfied with equality.As an example of the use of the Equilibrium Theorem,let us solve the dual to the introductory numerical example.Find y 1,y 2,y 3to minimize 4y 1+12y 2+y 3subject to y 1≥0,y 2≥0,y 3≥0,andy 1+4y 2−y 3≥12y 1+2y 2+y 3≥1.(17)We have already solved the dual problem and found that x ∗1>0and x ∗2>0.Hence,from (12)we know that the optimal y ∗gives equality in both inequalities in (17)(2equations in 3unknowns).If we check the optimal x ∗in the first three main constraints of the maximum problem,we find equality in the first two constraints,but a strict inequality inthe third.From condition (11),we conclude that y ∗3=0.Solving the two equations,y 1+4y 2=12y 1+2y 2=1we find (y ∗1,y ∗2)=(1/3,1/6).Since this vector is feasible,the “if”part of the Equilibrium Theorem implies it is optimal.As a check we may find the value,4(1/3)+12(1/6)=10/3,and see it is the same as for the maximum problem.In summary,if you conjecture a solution to one problem,you may solve for a solution to the dual using the complementary slackness conditions,and then see if your conjecture is correct.Interpretation of the dual.In addition to the help it provides in finding a solution,the dual problem offers advantages in the interpretation of the original,primal problem.In practical cases,the dual problem may be analyzed in terms of the primal problem.As an example,consider the diet problem,a standard minimum problem of the form (2).Its dual is the standard maximum problem (1).First,let us find an interpretation of the dual variables,x 1,x 2,...,x n .In the dual constraint,n j =1a ij x j ≤b i ,(18)the variable b i is measured as price per unit of food,F i ,and a ij is measured as unitsof nutrient N j per unit of food F i .To make the two sides of the constraint comparable,x j must be measured in of price per unit of food F i .(This is known as a dimensional analysis .)Since c j is the amount of N j required per day,the objective function, n1c j x j ,represents the total price of the nutrients required each day.Someone is evidently trying to choose vector x of prices for the nutrients to maximize the total worth of the required nutrients per day,subject to the constraints that x ≥0,and that the total value of the nutrients in food F i ,namely, n j =1a ij x j ,is not greater than the actual cost,b i ,of that food.We may imagine that an entrepreneur is offering to sell us the nutrients without the food,say in the form of vitamin or mineral pills.He offers to sell us the nutrient N j at a price x j per unit of N j .If he wants to do business with us,he would choose the x j so that price he charges for a nutrient mixture substitute of food F i would be no greater thanthe original cost to us of food F i .This is the constraint,(18).If this is true for all i ,we may do business with him.So he will choose x to maximize his total income, n1c j x j ,subject to these constraints.(Actually we will not save money dealing with him since the duality theorem says that our minimum, m 1y i b i ,is equal to his maximum, n 1c j x j .)The optimal price,x j ,is referred to as the shadow price of nutrient N j .Although no such entrepreneur exists,the shadow prices reflect the actual values of the nutrients as shaped by the market prices of the foods,and our requirements of the nutrients.Exercises.1.Find the dual to the following standard minimum problem.Find y 1,y 2and y 3to minimize y 1+2y 2+y 3,subject to the constraints,y i ≥0for all i ,andy 1−2y 2+y 3≥2−y 1+y 2+y 3≥42y 1+y 3≥6y 1+y 2+y 3≥2.2.Consider the problem of Exercise 1.Show that (y 1,y 2,y 3)=(2/3,0,14/3)is optimal for this problem,and that (x 1,x 2,x 3,x 4)=(0,1/3,2/3,0)is optimal for the dual.3.Consider the problem:Maximize3x1+2x2+x3subject to x1≥0,x2≥0,x3≥0, andx1−x2+x3≤42x1+x2+3x3≤6−x1+2x3≤3x1+x2+x3≤8.(a)State the dual minimum problem.(b)Suppose you suspect that the vector(x1,x2,x3)=(0,6,0)is optimal for the maximum e the Equilibrium Theorem to solve the dual problem,and then show that your suspicion is correct.4.(a)State the dual to the transportation problem.(b)Give an interpretation to the dual of the transportation problem.3.The Pivot Operation.Consider the following system of equations.3y 1+2y 2=s 1y 1−3y 2+3y 3=s 25y 1+y 2+y 3=s 3(1)This expresses dependent variables,s 1,s 2and s 3in terms of the independent variables,y 1,y 2and y 3.Suppose we wish to obtain y 2,s 2and s 3in terms of y 1,s 1and y 3.We solve the first equation for y 2,y 2=12s 1−32y 1,and substitute this value of y 2into the other equations.y 1−3(12s 1−32y 1)+3y 3=s 25y 1+(12s 1−32y 1)+y 3=s 3.These three equations simplified become−32y 1+12s 1=y 2112y 1−32s 1+3y 3=s 272y 1+12s 1+y 3=s 3.(2)This example is typical of the following class of problems.We are given a system of n linear functions in m unknowns,written in matrix form asy T A =s T(3)where y T =(y 1,...,y m ),s T =(s 1,...,s n ),andA =⎛⎜⎜⎝a 11a 12...a 1n a 21a 22...a 2n ............a m 1a m 2...a mn⎞⎟⎟⎠.Equation (3)therefore represents the systemy 1a 11+···+y i a i 1+···+y m a m 1=s 1.........y 1a 1j +···+y i a ij +···+y m a mj =s j .........y 1a 1n +···+y i a in +···+y m a mn =s n .(4)In this form,s 1,...,s n are the dependent variables,and y 1,...,y m are the independent variables.Suppose that we want to interchange one of the dependent variables for one of the independent variables.For example,we might like to have s 1,...,s j −1,y i ,s j +1,...,s n in terms of y 1,...,y i −1,s j ,y i +1,...,y m ,with y i and s j interchanged.This may be done if and only if a ij =0.If a ij =0,we may take the j th equation and solve for y i ,to findy i =1a ij(−y 1a 1j −···−y i −1a (i −1)j +s j −y i +1a (i +1)j −···−y m a mj ).(5)Then we may substitute this expression for y i into the other equations.For example,the k th equation becomesy 1 a 1k −a ik a 1j a ij +···+s j a ika ij +···+y m a mk −a ik a mj a ij=s k .(6)We arrive at a system of equations of the formy 1ˆa 11+···+s j ˆa i 1+···+y m ˆa m 1=s 1.........y 1ˆa 1j +···+s j ˆa ij +···+y m ˆa mj =y i .........y 1ˆa 1n +···+s j ˆa in +···+y m ˆa mn =s n .(7)The relation between the ˆa ij ’s and the a ij ’s may be found from (5)and (6).ˆa ij =1a ij ˆa hj =−a hj a ij for h =iˆa ik =a ik a ijfor k =j ˆa hk=a hk −a ik a hja ijfor k =j and h =i .Let us mechanize this procedure.We write the original m ×n matrix A in a display with y 1to y m down the left side and s 1to s n across the top.This display is taken to represent the original system of equations,(3).To indicate that we are going to interchange y i and s j ,we circle the entry a ij ,and call this entry the pivot .We draw an arrow to thenew display with y i and s j interchanged,and the new entries of ˆaij ’s.The new display,of course,represents the equations (7),which are equivalent to the equations (4).s 1···s j ···s n y 1a 11···a 1j ···a 1n............y i a i 1··· a ij ···a in ............y ma m 1···a mj···a mn−→s 1···y i···s ny 1ˆa 11···ˆa 1j ···ˆa 1n............s j ˆa i 1···ˆa ij ···ˆa in ............y mˆa m 1···ˆa mj ···ˆa mnIn the introductory example,this becomess1s2s3y1315 y2 2−31 y3031−→y2s2s3y1−3/211/27/2s11/2−3/21/2y3031(Note that the matrix A appearing on the left is the transpose of the numbers as they appear in equations(1).)We say that we have pivoted around the circled entry from the first matrix to the second.The pivoting rules may be summarized in symbolic notation:p r c q −→1/p r/p−c/p q−(rc/p)This signifies:The pivot quantity goes into its reciprocal.Entries in the same row as the pivot are divided by the pivot.Entries in the same column as the pivot are divided by the pivot and changed in sign.The remaining entries are reduced in value by the product of the corresponding entries in the same row and column as themselves and the pivot,divided by the pivot.We pivot the introductory example twice more.y2s2s3y1−3/211/27/2 s11/2−3/21/2 y303 1−→y2s2y3y1−3/2 −5−7/2s11/2−3−1/2s3031−→y2y1y3s2.3−.2.7s11.4−.61.6s3−.9.6−1.1The last display expresses y1,y2and y3in terms of s1,s2and s3.Rearranging rows and columns,we canfind A−1.y1y2y3s1−.61.41.6 s2−.2.3.7 s3.6−.9−1.1so A−1=⎛⎝−.61.41.6−.2.3.7.6−.9−1.1⎞⎠The arithmetic may be checked by checking AA−1=I.Exercise.Solve the system of equations y T A=s T,s1s2s3s4y1 1102y202−11y3−1103y41−221。
线性规划
第二章线性规划线性规划(linear programming,简称LP)是运筹学的一个重要分支,研究得比较早,尤其自1947年丹捷格(G.B.Dantzig)提出了单纯形法之后,线性规划在理论上趋向成熟.线性规划研究的对象大体可分为两大类:一类是在现有的人、财、物等资源的条件下,研究如何合理地计划、安排,可使得某一目标达到最大,如产量、利润目标等;另一类是在任务确定后,如何计划、安排,使用最低限度的人、财等资源,去实现该任务,如使生产成本、费用最小等.这两类问题从本质上说是相同的,即都在一组约束条件下,去实现某一个目标的最优(最大或最小).线性规划研究的问题要求目标与约束条件函数均是线性的,而目标函数只能是一个.在经济管理问题中,大量的问题是线性的,有的可以转化为线性的,从而使线性规划有极大的应用价值.据美国《财富》杂志对全美500家大公司的调查,线性规划的应用名列前茅,有85%左右的公司频繁地使用线性规划.第一节线性规划问题及其数学模型一、线性规划问题的数学模型在生产实践和日常生活中,经常会遇到如何合理地使用有限资源(如资金、劳力、材料、机器、仪器设备、时间等),以获得最大效益的问题.例2-1 某制药厂在计划期内要安排生产Ⅰ、Ⅱ两种药品,这些药品分别需要在D、、四种不同的设备上加工.按工艺规定,每千克药品Ⅰ和Ⅱ在各BCA、台设备上所需要的加工台时数如表2-1.已知各设备在计划期内有效台时数(1台设备工作1小时称为1台时)分别是12、8、16和12.该制药厂每生产1千克药品Ⅰ可得利润200元,每生产1千克药品Ⅱ可得利润300元.问应如何安排生产计划,才能使制药厂利润最大?A、两种药品每千克在各台设备上所需的加工台时数表2-1 B药品A B C DⅠ 2 1 4 0Ⅱ 2 2 0 4这是一个资源有限,但需利润最大的线性规划问题.解 设1x ,2x 分别表示在计划期内药品Ⅰ和Ⅱ的产量(千克),Z 表示这个期间的制药厂利润.则计划期内生产Ⅰ、Ⅱ两种药品的利润总额为21300200x x Z +=(元).但是生产Ⅰ、Ⅱ两种药品在A 设备上的加工台时数必须满足122221≤+x x ;在B 设备上的加工台时数必须满足8221≤+x x ;在C 设备上的加工台时数必须满足1641≤x ;在D 设备上的加工台时数必须满足1242≤x ;生产Ⅰ、Ⅱ两种药品的数量应是非负的数,即0,21≥x x .于是上述的问题归结为:目标函数 21300200Max x x Z += 122221≤+x x8221≤+x x约束条件 1641≤ x1242≤x0,21≥x x同样,在经济生活和生产活动中也遇到另一类问题,即为了达到一定的目标,应如何组织生产,或合理安排工艺流程,或调整产品的成分等,以使消耗(人力、设备台时、资金、原材料等)为最少.例2-2 用3种原料321B B B 、、配制某种食品,要求该食品中蛋白质、脂肪、糖、维生素的含量不低于15、20、25、30单位.以上3种原料的单价及每单位原料所含各种成分的数量,如下表2-2所示.问应如何配制该食品,使所需成本最低?表2-2 3种原料所含成分营养成分 原料 食品中营养成分的最低需要量(单位) 1B 2B3B蛋白质(单位/千克)5 6 8 15 脂肪(单位/千克)3 4 6 20 糖(单位/千克)8 5 4 25 维生素(单位/千克)10 12 8 30 原料单价(元/千克)20 25 30这个问题是在食品的营养要求得到满足的前提下,如何通过适当的原料配比,使食品的成本最低.解 设321x x x 、、分别表示原料321B B B 、、的用量(千克),Z 表示食品的成本(元),则这一食品配制问题变为:目标函数 321302520Min x x x Z ++= 15865321≥++x x x20643321≥++x x x约束条件 25458321≥++x x x3081210321≥++x x x0,,321≥x x x例2-3 某医院每天至少需要下列数量的护士(见表2-3).表2-3 某医院每天至少需要的护士数班次 时间 护士数1 上午6时-上午10时 602 上午10时-下午2时 703 下午2时-下午6时 604 下午6时-晚10时 505 晚10时-凌晨2时 206 凌晨2时-上午6时 30每班的护士在值班开始时向病房报到,连续工作8小时.试问:为满足每班所需要的护士数,医院最少应雇用多少护士?请列出线性规划问题的数学模型.解 设1x 表示第1班次向病房报到的护士数;2x 表示第2班次向病房报到的护士数;3x 表示第3班次向病房报到的护士数;4x 表示第4班次向病房报到的护士数;5x 表示第5班次向病房报到的护士数;6x 表示第6班次向病房报到的护士数.则有目标函数 ∑==61Min Z j j x 6016≥+x x7021≥+x x6032≥+x x约束条件 5043≥+x x2054≥+x x3065≥+x x0≥j x 且为整数 6,,2,1Λ=j例2-4 某一卫生所配有1名医生和1名护士.医生每天工作8小时,护士每天工作9小时.服务的项目是接生和做小手术.一次接生,医生要花0.5小时,护士同样要花0.5小时;一次小手术,医生要花1小时,护士要花1.5小时.这是一所小规模的卫生所,每天容纳的手术数和接生数合计不能超过12次.假定一次手术的收入为200元,一次接生的收入为80元.问怎样合理安排接生和手术的数量,使医生和护士一天工作能收入最多?解 设每天手术数为1x ,每天接生数为2x ,则目标函数 2180200Max x x Z +=82121≤+x x 9212321≤+x x 12 21≤+x x0,21≥x x 且为整数二、线性规划问题的结构特征从上面4个例子可见,线性规划的数学模型(model of LP )有如下特征:1.都有一组未知变量(n x x x ,,,21Λ)代表某一方案,它们取不同的非负值,代表不同的具体方案;2.都有一个目标要求,实现极大或极小.目标函数要用未知变量的线性函数表示;3.未知变量受到一组约束条件的限制,这些约束条件用一组线性等式或不等式表示.正是由于目标函数和约束条件都是未知变量的线性函数,所以我们把这类问题称为线性规划问题.线性规划问题的一般形式:目标函数 n n x c x c x c Z +++=Λ2211 (Min)Max11212111),(b x a x a x a n n ≥=≤+++Λ22222121),(b x a x a x a n n ≥=≤+++Λ约束条件 …………………………m n mn m m b x a x a x a ),(2211≥=≤+++Λ0,,,21≥n x x x Λ这里,n n x c x c x c +++Λ2211称为目标函数,记为Z ,其中,j c (n j ,,2,1Λ=)称为成本或利润系数;ij a (m i ,,2,1Λ=;n j ,,2,1Λ=)称为约束条件中未知变量的系数;i b (m i ,,2,1Λ=)称为限定系数.约束条件三、线性规划问题的标准形式建立线性规划的标准形式有助于我们研究它的求解方法,至于其他各种形式的线性规划问题,我们可以先将非标准形式变成标准形式,然后再用标准形式的求解方法求解.(一)线性规划问题的标准形式线性规划的标准形式(standard form of LP )为:目标函数 n n x c x c x c Z +++=Λ2211Max 11212111b x a x a x a n n =+++Λ22222121b x a x a x a n n =+++Λ…………………………m n mn m m b x a x a x a =+++Λ22110,,21≥n x x x Λ0≥i b (m i ,,2,1Λ=)式中,jc (n j ,,2,1Λ=)称为成本或利润系数;ij a (m i ,,2,1Λ=;n j ,,2,1Λ=)称为未知变量的系数;i b (m i ,,2,1Λ=)称为限定系数.标准形式的主要特点是:①目标函数最大化;②所有的约束条件由等式表示;③所有的变量和每一约束条件右端的常数项均为非负值.(二)书写形式为书写简便,我们可以将上述线性规划问题的标准形式写成如下两种形式,其中..t s 代表约束条件.1.简缩形式∑==nj j j x c Z 1Max∑==nj i j ij b x a 1 m i ,,2,1Λ=..t s 0≥j x n j ,,2,1Λ=约束条件0≥i b m i ,,2,1Λ=2.矩阵形式CX Z =Max b AX = ..t s 0≥X0≥b其中, ),,,(21n c c c C Λ=mn m m n n a a a a a a a a a A ΛΛΛΛΛΛΛ212222111211= n x x x X Λ21= m b b b b Λ21 = 000 0Λ= 这里C 为成本或利润向量,X 为决策向量,A 为系数矩阵(或称约束矩阵),b 为限定向量(或称右端向量),条件0≥X 称为非负约束. (三)标准形式的转化当给出的线性规划为非标准形式时,可以按照下述的方法化为标准形式.1.目标函数的转换 若给出的线性规划要求目标函数极小化,即 ∑==nj j j x c Z 1Min ,因)(Max Min Z Z --=,所以只须令Z Z '=-,即有j nj j x c Z Z ∑=-=-='1)(Max )(Max Max这就是标准形式的目标函数了.2.约束条件的转换 由于标准形式要求所有的约束条件是等式,必须把不等式的约束条件化为等式.须引入新的变量,代表每个不等式左右端之间的差额.这些新的变量称为松弛变量或剩余变量.这里有2种情况:一种是约束条件为“≤”形式的不等式,则可在“≤”的左端加入非负的松弛变量,把原“≤”形式的不等式变为等式;另一种是约束条件为“≥”形式的不等式,则可在“≥”号的左端减去一个非负的剩余变量(也可称松弛变量),把不等式改为等式.例如前面例2-1中线性规划问题的标准形式可写为:目标函数 21300200Max x x Z += 12 22321=x x x ++8 2421=x x x ++..t s 16 451=x x + 12 4 62=x x +0,,,621≥x x x Λ式中6543x x x x 、、、为松弛变量.例2-2中线性规划的标准形式可写成:321302520Max x x x Z ---='15 86 5 4321=-++x x x x20 64 3 5321=-++x x x x..t s 25 45 8 6321=-++x x x x30 812107321=-++x x x x0,,,721≥x x x Λ式中Z Z '-=,74~x x 为剩余变量(也可称松弛变量).要注意的是松弛变量或剩余变量都是非负值,它们的实际意义是未被利用的资源或额外的提供量.由于松弛变量或剩余变量都不会影响目标函数的增加或减少,所以在目标函数中它们的系数都应当为零.3.变量的非负转换 若存在无非负要求的变量,即变量k x 取正值或负值都可以,在物理、经济意义上都是合理的,这时为了满足标准形式对变量的非负要求,可令k x =k x '-k x '',其中,0≥'k x ,0≥''k x .由于k x '可能大于k x '',k x '也可能小于k x '',故k x 可为正值也可为负值.以上讨论说明,任何形式的线性规划问题都可化成标准形式.第二节 线性规划问题的图解法讨论两变量的线性规划问题的图解法(graphical solution of LP problems ),是为了更直观地了解线性规划问题及其解的基本概念,从而了解求解线性规划问题的一般方法——单纯形法的基本原理.一、线性规划问题解的基本概念设线性规划问题的标准形式为:⎪⎪⎩⎪⎪⎨⎧=≥=≥===∑∑==mi b n j x m i b x a t s x c Z ij nj i j j i nj jj ,,2,10,,2,10,,2,1..11ΛΛΛMax 1.可行解 满足约束条件的解T n x x x X ),,,(21Λ=,称为线性规划问题的可行解.所有可行解的集合称为可行域.2.最优解 满足目标函数式的可行解,称为线性规划问题的最优解.3.最优值 对应于最优解的目标函数之值,称为最优值.二、两个变量的线性规划问题的图解法例2-5 以上一节例2-1为例:⎪⎪⎪⎩⎪⎪⎪⎨⎧≥≤≤≤+≤++=0,124164821222..3002002121212121x x x x x x x x t s x x Z Max由于此问题是两变量的线性规划问题,因而可用图解法求解.求解过程是先求出满足约束条件的可行解区域;然后从可行解区域中找出最优解.具体步骤如下:第1步 建立平面直角坐标系,取1x 为横轴,2x 为纵轴.第2步 求满足约束条件的可行解区域.本例中作直线①:122221=+x x ,第一个约束不等式的解由直线122221=+x x 及其左下方半平面表示;作直线②:8221=+x x ,第二个约束不等式的解由直线8221=+x x 及其左下方半平面表示;作直线③:1641=x ,第三个约束不等式的解由直线1641=x 及其左方半平面表示;作直线④:1242=x ,第四个约束不等式的解由直线1242=x 及其下方半平面表示;1x 和2x 变量非负条件的区域为第1象限.满足所有约束条件的可行解区域(也称可行域)是由上述5个区域的公共部分表示,即图2-1中OABCD 的区域(包括边界).在这个区域里的每一点(包括边界上的点)都是可行解.从图上我们可以看到这个可行域是一个凸多边形,我们把它称为凸集(如果在形体中任意取两点连接一根直线,若线段上所有的点都在这个形体中,则称该形体为凸集).第3步 作目标函数的等值线簇,确定目标函数值增加方向.本例中,由目标函数21300200 x x Z +=可知,当Z 值取不同的数值时,在图上可得到一簇以Z 为参数的平行线.位于同一直线上的点,具有相同的目标函数值,因而称每条直线为“等值线”.对于直线21300200 x x Z +=来说,当Z 值由小变大时,直线3003212Z x x +-=向右上方平行移动.作直线600300200 21=+x x (Z =600),在这条直线上的所有点其Z 值均为600.第4步 从可行解区域内找满足目标函数的最优解.从图2-1中可以看到,当等值线600300200 21=+x x 向右上方平移到距原点最远且仍与可行域有一交点时,那个交点便是使Z 值取值最大的可行解,即最优解.在本例中C 点是最优解,此时1x =4,2x =2,Z =1400. 简单表示为:X *=()T24,Z *=1400.例2-6 用图解法解线性规划: 212Max x x Z +=10221≤+x x 1 21≥+x x..t s 0 1≥x 0 2≥x 4 2≤x解 按照例2-5的步骤作出图2-2,求出凸五边形ABCDE 所围成的可行区域,并作目标函数的等值线)2(2221==+Z x x ,随着Z 值的逐渐增大,等值线不断向右上方平行移动,最后与可行域的边AB 重叠.所以线段AB 上的每一点所对应的(21 ,x x )都为最优解,即该线性规划问题有无穷多个最优解,不过最优值是唯一的,10*=Z .例2-7 解下列线性规划:⎩⎨⎧≥≤-+=0,80810..123212121x x x x t s x x Z Max 解 从图2-3可看出,规划的可行域是无界的,并且无最优解(最优解无限大).这个例子中出现的情况在实际问题中并不存在,因为资源是有限的,所以不可能取得无限大的收益.出现这种情况往往是由于建立数学模型时考虑不周,忽略了某些约束条件而造成.三、线性规划问题解的特点由上面的图解法可以直观地看出线性规划问题的解具有如下几个特点:1.可行域总是凸多边形;2.如果一个线性规划问题确实存在唯一的最优解,那么它必定可在其可行域的一个顶点上达到;3.如果一个线性规划问题存在多重最优解,那么至少在其可行域有两个相邻的顶点所对应的目标函数值相等,且达到最大值(或最小值);4.如果可行域中一个顶点的目标函数值比其相邻顶点的目标函数值要好的话,那么它就比其他所有顶点的目标函数值都要好,或者说它就是一个最优解.有时在求解线性规划时,会发现线性规划的约束条件矛盾,无法找到可行域,这时线性规划无解;有时也会遇到可行域无界且无最优解,这时称为无界解.第三节单纯形法在实际问题中,我们常常遇到的线性规划问题不是仅涉及两个变量,而是两个以上的多变量线性规划问题.对两个以上的多变量线性规划问题无法用图解法求解,必须使用简便有效的求解方法——单纯形法(simplex method).一、单纯形法的基本原理(一)典型方程组一般线性规划问题标准形式的约束条件如下式(2-1),是一个有n个未知数、m个方程的线性方程组.如果这m个方程是独立的(即其中任一方程均不能由其它方程代替),则通过初等变换,必能使式(2-1)化成式(2-2)形式的同解方程组:∑==njijijbxa1mi,,2,1Λ=(2-1)1x ' +11221111b x a x a x a n n m m m m '=''+⋅⋅⋅+''+''++++ 2x ' +22222112b x a x a x a n n m m m m '=''+⋅⋅⋅+''+''++++ (2-2)…………………………………………………………mx '+m n mn m mm m mm b x a x a x a '=''+⋅⋅⋅+''+''++++2211 式中n x x x '⋅⋅⋅'',,,21是重新排序后的变量.式(2-2)被称为典型方程组.即如果在一个线性方程组中的每一个方程中都有系数为1,并且不再出现在其它方程的一个未知量,则此方程组称为典型方程组.(二)基本变量如果变量j x 在某一方程中系数为1,而在其它一切方程中的系数为零,则称j x 为该方程中的基本变量.否则为非基本变量.如式(2-2)中的m x x x '⋅⋅⋅'',,,21为基本变量,n m mx x x '⋅⋅⋅''++,,,21为非基本变量.基本变量的个数为线性无关的方程的个数.事实上,n 个变量中任意m 个都可能作为基本变量,因此由排列组合知识可知,基本变量的组数为mn c 个,n 为未知变量的个数,m 为线性无关的方程的个数.(三)基本解在典型方程中,设非基本变量为零,求解基本变量得到的解,称为基本解.基本解的个数为m n c 个.(四)基本可行解基本变量为非负的一组基本解称为基本可行解,基本可行解的个数最多不超过m n c 个.例如,对方程组32 4321=+-+x x x x ① 13 2421=+x x x - ②施行初等变换[①×(-2)+②],可以得到:32 4321=+-+x x x x ① 572 432-=-+-x x x ③ [③×(-1)] : 32 4321=+-+x x x x ① 572432=+-x x x ④ [④×(-1)+①]: 25431-=-+x x x ⑤ 572432=+-x x x ④式⑤和④为典型方程组,基本变量是1x 和2x ,非基本变量为3x 和4x .设非基本变量3x 和4x 为零,则1x 和2x 分别等于-2和5,即对应于典型方程组⑤和④,基本解为:X =()T0052-.因基本变量中1x 为负值,所以此解不是基本可行解.根据方程组①和②有4个未知变量,因此通过初等变换可得到24c 组(即6组)典型方程组和基本解.若令2x 和4x 为基本变量,通过初等变换,方程组①和②可变换为: [①×(-1)+②]: 32 4321=+-+x x x x ① 25 431-=-+x x x ③ [③×(-1/5)]: 324321=+-+x x x x ① 4.0202.0431=+--x x . x ④ [④×(-2)+①] : 2.2604.1321=-+ x . x x ⑤ 4.0202.0431=--x x . x + ④此时,典型方程组的基本变量为2x 和4x ,非基本变量为1x 和3x .基本解为:T X )(0.4 0 2.2 0 =,因为基本变量为非负值,所以此基本解也为基本可行解.(五)单纯形法的原理理论上已经证明,线性规划的基本可行解与可行域的顶点是一对一的.这就决定了线性规划可行域的顶点个数最多也不超过m n c 个.上面讨论线性规划问题解的特点时已指出,如果线性规划有最优解,一定可以在可行域的某个顶点处达到.因此,单纯形法的基本思路是:根据问题的标准形式,从可行域中的一个基本可行解(一个顶点)开始,转换到另一个基本可行解(顶点),并且使目标函数的值逐步增大;当目标函数达到最大值时,问题就得到了最优解.在用单纯形法求解线性规划问题时,应考虑的问题:1.建立初始基本可行解 在用单纯形法求解时,首先应将线性规划问题以标准形式表达、约束条件以右端常数非负的典型方程组表示,确定初始基本可行解.在前面的阐述中,已讨论了如何将一般线性规划问题转化为标准形式的线性规划问题,如何将约束条件通过初等变换以典型方程组形式表示,以及如何得出基本可行解(最初得到的基本可行解也称初始基本可行解),此处不再赘述.经过变换,典型方程组和初始基本可行解可用式(2-3)表示:1x +11221111b x a x a x a n n m m m m '='+⋅⋅⋅+'+'++++ 2x +22222112b x a x a x a n n m m m m '='+⋅⋅⋅+'+'++++ (2-3)………………………………………………………m x +m n mn m mm m mmb x a x a x a '='+⋅⋅⋅+'+'++++2211 初始基本可行解:T mb b X )00(10ΛΛ''=. 2.最优性检验 得到一个基本可行解后,我们要判断它是不是最优解.一般情况下,经过迭代后式(2-3)变为∑+='-'=nm j jiji i xa b x 1(m i ,,2,1Λ=) (2-4)将式(2-4)代入目标函数式,整理后得∑∑∑+==='-+'=n m j mi j iji jmi i i x a c c b c Z 111)( (2-5)令∑='=mi i i b c Z 10 , ∑='=mi iji j a c Z 1, n m m j ,,2 ,1Λ++= 于是∑+=-+=nm j j j jx Z cZ Z 10)( (2-6)由于当m j ,,2 ,1Λ=时,j mi ij i j c a c Z ='=∑=1,即0=-j j Z c (m j ,,2 ,1Λ=),所以式(2-6)也可写作∑∑∑=+=+=-+-+=-+=mj j j j nm j nm j j j jj j jx Z c x Z cZ x Z cZ Z 11100)()()(∑=-+=nj j j j x Z c Z Z 10)( n j ,,2 ,1Λ=再令j j j Z c C -= n j ,,2 ,1Λ=j C 为变量j x 的检验数.则∑=+=nj j j x C Z Z 10 (2-7)(1)最优解判别 若)0(X =T m b b b )00(21⋅⋅⋅'⋅⋅⋅''为基本可行解,且对一切n j ,,2 ,1Λ=,有0≤j C ,则)0(X 为最优解.(2)无有限最优解判别 若)0(X =T m b b b )00(21⋅⋅⋅'⋅⋅⋅''为一基本可行解,有一个k C >0,且对一切m i ,,2,1Λ=有0≤ik β(ik β为约束条件方程中的系数,n k ,,2,1Λ=),那么该线性规划问题无有限最优解(或称有无界解或无最优解). 事实上,应用向量的乘法,可以将检验数的求法表示得简明一些.令j c 表示目标函数中变量j x 的系数,B C 表示基本变量在目标函数中的系数行向量,j P 表示变量j x 在典型方程中的系数列向量,则⎪⎪⎪⎪⎪⎭⎫⎝⎛⋅-=⋅-=-=mj j j B j j B j j j j a a a C c P C c Z c C Λ21 n j ,,2 ,1Λ= (2-8)基本变量的检验数总等于0.目标函数值b C Z B ⋅=.3.基本可行解的改进 若初始基本可行解)0(X 不是最优解及不能判别无最优解时,需找一个新的基本可行解.具体方法是:首先确定进基变量,再确定出基变量.进基变量的确定:由式(2-7)可知,检验数j C 对线性规划问题的实际意义是:j C 表示当变量j x 增加1个单位时,目标函数的增加量;其经济意义表示相对利润.当0>j C 时,说明非基本变量j x 增加1个单位,目标函数可以增加,即现在的函数值不是最优,还能增加.这时要将某个非基本变量换到基本变量中去(称为进基变量).为了使目标函数值增长最快,所以应选择j C 值最大的一项所对应的非基本变量进基,k C =>)0j C (max . 则对应的k x 为进基变量.进基变量所在的列(k )称为枢列.出基变量的确定:当进基变量确定后(假设i x 是进基变量),出基变量的选定是应用“最小比值规则”.即用此时的各约束方程右端的常数项i b (非负数)与相应方程中k x 的正系数ik β相比,并选取最小商值的基本变量l x 为出基变量(将由基本变量变为非基本变量).{}lkl ik ik i i bb βββθ=⎭⎬⎫⎩⎨⎧>=0min min出基变量所在的行(l )称为枢行.枢行与枢列交点处的元素(lk β)称为枢元.然后通过初等变换,将约束条件转为关于新的基本变量的典型方程组,并求得新的基本可行解.对于新的基本可行解可再进行上述的最优性检验.二、单纯形解法上面介绍的单纯形法原理看似复杂,但如用表格形式计算,则比较容易操作.单纯形法的计算步骤:第1步:找出初始基本可行解,建立初始单纯形表.第2步:检验对应于非基本变量的检验数j C ,若对所有的0≤j C(n j ,,2 ,1Λ=),则已得到最优解,计算最优值∑==mi i i b c Z 1,即可结束.否则,转入下一步.第3步:在所有0>j C 中,若有一个k C 对应k x 的系数列向量,即对m i ,,2,1Λ=均有0≤ik β,则此问题无有限最优解(或称有无界解或无最优解),停止计算.否则转入下一步.第4步:根据()0max >j C =k C ,确定k x 为进基变量,再依据“最小比值规则”({}lk l ik ik i i b b βββθ=⎭⎬⎫⎩⎨⎧>=0min min )确定l x 为出基变量. 第5步:实施以枢元素为中心的初等变换,使约束方程组变为关于新的基本变量的典型方程组,得到新的单纯形表,重复第二步…,一直到没有新的非基本变量可以改善目标函数为止.若线性规划模型为:CX Z =Min ..t s b AX = 0≥X上述单纯形法的计算步骤仍有效,只是其中的第二步改为:若对所有的0≥j C (n j ,,2,1Λ=),则已得到最优解;第三步改为在所有0<j C 中,若有一个k C 对应k x 的系数列向量,即对m i ,,2,1Λ=均有0≤ik β,则此问题无有限最优解(或称有无界解或无最优解);第四步改为)0min(<j C =k C ,确定k x 为进基变量.例2-8 现以例2-1来说明单纯形法的表上解法.⎪⎪⎪⎩⎪⎪⎪⎨⎧≥≤≤≤+≤++=0,124164821222..3002002121212121x x x x x x x x t s x x Z Max解 首先将线性规划问题标准化,即在约束条件中引入松弛变量3x 、4x 、5x 、6x ,则标准化后的线性规划模型为:21300200Max x x Z +=12 22321=x x x ++ 8 2421=x x x ++..t s 16 451=x x + 12 462=x x + 0,,,621≥x x x Λ此时约束方程组已为典型方程组,根据上述线性规划模型可以列出初始单纯形表(表2-4):表2-4 单纯形法求解例2-1(1)表2-4中:10040010004001021000122 为典型方程组中变量的系数,j x 为规划中出现的变量,j c 为变量j x 在目标函数中的系数,B X 为基本变量,B C 为基本变量在目标函数中的系数,b 为典型方程组右端常数项(非负值),θ为确定出基变量的商值,ikii b βθ=(0>ik β),j C 为变量j x 的检验数,j P C c C B j j ⋅-=,Z为此时目标函数值,b C Z B ⋅=. 根据初始单纯形表可以看出:初始基本可行解是01=x ,02=x ,123=x ,84=x ,165=x ,126=x此时目标函数值()⎪⎪⎪⎪⎪⎭⎫⎝⎛⋅=12168120000Z =0检验数111P C c C B ⋅-==200-()⎪⎪⎪⎪⎪⎭⎫ ⎝⎛⋅04120000=200222P C c C B ⋅-==300-()⎪⎪⎪⎪⎪⎭⎫ ⎝⎛⋅40220000=3003C =4C =5C =6C =0(基本变量的检验数总等于零)由于01>C ,02>C ,所以初始基本可行解非最优解.又由于12C C >,所以确定2x 为进基变量.进一步求最小θ值:{}{}33,4,6min 412,28,212min 0min min ==⎭⎬⎫⎩⎨⎧=⎭⎬⎫⎩⎨⎧>=ik ik i i b ββθ即从第4个方程中算出的商值最小,而第4个方程中的基本变量是6x ,于是6x 为出基变量.表中给第4个约束方程中2x 的系数4加上方括号以突出其为枢元.接下去的工作是将2x 取代6x ,表2-4中的约束方程化为以3x 、4x 、5x 和2x 为基本变量,1x 和6x 为非基本变量的典型方程,以便求出新的基本可行解.从表2-4中可以看到,只需对方程组实行初等变换,使枢元位置变成1,而枢列中的其它元素变为零(即以枢元为中心的初等变换)就可以了.此处可先将第4个方程除以4,使枢元位置变成1;然后用新得到的第4个方程乘以(-2)后分别加到第1个和第2个方程上,使枢列中的第1个和第二个方程所在位变为零.这样我们可以得到新的单纯形表(表2-5).表2-5给出的新的基本可行解是1x =0,2x =3,3x =6,4x =2,5x =16,6x =0此时目标函数值()⎪⎪⎪⎪⎪⎭⎫⎝⎛⋅=31626300000Z =900检验数111P C c C B ⋅-==200-()⎪⎪⎪⎪⎪⎭⎫ ⎝⎛⋅0412300000=200666P C c C B ⋅-==0-()⎪⎪⎪⎪⎪⎪⎪⎭⎫ ⎝⎛--⋅4102121300000=75-2C =3C =4C =5C =0(基本变量的检验数总等于零)表2-5 单纯形法求解例2-1(2)由于01>C ,所以此时基本可行解非最优解,确定1x 为进基变量. 进一步计算最小θ值:{}{}24,2,3min 416,12,26min 0min min ==⎭⎬⎫⎩⎨⎧=⎭⎬⎫⎩⎨⎧>=ik ik i i b ββθ即从第2个方程中算出的商值最小,而第2个方程中的基本变量是4x ,于是4x 为出基变量.接着进行第二次迭代,将1x 取代4x ,表2-5中的约束方程化为以3x 、1x 、5x 和2x 为基本变量,4x 和6x 为非基本变量的典型方程,以便求出新的单纯形表.重复单纯形法计算第2 步~第5步,一直到没有新的非基本变量可以改善目标函数为止(见表2-6和表2-7).表2-6 单纯形法求解例2-1(3)表2-7 单纯形法求解例2-1(4)表2-7中:目标函数值()⎪⎪⎪⎪⎪⎭⎫ ⎝⎛⋅=244030002000Z =1400检验数444P C c C B ⋅-==0-()⎪⎪⎪⎪⎪⎭⎫ ⎝⎛--⋅2120130002000=-150555P C c C B ⋅-==0-()⎪⎪⎪⎪⎪⎪⎪⎪⎪⎭⎫ ⎝⎛--⋅8121414130002000=225- 1C =2C =3C =6C =0(基本变量的检验数总等于零)由于0≤j C ,6,,2,1Λ=j ,所以此基本可行解41=x ,22=x ,03=x ,04=x ,05=x ,46=x ,即为最优解,最优值为Z *=1400.与前面图解法求解结果一致.为了加深对单纯形法基本思想的理解,不妨将表2-4、表2-5、表2-6、表2-7和图2-1进行对照,可以发现表2-4给出的基本可行解对应于图中可行域顶点0,表2-5给出的基本可行解对应于顶点A ,表2-6给出的基本可行解对应于顶点B ,表2-7给出的最优解对应于顶点C .线性规划问题有无穷多个可行解,应用单纯形法可以高效率地求解此类问题.例2-9 用单纯形法求解下列规划问题43213Min x x x x Z +++=4 22321=++-x x x..t s 6 3421=++x x x0,,,4321≥x x x x解 令Z Z -=',于是原线性规划问题变为标准形式:43213Max x x x x Z ----='4 22321=++-x x x..t s 6 3421=++x x x 0,,,4321≥x x x x由于约束方程组已是典型方程组,所以可直接用单纯形表求解,见表2-8.表2-8 单纯形法求解例2-9表2-8计算得最优解是1x =0,2x =2,3x =0,4x =4,最优值为Z *=-Z '*=6. 实际上,此线性规划问题也可根据单纯形法求解的基本思想,按照前面单纯形法计算步骤中提到的改变检验数判断方法,直接用单纯形表求解极小化问题,见表2-9.若对所有的0≥j C (n j ,,2,1Λ=),则已得到最优解;所有0<j C 中,若有一个k C 对应k x 的系数列向量,即对m i ,,2,1Λ=均有0≤ik β,则此问题无有。
线性规划模式LinearProgrammingModels
(production hours). 2X1 + 1X2 = 1000 (塑膠原料,Plastic)
Excel試算表
– 此最佳解使用了所有的塑膠原料(plastic)與生產時間
往利潤增加方向移動 increase the profit, if possible... 持續平行移動到無法增加為止 continue until it becomes infeasible
700 500
紅色線段
Profit =$1250
Optimal Profit =$4360
X1
19
500
最佳解 (p.69) Summary of the optimal solution
2X1+ X2 = 1000 3X1+4X2 = 2400 (320,360)
之解
端點:可行區 域的角點
2X1+ X2 = 1000 (450,100) X1-X2 = 350 之解
22
多重最佳解 Multiple optimal solutions
• 若多重最佳解存在,則目標函數必定平行其中一個 限制式 •多重最佳解之任何加權平均值 亦為一組最佳解
21
端點與最佳解 (p.72) Extreme points and optimal solutions
– 若一個線性規劃問題有一組最佳解,此最佳解一 定發生在”端點”上 (端點最佳解之候選人,True/False) – 兩個束縛方程式的交點形成一個”端點”或”角點”
3X1+4X2 = 2400 X1 = 0 之解 (0,600)
Linear Programming(线性规划)
线性规划的三要素
决策变量:根据影响所要达到目的的因素找到决策变量 ——生产产品量,运输分配量等 目标函数:由决策变量和所要达到目的之间的函数关系确定目 标函数; ——最大利润,最小运费等 约束条件:由决策变量所受的限制条件确定决策变量所要满足 的约束条件 ——原材料限制,工时限制等
求解线性规划问题的方法: 求解线性规划问题的方法:
问题:如何安排生产计划,使得获利最多?
分析: 这是一个生产计划问题,设生产A产品X1kg, B产品 X2kg. 则该问题可以用如下模型来描述: Max Z=70X1+120X2 9X1+4X2≤360 s.t. 4X1+5X2 ≤200 3X1+10X2 ≤300 X1≥0 X2≥0 <约束条件> <目标函数>
求解线性规划问题的步骤: Excel 求解线性规划问题的步骤:
1、在电子表格中确定目标单元格、活动单元格,输入所有参数; 2、利用数据组相乘公式(常用函数里SUMPRODUCT)确定好约束条 件的左边对应单元格; 3、打开工具栏里的规划求解 (1)给定目标单元格、活动单元格,求最大或最小; 1 (2)添加约束条件 (3)选项栏里:线性、非负,确定 (4)确定求解
该模型的解为生产计划。
例2:某运输问题,已知资料如下表所示,问如何调 运,使产销平衡且总运费最小?
单位:百万/吨
单位运费 销地 产地
B1 A1 A2 A3 5 4 4 30
B2 6 1 2 50
B3 10 9 4 40
B4 3 7 8 40
产量 (吨) 60 40 60
销量(吨)
这是一个产销平衡运输问题,即: ∑Ai 地产量ai= ∑Bj 地销量bj (i=1,2,3;j=1,2,3,4) 设从生产地Ai到销售地Bj的调运量为: Xij (i=1,2,3;j=1,2,3,4) 该问题的数学模型为: Min Z=5 X11+6 X12+10X13+3X14+4X33+8 X34 X11+X12+X13+X14=60 X21+X22+X23+X24 =40 …… s.t. X11+X21+X31=30 …… X14+X24+X34=40 ——销量约束 ——产量约束
线性规划(完整版本)
2 线性规划基本概念
生产计划问题
➢如何合理使用有限的人力,物力 和资金,使得收到最好的经济效益。 ➢如何合理使用有限的人力,物力 和资金,以达到最经济的方式,完 成生产计划的要求。
例1 生产计划问题(资源利用问题) 某家具厂生产桌子和椅子两种家具。
桌子售价50元/个,椅子销售价格30元/
个,生产桌子和椅子要求需要木工和油 漆工两种工种。生产一个桌子需要木工4 小时,油漆工2小时。生产一个椅子需要 木工3小时,油漆工1小时。该厂每个月 可用木工工时为120小时,油漆工工时为 50小时。问该厂如何组织生产才能使每 月的销售收入最大?
决策变量、约束条件、目标函数
3 线性规划问题的数学模型
一、问题的提出
解:
例2 某厂生产两种产品,下表给 出了单位产品所需资源及单位产品 利润
产品 资源
I
设备
1
材料 A
4
材料 B
0
单位利润
(元)
2
可利用
II
资源
2
8
0
16
4
12
3
问:应如何安排生产计划,才能使 总利润最大?
1.决策变量:设产品I、II的产量分
别为 1、x2
2.目标函数:设总运费为z,则有: max z = 2 x1 + 3 x2
3.约束条件:
x1 + 2x2 ≤ 8
4x1
≤ 16
4x2 ≤ 12
x1, x2≥0
例3 营养配餐问题 假定一个成年人每天需要从食物中
获得3000千卡的热量、55克蛋白质和 800毫克的钙。如果市场上只有四种食 品可供选择,它们每千克所含的热量 和营养成分和市场价格见下表。问如 何选择才能在满足营养的前提下使购 买食品的费用最小?
第2章线性规划模型、图解法、标准型
凸集性质:
凸组合:设x(1),x(2),…,x(k)是n维空间中的k个点,若存在 μ1,μ2,…,μk (0≤μi≤1 i=1,2,…k 且Σμi=1)使 x=μ1x(1)+μ2x(2)+…+μkx(k)成立,则称 x为 x(1),x(2),…,x(k) 的凸组合。 特别,平面上的两点x(1),x(2),连线上任一点x的坐标为 x=αx(1)+(1-α)x(2) 0≤α≤1.
§2.2 线性规划问题解的概念
设线性规划的标准形式:
max z=Σcjxj
(1)
s.t Σaijxj=bi i=1,2,…,m (2)
xj≥0 j=1,2,…,n (3)
可行域:由约束条件(2)、(3)所围成的区域;
可行解:满足(2)、(3)条件的解X=(x1,x2,…,xn)T为可行解; 基:设A是约束条件方程组的m×n维系数矩阵,其秩为m,B是A中
总结:
一般情况下,其值均是正的
线性规划三要素:
决策变量、目标函数、 约束条件
线性规划的特点:
目标线性、约束条件为线性不等式或等式
定义:线性规划(LP)的一般模型为 目标函数: max(min) z=c1 x1+ c2 x2+ …+ cn xn
约束条件: a11 x1 + a12 x2+ …+ a1n xn=(≤、≥)b1 a21 x1 + a22 x2+ …+ a2n xn=(≤、≥)b2 ……… am1 x1+ am2 x2+ …+ amn xn=(≤、≥)bm x1≥0,x2≥0,…,xn≥0
§2.3 线性规划问题的几何意义
凸集: (直观)图形中连接任意两点的直线全部都在图 形区域内,称此图形是凸的.严格数学定义: 设Ω为一n维 欧 氏 空 间 的 点 集 , 若 任 意 两 点 x1,x2∈Ω, 有 x=λx1+(1λ)x2∈Ω,其中λ∈[0,1],则称Ω为凸集。
线性规划 Linear Programming
Example
There are 168 hours in a week. Say we want to allocate our time between classes and studying (S), fun activities and going to parties (P), and everything else (E) (eating, sleeping, taking showers, etc). Suppose that to survive we need to spend at least 56 hours on E (8hours/day). To maintain sanity we need P + E ≥ 70. To pass our courses, we need S ≥ 60, but more if don’t sleep enough or spend too much time partying: 2S +E − 3P ≥ 150. (E.g., if don’t go to parties at all then this isn’t a problem, but if we spend more time on P then need to sleep more or study more).
Example
Q1: Can we do it? Formally, is there a feasible solution? A: Yes. For instance, one feasible solution is: S = 80, P = 20,E = 68.
Example
Q2: Suppose our notion of happiness is expressed by 2P +E. What is a feasible solution such that this is maximized? The formula “2P + E” is called an objective function.
01-线性规划ppt课件
Ⅰ
设备
1
原材料 A
4
原材料 B利用资源
2
8 台时
0
16 kg
4
12 kg
3
?元
第3页
Ⅰ
设备
1
原材料 A
4
原材料 B
0
利润
2
01:20
Ⅱ
可利用资源
2
8 台时
0
16 kg
4
12 kg
3
?元
设 x1、x2 分别表示计划期内产品Ⅰ、Ⅱ的产量, 建立数学模型:
利润最大
设备台时 原材料 A 原材料 B 产品产量
a21x1 + a22x2 +…+ a2nxn ( = , ) b2
…
…
(1.2)
am1x1 + am2x2 +…+ amnxn ( = , ) bm
x1,x2,…,xn 0
(1.3)
求解线性规划的任务就是:在所有满足约束条件的解(x1, x2,…,xn)中求出使目标函数 z 达到最优值的最优解(x1*, x2*,…,xn*)。
x2 1.4
x1 0,x2 0
第7页
01:20
• 线性规划模型的共同特征 (模型的三要素)
⑴ 每一个模型都有一组决策变量(x1,x2,…,xn), 这组决策变量每取一组值就代表一个具体的方案。一般 这些变量的取值都是连续且非负的。
⑵ 存在一定的约束条件,这些约束条件可以用一组 线性等式或线性不等式来表示。
等于约束右边与左边之差
xs =bi–(ai1 x1 + ai2 x2 + … + ain xn )
显然,xs也具有非负约束,即xs≥0, 这时新的约束条件成为
线性规划Linear Programming
2021/8/31
3
辅助问题
设原问题为
min c x
s.t. xAx
0
b
(Ⅰ)
不妨假设 b 0 ,如果某一个元素小于 0 ,该方程两边乘于 1后则可以使右端数
变成正数。考虑如下问题(辅助问题)
nm
min g xi i n 1
s.t.
Ax xa b x 0, xa 0
(Ⅱ)
xnm RHS
nm
z0
n m
0
x B1
a11
a1r
a1n a1,n1
a1, n m
b1
x Br
ar1
a rr
arn ar,n1
ar ,n m
br
a m1 x Bm
a mr
amn am,n1
am,n m
bm
2021/8/31
18
基变量包含有若干人工变量
基变量 xB1 , , xBm 。设其中 xBr 为一个人工变量,这里 n 1 Br n m 。 我们来看第 r 行的前 n 个元素。
由于检验数都小于等于 0,所以对应的基可行解就是原问题的最优解, 最优值为 31/4,对应的最优解为 (1/ 2, 0, 1/ 4, 0,0)。
2021/8/31
16
基变量包含有若干人工变量
设辅助问题的最优单纯形表如下。
x1
xr
Z 1
r
G 1
r
xn xn1 n n1 n n1
xnm RHS
nm
z0
其中 xa (xn1, xn2 , , xnm ) 。
2021/8/31
4
原问题与辅助问题的关系
1、如果原问题(Ⅰ)有可行解,则规划(Ⅱ)的最优值为 0 ,反之亦然。
Linear Programming线性规划
Linear Programming(1)可用一些变量表示问题的待定方案,这些变量的一组定值就代表一个具体的方案。
因此,可将这些变量称为决策变量,并往往要求它们为非负的。
(2)存在一定的约束条件,这些约束条件都能用关于决策变量的线性等式或线性不等式来表示。
(3)有一个期望达到的目标,它可用决策变量的线性函数(称为目标函数)来表示根据具体问题的不同,要求目标函数实现最大化或最小化。
解的特点 1. 线性规划问题的可行解的集合是凸集2. 线性规划问题的基可行解一般都对应于凸集的顶点3. 凸集的顶点的个数是有限的4. 最优解只可能在凸集的顶点上,而不可能发生在凸集的内部数学模型11221111221121122222112212max (,)(,) .. (,) ,,0n nn n n n m m mn n mn Z c x c x c x a x a x a x b a x a x a x b s t a x a x a x bx x x =++++=≥≤⎧⎪++=≥≤⎪⎪⎨⎪++=≥≤⎪≥⎪⎩(1,2,,;1,2,,) :; : ; ::; :; :j i ij i m j n n m n m c b a ==+ 其中变量个数约束行数线性规划问题的规模价值系数右端项技术系数也可写成合式11max (), 1,2,, ..0, 1,2,,nj jj nij ji j j f x c x a x b i m s t x j n ===⎧≤=⎪⎨⎪≥=⎩∑∑向量式 : 01max () ..n j j j f x x s t ==⎧≤⎪⎨⎪≥⎩∑CXP b X 0 其中 121211220 (,,,); (,,,)000Tn n j jj mj m c c c x x x a b a b a b ==⎛⎫⎛⎫⎛⎫⎪ ⎪ ⎪ ⎪ ⎪⎪=== ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪⎝⎭⎝⎭⎝⎭C X P b 0simplex method重点: 检验数的概念和计算 最优性判别基变换(换入变量和换出变量的确定) 旋转变换模型变换为标准型:11max (), 1,2,,..0, 1,2,, 1,2,,n mj jj n mij ji j j f x c x a x b i m s t x i m j n +=+==⎧==⎪⎨⎪≥==⎩∑∑ 标准型有n+m 个变量(列),m 个约束行。
MBA运筹学培训讲义
MBA运筹学讲义运筹学是一门应用科学,它广泛应用现代科学技术知识、用定量分析的方法,解决实际中提出的问题,为决策者选择最优决策提供定量依据。
运筹学的核心思想是建立在优化的基础上。
例如,在线性规划中体现为两方面:(1)对于给定的一项任务,如何统筹安排,使以最少的资源消耗去完成?(2)在给定的一定数量的资源条件下,如何合理安排,使完成的任务最多?运筹学解决问题的主要方法是用数学模型描述现实中提出的决策问题,用数学方法对模型进行求解,并对解的结果进行分析,为决策提供科学依据。
随着计算机及计算技术的迅猛发展,目前对运筹学的数学模型的求解已有相应的软件。
因此,在实际求解计算时常可借助于软件在计算机上进行,这样可以节省大量的人力和时间。
第一部分线性规划内容框架LP问题基本概念数学模型可行解、最优解LP问题解的概念基本解、基可提出基本最优解基本方法图解法原始单纯形法单纯形法大M 法人工变量法对偶单纯形法两阶段法对偶理论进一步讨论灵敏度分析──参数规划*在经济管理领域内应用运输问题(转运问题)特殊的LP问题整数规划多目标LP问题*第一部分线性规划(Linear Programming)及其应用第一章 LP问题的数学模型与求解§1 LP问题及其数学模型(一)引例1(生产计划的问题)某工厂在计划期内要安排生产Ⅰ、Ⅱ的两种产品,已知生产单位产品所需的设备台时,A、B两种原材料的消耗以及每件产品可获的利润如下表该问题可用一句话来描述,即在有限资源的条件下,求使利润最大的生产计划方案。
解:设x1,x2分别表示在计划期内生产产品Ⅰ、Ⅱ的产量。
由于资源的限制,所以有:机器设备的限制条件:x1+2x2≤8原材料A的限制条件: 4x1≤16 (称为资源约束条件)原材料B的限制条件: 4x2≤12同时,产品Ⅰ、Ⅱ的产量不能是负数,所以有x 1≥0,x2≥0 (称为变量的非负约束)显然,在满足上述约束条件下的变量取值,均能构成可行方案,且有许许多多。
[经济学]运筹学 第二章 线性规划
1
2
… n
0
n+1
…0
… n+m
24
线性规划 Linear Programming 〔LP〕
上面的单纯形表还可以表示成矩阵的形式
基解
X
XS b
A
j
C
XS
I 0
基解
XB
XN
XS b
B
N
j
CB
CN
XS
I 0
25
线性规划 Linear Programming 〔LP〕
由单纯形表进行迭代步骤: 选择 Xj 入基:当 j 行中 cj= max { ci∣ci 0} 选择 Xi 出基:当 i = min{<bi/aij>∣aij 0} 换基迭代:当确定了入基变量 Xj 、出基变量 Xi 后,以
线性规划 Linear Programming 〔LP〕
单纯形方法
1
线性规划 Linear Programming 〔LP〕
单纯形方法是于1947年首先发明的.近50年来,一直是求 解线性规划的最有效的方法之一,被广泛应用于各种线性规划 问题的求解.本节讨论单纯形法的基本概念、原理及算法.
2
线性规划 Linear Programming 〔LP〕
aij 作为主元对单纯形表进行初等行变换〔取主运算〕, 即将 aij 所在列除采用初等行变换将 aii 变换为1外的 其余元素都变换为 0.注意这种变换只能采用初等行变 换!
26
线性规划 Linear Programming 〔LP〕
最优解检验: 1、 当迭代进行至某一步时, j 行中所有检验数均小于等于
Xi≥0
5
线性规划 Linear Programming 〔LP〕
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
ASSUMPTIONS OF LINEAR PROGRAMMING •from a mathematical viewpoint, the assumptions simply are that the model must have a linear objective function subject to linear constraints.•However, from a modeling viewpoint, these mathematical properties of a linear programming model imply that certain assumptions must hold about the activities and data of the problem being modeled, including assumptions about the effect of varying the levels of the activities.•Proportionality •Additivity •Divisibility •CertaintyProportionality assumptioncosts•This case would arise if there were start-up costs associated with initiating the production of product 1. For example, there might be costs involved with setting up the production facilities. There might also be costs associated with arranging the distribution of the new product. Because these are one-time costs, they would need to be amortized on a per-week basis to be commensurable with Z (profit in thousands of dollars per week).costs•Suppose that this amortization were done and that the total start-up cost amounted to reducing Z by 1, but that the profit without considering the start-up cost would be 3x1. This would mean that the contribution from product 1 to Z should be 3x1-1 for x1 > 0, whereas the contribution would be 3x1 0 when x1 0 (no start-up cost). This profit function,3 which is given by the solid curve in Fig., certainly is not proportional to x1.increasing marginal return•the slope of the profit function for product 1 keeps increasing asx 1is increased. This violation of proportionality might occurbecause of economies of scale that can sometimes be achieved at higher levels of production, e.g., through the use of more efficient high-volume machinery, longer production runs, quantity discounts for large purchases of raw materials, and the learning-curve effect whereby workers become more efficient as they gain experience with a particular mode of production.As the incremental cost goes down, the incremental profit will go up (assuming constant marginal revenue).decreasing marginal return•the slope of the profit function for product 1 keeps decreasing as xis increased.1decreasing marginal return•the marketing costs need to go up more than proportionally to attain increases in the level of sales . For example, it might be possible to sell product 1 at the rate of 1 per week (x 1=1) with no advertising, whereas attaining sales to sustain a production rate of x 1=2 might require a moderate amount of advertising, x 1=3might necessitate an extensive advertising campaign, and x 1=4 might require also lowering the price•The conclusion was that proportionality could indeed be assumed without serious distortion.•what happens when the proportionality assumption does not hold even as a reasonable approximation? In most cases, this means you must use nonlinear programming instead• a certain important kind of nonproportionality can still be handled by linear programming by reformulating the problem appropriately.•Furthermore, if the assumption is violated only because of start-up costs, there is an extension of linear programming (mixed integer programming) that can be usedAdditivity•Although the proportionality assumption rules out exponents other than 1, it does not prohibit cross-product terms (terms involving the product of two or more variables).•Additivity assumption: Every function in a linear programming model (whether the objective function or the function on the left-hand side of a functional constraint) is the sum of the individual contributions of the respective activities•this case corresponds to an objective function of Z =3x1+5x2+x1x2, so that Z =3+ 5+ 1= 9 for (x1, x2) (1, 1), thereby violating the additivity assumption that Z =3+5.•The proportionality assumption still is satisfied since after the value of one variable is fixed, the increment in Z from the other variable is proportional to the value of that variable. This case would arise if the two products were complementary in some way that increases profit.•For example, suppose that a major advertising campaign would be required to market either new product produced by itself, but that the same single campaign can effectively promote both products if the decision is made to produce both. Because a major cost is saved for the second product, their joint profit is somewhat more than the sum of their individual profits when each is produced by itself.•Case 2 also violates the additivity assumption because of the extra term in the corresponding objective function, Z =3x 1+5x 2-x 1x 2, so that Z=3+5-1= 7 for (x 1, x 2) (1, 1). As the reverse of the first case, Case 2 would arise if the two products were competitive in some way that decreased their joint profit.•For example, suppose that both products need to use the same machinery and equipment . If either product were produced by itself, this machinery and equipment would be dedicated to this one use. However, producing both products would require switching the production processes back and forth, with substantial time and cost involved in temporarily shutting down the production of one product and setting up for the other.Affect the additivity of the constraint functions•Affect the additivity of the constraints function•For example, consider the third functional constraint of the Wyndor Glass Co. problem: 3x1+2x2<=18. (This is the only constraint involving both products.)•3x1+2x2+0.5x1x2<=18•namely, extra time is wasted switching the production processes back and forth between the two products. The extra cross-product term (0.5x1x2) would give the production time wastedin this way. (Note that wasting time switching between products leads to a positive cross-product term here, where the total function is measuring production time used, whereas it led to a negative cross-product term for Case 2 because the total function there measures profit.)•For Case 4 the function for production time used is 3x1+2x2-0.1x21x2, so the function value for (x1, x2)=(2, 3) is 6+6-1.2=10.8. This case could arise in the following way.•As in Case 3, suppose that the two products require the same type of machinery and equipment. But suppose now that the time required to switch from one product to the other would be relatively small.•occasional idle periodsDivisibility•Divisibility assumption: Decision variables in a linear programming model are allowed to have any values, including noninteger values, that satisfy the functional and nonnegativityconstraints. Thus, these variables are not restricted tojust integer values. Since each decision variable represents the level of some activity, it is being assumed that the activities can be run at fractional levels.Certainty•Certainty assumption: The value assigned to each parameter of a linear programming model is assumed to be a known constant •Linear programming models usually are formulated to select some future course of action. Therefore, the parameter values used would be based on a prediction of future conditions, which inevitably introduces some degree of uncertainty.•sensitivity analysis to identify the sensitive parameters•other ways of dealing with linear programming under uncertainty•It is very common in real applications of linear programming that almost none of the four assumptions hold completely. Except perhaps for the divisibility assumption, minor disparities are to be expected.This is especially true for the certainty assumption, so sensitivity analysis normally is a must to compensate for the violation of this assumption•A disadvantage of these other models is that the algorithms available for solving them are not nearly as powerful as those for linear programming, but this gap has been closing in some cases. For some applications, the powerful linear programming approach is used for the initial analysis, and then a more complicated model is used to refine this analysisThe Simplex MethodTHE ESSENCE OF THE SIMPLEX METHOD •The simplex method is an algebraic procedure. However, its underlying concepts are geometric.•Before delving into algebraic details, we focus in this section on the big picture from a geometric viewpoint.•each constraint boundary is a line that forms the boundary of what is permitted by the corresponding constraint. The points of intersection are the corner-point solutions of the problem. The five that lie on the corners of the feasible region—(0, 0), (0, 6), (2, 6), (4, 3), and (4, 0)—are the cornerpoint feasible solutions (CPF solutions). [The other three—(0, 9), (4, 6), and (6, 0)—are called corner-point infeasible solutions.]•In this example, each corner-point solution lies at the intersection of two constraint boundaries.•For a linear programming problem with n decision variables, each of its cornerpoint solutions lies at the intersection of n constraint boundaries.•Certain pairs of the CPF solutions share a constraint boundary, and other pairs do not.•For any linear programming problem with n decision variables, two CPF solutions are adjacent to each other if they share n-1 constraint boundaries. The two adjacent CPF solutions are connected by a line segment that lies on these same shared constraint boundaries. Such a line segment is referred to as an edge of the feasible region•Since n=2 in the example, two of its CPF solutions are adjacent if they share one constraint boundary; for example, (0, 0) and (0, 6) are adjacent because they share the x1=0 constraint boundary. The feasible region in Fig has five edges, consisting of thefive line segments forming the boundary of this region. Note that two edges emanate from each CPF solution. Thus, each CPF solution has two adjacent CPF solutions•Optimality test: Consider any linear programming problem that possesses at least one optimal solution. If a CPF solution has no adjacent CPF solutions that are better (as measured by Z), thenit must be an optimal solutionSolving the Example -Wyndor Glass Co. Problem•Initialization: Choose (0, 0) as the initialCPF solution to examine. (This is aconvenient choice because no calculationsare required to identify this CPF solution.)•Optimality Test: Conclude that (0, 0) is notan optimal solution. (Adjacent CPFsolutions are better.)•Iteration 1: Move to a better adjacent CPFsolution, (0, 6), by performing the followingthree steps.•1. Considering the two edges of the feasible region that emanate from (0, 0), choose to move along the edge that leads up the x 2axis. (With an objective function of Z=3x 1+5x 2, moving up the x 2axis increases Z at afaster rate than moving along the x 1axis.)•2. Stop at the first new constraint boundary:2x 2=12. [Moving farther in the directionselected in step 1 leaves the feasible region; e.g., moving to the second new constraint boundary hit when moving in that direction gives (0, 9), which is a corner-point infeasible solution.]•3. Solve for the intersection of the new set of constraint boundaries: (0, 6). (The equations for these constraint boundaries, x 1=0 and 2x 2=12, immediately yield this solution.)•Optimality Test: Conclude that (0, 6) is not an optimal solution. (An adjacent CPF solution is better.)•Iteration 2: Move to a better adjacent CPF solution, (2, 6), by performing the following three steps•1. Considering the two edges of the feasible region that emanate from (0, 6), choose tomove along the edge that leads to the right. (Moving along this edge increases Z, whereas backtracking to move back down the x2axis decreases Z.)2. Stop at the first new constraint boundary encountered when moving in that direction:3x1+2x2=12. (Moving farther in the direction selected in step 1 leaves the feasibleregion.)3. Solve for the intersection of the new set of constraint boundaries: (2, 6). (The equations for these constraint boundaries, 3x1+2x2=18 and2x2=12, immediately yield this solution.)•Optimality Test: Conclude that (2, 6) is an optimal solution, so stop. (None of the adjacent CPF solutions are better.)The Key Solution Concepts•Solution concept 1: The simplex method focuses solely on CPF solutions. For any problem with at least one optimal solution, finding one requires only finding•The only restriction is that the problem must possess CPF solutions. This is ensured if the feasible region is bounded.•Solution concept 2: The simplex method is an iterative algorithm (a systematic solution procedure that keeps repeating a fixed series of steps, called an iteration, until a desired result has been obtained) with the following structure.•Solution concept 3: Whenever possible, the initialization of the simplex method chooses the origin (all decision variables equal to zero) to be the initial CPF solution. When there are too many decision variables to find an initial CPF solution graphically, this choice eliminates the need to use algebraic procedures tofind and solve for an initial CPF solution•Solution concept 4: Given a CPF solution, it is much quicker computationally to gather information about its adjacent CPF solutions than about other CPF solutions. Therefore, each time the simplex method performs an iteration to move from the current CPF solution to a better one, it always chooses a CPF solution that is adjacent to the current one. No other CPF solutions are considered. Consequently, the entire path followed to eventually reach an optimal solution is alongthe edges of the feasible region.•Solution concept 5: After the current CPF solution is identified, the simplex method examines each of the edges of the feasibleregion that emanate from this CPF solution. Each of theseedges leads to an adjacent CPF solution at the other end, but the simplex method does not even take the time to solve for theadjacent CPF solution. Instead, it simply identifies the rate of improvement in Z that would be obtained by moving along the edge. Among the edges with a positive rate of improvement in Z, it then chooses to move along the one with the largest rate of improvement in Z. The iteration is completed by first solving for the adjacent CPF solution at the other end of this one edge and then relabeling this adjacent•Solution concept 6: Solution concept 5 describes how the simplex method examines each of the edges of the feasible region that emanate from the current CPF solution. This examination of an edge leads to quickly identifying the rate of improvement in Z that would be obtained by moving along the edge toward theadjacent CPF solution at the other end. A positive rate of improvement in Z implies that the adjacent CPF solution is better than the current CPF solution, whereas a negative rate of improvement in Z implies that the adjacent CPF solution is worse. Therefore, the optimality test consists simply of checking whether any of the edges give a positive rate of improvement in Z. If none do, then the current CPF solution is optimalSETTING UP THE SIMPLEX METHOD•The algebraic procedure is based on solving systems of equations. Therefore, the first step in setting up the simplex method is to convert the functional inequality constraints to equivalent equality constraints. (The nonnegativity constraints are left asinequalities because they are treated separately.) This conversion is accomplished by introducing slack variables.•Although both forms of the model represent exactly the same problem, the new form is much more convenient for algebraic manipulation and for identification of CPF solutions.•We call this the augmented form of the problem because the original form has been augmented by some supplementary variables neededto apply the simplex method.。