(标准形式即所有的变量均为负、
所有约束条件为等式、
所有的右端
项系数非负)
a=(2,3)
b1=(80,160,120)
A2=NULL
b2=NULL
A3=NULL
b3=NULL
n.iter=n+2*m
maxi=TRUE
simplex(a=a,A1=A1,b1=b1,maxi=TRUE)
:
m1=3,m2=0,m3=0
m=3,n=2
a.o=a=(2,3)
if(maxi)
a=-a(-2,-3)
if(m2+m3==0)
a=(-2,-3,0,0,0)
b=(80,160,120)
init=(0,0,0,80,160,120)
basic=(3,4,5)
eps=1e
-10
out1
simplex1(a=a,A=A,b=b,init=init,basic=basic,eps=eps):
N=5,M=3
nonbasic=(1,2)
if(stage==2)
obfun=(
-2,-3)
it=1
while(!all(obfun > -eps) && (it <= n.iter))
循环
pcol=3
if(stage==2)
neg=(1,3)
x1+2x2<=80
4x1<=160
4x2<=120
x1
,
x2>=0
A1=
1
2
4
0
0
4
A=
1
2
1
0
0
4
0
0
1
0
0
4
0
0
1
tableau=
80
-1
-2
160
-4
0
120
0
-4
tableau=
80
-1
-2
160
-4
0
120
0
-4
0
-2
-3
转化为标准形式
x1+2x2+x3=80
4x1+x4=160
4x2+x5=120
x1,x2,x3,x4,x5>=0