单纯形法求解—动态演示在求解LP问题时,有人给出了图解法,但对多维变量时,却无能为力,于是美国数学家G·B·Dantgig(丹捷格)发明了一种“单纯形法”的代数算法,尤其是方便于计算机运算。这是运筹学史上最辉煌的阶段。线性规划问题标准型的矩阵形式:MaxZ=CX(a)s.t.AX=b(b)X0(c)a11a12….a1nb1A=a21a22….a2nb=b2………………………………………am1am2….amnbm);,,,(21ncccCTnxxx),,,(21X一、关于标准型解的若干基本概念基矩阵示例:012233..23max32143214321xxxxxxxtsxxxxz000032020001010x1x2x4x3001300321=目标函数约束条件行列式≠0基矩阵X1,x2,x3为基变量,x4为非基变量因为B为基,故有XB+B-1NXN=B-1b,解得可行解XB=B-1b-B-1NXN,代入目标函数Z,Z=CBB-1b+(CN-CBB-1N)XN令非基变量XN=0,则有XT=(XB,XN)T=(B-1b,0)TZ=CBB-1bAX=bZ=CX设A=(B,N)(B为一个基,即线性无关向量组R(A)=R(B))XT=(XB,XN)T(XB为基变量,XN为非基变量)C=(CB,CN)(CB为基变量系数,CN为非基变量系数)则有:Z=(CB,CN)(XB,XN)T=CBXB+CNXNAX=(B,N)(XB,XN)T=BXB+NXN=b1、单纯形法原理:Z=CBB-1b+(CN-CBB-1N)XN如果CN-CBB-1N小于0,无论XN取任何大于0值,只会让Z变小,因此我们可以通过CN-CBB-1N来判断Z取得是不是最大值。如果存在一个CN-CBB-1N大于0,则说明Z的值会随着XN增大而增大,说明Z有调整的余地。定理一:若某个基本可行解所对应的检验向量CN-CBB-1N=0,则这个基本可行解就是最优解。定理二:若某个基本可行解所对应的检验向量CN-CBB-1N存在一个检验数=0,则该问题有无数多个最优解。定理三:若某个基本可行解所对应的检验向量Cj-CBB-1Nj大于0,且aij,都小于0,则无解。为了矩阵形求逆计算方便,一般将B转化为单位矩阵。①将线性规划问题化成标准型。②找出或构造一个m阶单位矩阵作为初始可行基,建立初始单纯形表。③计算各非基变量xj的检验数j=Cj-CBPj′,若所有j≤0,则问题已得到最优解,停止计算,否则转入下步。④在大于0的检验数中,若某个k所对应的系数列向量Pk≤0,则此问题是无界解,停止计算,否则转入下步。⑤根据max{j|j>0}=k原则,确定xk为换入变量(进基变量),再按规则计算:=min{bi/aik|aik>0}=bl/aik确定xBl为换出变量。建立新的单纯形表,此时基变量中xk取代了xBl的位置。⑥以aik为主元素进行迭代,把xk所对应的列向量变为单位列向量,即aik变为1,同列中其它元素为0,转第③步。2、单纯形法的计算步骤线性规划的例子0,40025005.2516002234max211212121xxxxxxxxxz线性规划--标准化引入变量:s1,s2,s3121231211222312123max501000003002400250,,,,0zxxsssxxsxxsxsxxsss25040030032121100100101200111sssxx3020102100150maxsssxxz•提取系数,填入表格:s.t.3212100010050maxsssxxz1x1+1x2+1s1+0s2+0s3=3002x1+1x2+0s1+1s2+0s3=400x1≥0,x2≥0,si≥00x1+1x2+0s1+0s2+1s3=250C向量CBCNXBXN基BN=CBB-1b+(CN-CBB-1N)XNjjjzcZj=CBNj每个非基变量的检验值初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值1Zj=CBNjZ=CBB-1biijbajjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值1Zj=CBNjZ=CBB-1biijbajjjzc目标函数系数区约束条件系数区右端系数检验系数区基变量区初始单纯形表迭代次数基变量CBx1x2s1s2s3b比值501000001Zj=CBNjZ=CBB-1b2iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000000111003002101040001001250Zj=CBNjZ=CBB-1b2iiabjjjzc初始单纯形表迭代次数基变量CBx1x2s1s2s3b比值501000001111003002101040001001250Zj=CBNjZ=CBB-1b2iiabjjjzc初始单纯形表迭代次数基变量CBx1x2s1s2s3b比值501000001S1011100300S2021010400S3001001250Zj=CBNjZ=CBB-1b2iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000001S1011100300S2021010400S3001001250Zj=CBNjZ=02iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000001S1011100300S2021010400S3001001250Zj=CBNj00000Z=02iiabjjjzc00000初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000001S1011100300S2021010400S3001001250Zj=CBNj00000Z=01000002iiabjjjzc50初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000001S1011100300S2021010400S3001001250Zj=CBNj00000Z=0501000002iiabjjjzc1250①14001300可行解XB=B-1b-B-1NXN=0初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S1011100300S2021010400x201001250Zj=CBNjZ=CBB-1b2iiabjjjzc1250①14001300可行解XB=B-1b-B-1NXN=0初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S1011100300S2021010400x210001001250Zj=CBNjZ=CBB-1b2iiabjjjzc1250①14001300初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S1011100300S2021010400x210001001250Zj=CBNjZ=CBB-1b2iiabjjjzc1250①14001300初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S1011100300S2021010400x210001001250Zj=CBNjZ=CBB-1b2iiabjjjzc1250①14001300初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S101010-150S202001-1150x210001001250Zj=CBNjZ=250002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S101010-150S202001-1150x210001001250Zj=CBNj010000100Z=250002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S101010-150S202001-1150x210001001250Zj=CBNj010000100Z=2500050000-1002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S101010-150S202001-1150x210001001250Zj=CBNj010000100Z=2500050000-1002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000002S101010-150S202001-1150x210001001250Zj=CBNj010000100Z=2500050000-1002iiabjjjzc①2150150初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000003S101010-150S202001-1150x210001001250Zj=CBNj2iiabjjjzc①x150x150初始单纯形表迭代次数基变量CBx1x2s1s2S3b比值501000003x1501010-150S202001-1150x210001001250Zj=CBNj2iiabjjjzc①初始单纯形表迭代次数基变量CBx1x2s1s2S3b比值501000003x1501010-150S202001-1150x210001001250Zj=CBNj2iiabjjjzc①初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000003x1501010-150S2000-21150x210001001250Zj=CBNjZ=275002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000003x1501010-150S2000-21150x210001001250Zj=CBNj5010050050Z=275002iiabjjjzc初始单纯形表迭代次数基变量CBx1X2s1s2S3b比值501000003x1501010-150S2000-21150x210001001250Zj=CBNj5010050050Z=2750000-500-502iiabjjjzc表格中,检验系数σj全部小于或等于0,根据判断规则,Z值为最优值(Z=27500),其解:X1=50,S1=50,X2=250,s2=s3=0为模型的最优解。