Report No. 507
aprii 1971
E
LABORATORIUM VOOR
SCHEEPSBOUWKUNDE
TECHNISCHE HOGESCHOOL DELFT
An ALGOL Progrea of the Simplex Method
bi
GUsually, the Simplex Method. je known as a method to obtain the optimum
sOlution of the Linear Programming, which
is to obtain th.
optimum point(vector X°
the aet of values 11° *20, , x°) to minimize(or maximize) the value of the linear function,
J
«C' .%
under the constraints of
AX-b
where A : nra matrix
x,C,. z n - dim. vector
transpose of vector C
b
'm-dle
vector
On the other hand, the Simplex Method in this program, which is developed by Neider and Miad (i), is used to solve the Non-Linear Programming which is
defined in
gen.ra].
the method to obtain th. minimum point of the non-linearfunction
J - f(X)
and the f'unotion value of this point under the nonlinear constraints of
9(X)-o
Ther. are many kinds of methods to solve thee. problems, such as the steepest descent method, which is the most popular on.. Btt this method is said to b. not ff.otiv. when the function has the steep valley.
mi
Simplex Method ii known as one of the most effective method whenthe problem has no oonstraiuts. It is defined that n + 1 vectors in
n-dimensional
vector apac. make a simplex, and these points are chosen for estimated v*luse of the minimum point. This m.thod is carried out to movethes.
points according to th. proper algorithm so as to mov, the simplex near the exact minimum point.This program is oonatruot.d with sight kinds of procedures, four of
them
ax'. used L'or the preparation of the movement of the simplex.
1, Procedure P I N
In this procedure the function valuei of the + i of a simplex are
evaluated, W. d.fine these values
2
Procedure MflIMAX
The maximum end the minimum value of th. ut of fi (i i, n + 1)
are obtained in this procedure. These points and values are defined,
f
..f(X).aNax{f(XÚ/i_].,
fi. úf(X)-Min{f((i)/i_1,
r.sp.otiv.ly.
Procedure SECMAX
The second mazlmum value and point are obtained
f
uuf(X)
'sMZ
fÇi) /iil,
, fl+l, %i(j }
4 Procedure
CDTROTh
The oentroid of the n
pointa of the simplex, .goluding the point X14, is
obtaiRM,
and we name it six4xt
The other four kinds of procedur.. are used to move the simplex1
5 Procedure R!1LEX
Aa the worst point of the aimplex with which w. are oonoerned is the point %4, we should concentrate our a.tt.ntion to this point. It would be reasonable to consider that w. can get a bettsr point by moving this point in the direction of the other points. For this puxpos., the
point is refl.ot.d against )(Ìj to
Xt.
e.g. (ese Fig. i)
Xi'i+ o(XM Xi)
(1+d)-
t,&i
and the function value f of this point is tr&Luatsd. fk
-6. Procedure EXP}SION
If
f ii
mall.r than f, we may consider that the direction of »1 - )Ci. v.r ±fotiv., Therefore, it may be better to oontiu th. movement
in this direstion than to atop at this point, This movement is oafled oxpane ion and defined
X
(XR-.)
and the function value
f
of this point is obtained (Fig. 2).7 Procedure COW]flTCP
On the other hand, when
f,
la larger thanf
it is considered thatthe movement by the reflection is too large, and we should choose a áall.r displacement.
Before contraction, fj and X are replao.d by f and X respectively
when f is ealler than fit. The contraction le defined. (Fig.3)
Xc; 'Xj+
(%M-XH)
0'T<1
and the function value f i. evaluated. -
f(Xc)
0. Procedure NEWSThI'
When all of these movement have failed (f)f). we should consider that ti.: simplex with uhioh ve are d.aling ii too large and the optimum point i. situated Inside of the simplex, so that we should make our simplex smaller by moving the points in the direction of XL.
Thi procedure NEWSIMP te carried out by
Xi-Xi +S4-Xi)
-i - 1,
(Pig.
4)
Thee. movement, are illustrated in Figuree i - 4 in the case of n M 2.
The values of (, and Sar. chosen 1.5, 2, 0.5 and 05 respectively
in this program.
Utilizing these procedure., the flow chart of of the Simplex Method is shown in Fig. 5.
The oouvergenoe condition in this program is
fki-f1<
(s.. Appendix,
Sri
00088)The condition itself or the value of hould be changed it it i. not
suitable Cor each program.
Per an example, an application of this program for the Rosenbrocl function (2) ii shown in Pig. 6.
4,
The Roasnbroolc
function baa a form of
f(X, X2) -
loo (x
X1)2 + (ir1)2The minimum point and the function value at this point are of ocume
- x
-i
f(l, i) - o
respectively. This function vta uM. specially for the pump... of d.mon.tration, and as w. can se. it .asi]y, it bas a very sharp and
curved valley,
.0
it i. almost impossible to get 4h. optimum point byth. not so adaptive method such as the .te.p.st descent method.
Starting from the
initial
simplex, (6, 1), (4, 2) and (5, 3), we get thepoint first by the reflection of
EH.
A. th. valu, was smaller than1,the poo.d.
CPARSI0N van carried out and ve got th. pointF.
Next, we got FR b the reflect ion of lFg, Fc. by the contraction of PL
and P by the reflection of F. and ?W2. were obtained by the
pro6*ure NTh1SD'.
At thi. point, ve got the vinioity of the bottais of valley of the
Rocen-brook function,
end
our simplex had to b. aide smaller by the severaltimes of .xeoution of the proo.dur. CONTRACT.
After our simplex had been made email enough, it begin to mov. again,
following the valley of the function to th. optimum point. Sev.rsl simplex..
are shown in this process Sometimes th.y became very small and some
times they became rather large.
Th. final
simplex we got was(
1.0112, 1.0230)
( 0.9790, 0.9579)
( 0.9994, 0.9969)
They are cloue enough to the exact point (i, i). If it is not sufficiently
clos. to the exact point, we can get mol. exact result by
m1ring
the oonv.r..genoa condition more strict.
The computation tim. to get these points was 6
seconde by IBM
360/65.5.
(i) JA. Neider aM R. Mead, A Simplex Method for Function Minimization,
Oomput.r 3., 7, 1965.
(2) H.E. Roi.nbroolc, An Automatio Method for Finding the Greateat or
Leaat Value of a. Function, Coraputer 3, 3, 1960
XL
FiG i
REFLECTION
FIG 2 EXPANSION
Xli
(Xr-Xh)
FIG 3 CONTRACTiON
FIG 4 NEW SIMPLEX
---;Xs
Xc)
--Xh
XL
íiTIAL 8DLEZ
PIN
3
Plow Ohs't of' th Simplex Method
V..
p1M out
s
Fr2
-2
0
2
4
6
FIG 6 AN EXAMPLE OF THE ROSENBROCK FUNCTION
/OPTIMAL POINT
I
LEVEL 1JUL67 -...00048 00050 00050 00051 - ...0O51 00052 00053-00054 -. 0055... 00056 -...--. 0005a.-00058 00059---00060 . 00062.... 00062 SC ...SOURCE-STATEMENT... OS ALGOL F SOURCE PROGRAM DATE FEB 18 1971 PAGE 001 . . 00000 ... 'BEGIN' ...
...SIMO1AOC
00000 'COMMENT' SIMPLEX METHOD; SIMÚ1BOO
00000 tINTEGERII,J,N,IL,1I1,IND,LS,K;
SIMO1CPO
00001 N:=2; SIMC)1DC0
00002 ...'BEGIN' ...'REAL'S,FKT,FL,FH,FS,FR,FE,FC; ... SIMO1EOO
00003 'ARRAY'x(/l:N,l:N+l/),xM,xR,xE,xc,xu(/l:N/),f-x(,j:N+l,); SIMOIFCJO 00004 'PROCEDURE'BLANK(D,N);IVALUEID,N;IINTEGERtD,N;ICOOE.; .. 00008 'PROCEDURE'FIX(0,M,N,X);IVALUEID,M,N,X;tINTEGFRID,M,f,;IRFA1IX;ICODE,; 00013 ...'PROCEDURE'PIN(XU,N,FKT ... . . SIMCIJOO 00014 'INTEGER'N;'REAL'FKT;'ARRAy'xu; SIMO1KOO .00017 ...FKT:=1OO*(XU/2/)_xU(/1/)**2)**2+(1_u(,1,)p**2 ...SIMOILCO 00018 'PROCEIJURE'MINMi\x(FX,N,FL,FH,IL,JH); SIMOIMOO .00019 ...'INTEGER'N,LL,IH ;'REAL'FL,FH;',ARRAY"FX ...SLMC1N00 00022 'IIEGIN'FL:=+'7;FH:=-'7; SIMO1000 00024...-...'FOR'L:=I'STEP'I'UNT!L'N-i-l'[)ç]' - STMO1POO 00024 'BEGIN' SIMO1000 00024 - . S=FXii/; ...- ....
00025 'IF'S >FH'THEN''HEGtN'FH:=S; IH:=I;'END';SIMOjROO
00028 ... 'IF'S...<FL'THEN''BEGJN'FL:=S; IL:=1;'END';SIMOlSOo
00031 'END'; SIMO1TOO
00032 ...- 'END; ...- siioiuoo
00033 'PRUCEBURE'SECMAX(FX,FS,N,[H,IS); SIMÛIVOO
00034 'INTEGER'N, IH,IS;'REAL'FS;'ARRAY'Fx; . S1M010O
00037 'BEGIN' FS:=-'7;
00038...'FOR'I:1'STEP'l't.JNTIL'N4-I'DO' S'lfrlGlxOO
00038 'BEGIN''IF'I=IRTt-IEN' 'GOTO'SKIP;S:=FX(/I/l; SIMOIXUI
00040... --.-... 'IF'S )FS'THEN''BEGIN'FS:=S; IS:=1;'END'; SIMO1YOO
00043- SKIP: 'END';'END'; SIMÛILOO
00045...'PROCEDURE'CENTRUID(X,XM,N,IH ...' SIMO2AOO 00046 'INTEGER'N,IH;'ARRAY'x,xM; SIMc-2BOO 'BEGIN''REAL'S;'INTEGER'l,j; SIMO2COO 'FOR'l:=Ì'STEP'I'UNTIL'N'DO' SMO2D00 ...'BEGIN'S:=O; ....--..
... --
-SIMC2EOO 'FOR'J:=I'STEP'l'UNTIL'N+l'Do' SIMO2FOO S:=SX(/!,J/ ...,--
''SIMO2000 XM(/I/I:=(S-X(/1,JH/))/N; SIMO2HOO tENDU; . SIMO2IOO 'END'; SIMO2JOO 'PROCEDURE'REFLECT(XM,XH,N,XR); - SIMC2K00'INTEGER'N; 'ARRAY'XM,XH,XR; S!MO2LOO
-'FOR'-I:=l'STEP'L'UNTIL'N'DO' SIMO2MOO
XR(/I/):=2.5*XM(/I/)-1.5*xI1(/!/); SIMO2NOO
-.
'INTEGER'N; 'ARRAY'XM,XR,xE; SIMO2POO
'FOR'1:=1'STEP'1'UNTILN'OD' SIMÛ2000 XE(/I/):=2*XR(/I/)-xM(/I/); SIMO2ROO
:4--
--:i
1_ Ç.-.'rt' .
-1) (. C, C - C-C.c.
C C C SC.. SOURCESIATEMENT 00122 ...L5: 'FOR'I:=l'STEP'I'uNTIL'N'Do'xo(/l,):=x(,I,IL,); V 00123 NEWSIMP(X,XU,N); 00124 SY-5ACT(1,14,3).;QUTSTRING(1,'(INEw...sJMpLFx)); ... 00126 SYSACT( 1,14,1); 'GOTO'Sl; 00128 ...PRINT.:...SYSACT(1,14,3); ... 00129 'IF'IND=1'TIiENb0UTSTRING(1,'(IExpANslJN)); 00130...'IF'IND=2'THE'OUTSTRING(1,'('REFLECTI)I ... 00131 IIFIIND3hTHENtOUTSTRING(1,I(tCQNTRACTI)I);SYSACT(1,14,1); 00133...'F0R'I:=I'sTEP'L'urTIL'NeDouxu(,I/):.x4,I,jH,)... 00134 FIX( 1,10,0, IN); 00135. 'F[JR'K:=1'STEP'I'UNT!L'N'DO'FIX(1,5,4,XU(,K,)). ... 00136 BLANK(1,1C);CiUTREAL(1,Fx(/IH/)); 00138 'G0TCJ'52 00139 STOP: SYSACT(1,14,5);QUTSTRJNG(1,'('CQNvERGEI)I); 00141 . . 'ENO'; . ... 00142 'END';
SOURCE PROGRAM PAGE 003
SI MO4POO S 1M04000 SI MO4ROO SIMG4SOO S 1MO4000-SIMO4VOO SI M 04 WOO SIMO4XOO S IMP4YOO S IMO4LOO SI M C 5 A 10 SI M05A20 SI MO5BOO SI MO5COO S IMG5000 -, - V. t. t-LA .. . - '
Sc SOURCE STATEMENT PAGE 002
00063 -'PROCEDURE'CONTRACT(XM,XH,N,xc); ... SLMO2SOO
00064 'INTEGER'N; 'ARRAY'XM,XH,XC; SIMO2TOO
-...00066 ...- ... 'FOR'1:=1'STtP'1'UNTjL'iN'DO' . . . SIMC'2U00
0O06 XC(/I/):=0.5*(XH(/I/)4-xM(/t/));
SIMC2VOO
-
00067....-..--'PROCEDURE'NEWSIMp(x,xL,N; - S1MO2w00
I 00068 'ENTEGER'N; 'ARRAY'x,xL; SIMO2XOO
.. . 00070 ...'FOR'J:=I'STEp'I'UNTIL'NfI'DO' sIMe2YOO 00070 'FUR'I:=I'STEP'I'UNTIL'N'DÙ' SIMO2ZOfl (...X(/!,J/):=0.5*(XL(/l/)+x(/r,J/)); SIMC3AOO 00071 SYSACT(1,B,6Q);sysACT(1,12,1); S1M03F00 ..- ...00073 'cQMMENT'MAIN PROGRAM; ... ... SIMO3OflO ( 00073 'FOR'Jl'STEP'l'UNTIL'N+I'D(]' SIMO3EOO ., 00073 ...'FOR'I:=1'SrEP'1uNTILINIDouINREAL(ox(,L,J,)); SIMO3FOO
00074 OUTSTRING(1,'([N!TJAL SIMPLEX')');SYSACT(1,14,1); SIMÜ3GOO
I....: Si:...'FOR'J:=I'STEp'lIUNTJL'Ni-l'DQ'. .
5!MO3HOO 000m 'BEGIN''FUR' I:=1'STEP'1'UNTIL'N'Do'xu(/j/:x(/,J/); SIMO3IOO
...-00017 PIN(XU,N,FKT);Fx(/J/):=FKr; . SIMC3JÜ0 . 1 'END'; SJMO3KOC) ..T . 00080...'FQR'J:=j'STEp'1!UNTjLN+1II)Ql ... ...SLM03LO . 00080 'BEGEN''FURJ:=1STEP1uNrjL'NDl)'xu(/I/):(/J,J/); SHIO3MOO ; ... 00081...FIX(1,1O,C,J); .. . . STMC3NC0 00082 'F(]R'K:=I'STEP'1'UNTII'N'flo'FIx(1,5,4,xu(,K,),; S11Ü3N10 00083 6LAiNK1,iC); SIM('3N20 00084 OUTREAL(1,FX(/J/));SYSACT(l,14,1J; SIMr3UOO -
.-00086 ...'FND' ...
.-.-. SIMC3000 00087 S2: MINMAX(FX,N,FL,FFj,JL,IH); SIMÜ3ROO00088 ...'IF'FH-FL<'-3 'THEN''GOT[J'SJOP; .SIMO3SOO
00089 SECMAX(FX,FS,N,IH,IS); SJMU3TOO ...00090 CENTRUiD(X,X,N,IH); SJMC3UOO C £0091 'FOR'j:=l'STEP'l'UNTIL'N'Qo'XU(/I/):x(,I,IH,,; SJMO3WQQ -...00092 ...REFLECT(XM,XU,NX); ... . - SIMO3XOO 00093 PJN(XR,N,FKT);FR:=FKT;IIFIFR>FLtTHENIIGOTOIL1; . SIMO3YOO ...:00096 ...EXPANS!ON(XM,XR,N,XE); .. . SIMO3ZOO
00091 PIN(XE,N,FKT) ;FE:=KT; ' IF'FE>FR'THEN' 'GOTO'12; SIMC4A00
...-00100 ...'FOR'I:=Ì'STEP'I'UNTIL'N'Do'x/I,IHI:xE/In; SIMÛ4BC.0
00101 FX(/IH/):=FE;1ND:=1;'GoroupRjT; SIMO4COO 00104
LI: 'IF'FR>FS'THEN''GOTO'L3; ...SLMÜ4000
00105 12: 'F0R'I:=1'STEP'l'uNTIL'j4'DO' SIMO4EOO
:..c ... -- 00E10500109 ...--- X(/I,!H/):=XR(/r/);Fx(/IH/):=FR;JND:=2;GoToupRINr; ...SIMO4FOO
L3: 'IF'FR>FH'THEN''GUTO'L4; SIMÜ4GOO - 00110 IFORIIlJSTEI1IUNTILINIOot SIMC4HCO 00110 X(/!,IH/J:=XR(/!fJ;Fx(/IH/):=FR;FH:FR; SIMO4IOO - ...00113-...L4 ...'FOR'I-:=i'STEP'1'UNTILIN'Do'xU(/I/):=x(,1j1H,...-- 51M04J30 00114 CONTRACT(XM,XU,N,XC); SIMO4KOO ...---- 00115....-...-PIN(Xc,N,FKT);Fe:=FKT SIMO4LOO 00117 'IF'FC>FH'THEN''GUTO'L5; SIMO4MOO ---00E18...----...--'F0RJ:=1'STEp'F'UNTiL'N'QO'x(/IIH/).:xC..(,,); ... 00119 FX(/IH/):rFC;rND:=3;GoTcJ1pRNr; SIMO4000 -..---..-...._-_.-...-- .... SOURCE PROGRAM
H
3.
o'
.-:.- .-.
SOURCE PROGRAM
PAGE 001
Sc SOURC STAT.E.MENT
0.0.00.0 ' BEGIN '
SiM0iA0O
00000
'COMMENT' SIMPLEX METHOD;
SIMO1BOO
00.00.0 e INI...GER' I ,.J.,.N,.4-L.,..I.H....IND,.I..S,K;
SiM0iC0O
00001 N:=2;
S!MO1DOO
0000.2
I ß E. GIN I 'RE.AL..'..S..,. . F.S.,.FR.,.F.E..,.FC ;..
SIMO1E0000003
'ARRAV'X(tl:N,l:N+l/),xM,XR,XE,xc,xu(/l:N/),Fx(,l:N+l/);
SIMO1FOO
00004
PRO CE- DURE...BLAN.K1.D...N);.'.VALlJE ' D...N;'INT..N;'GODE';
00008
'PROCEDURE'FIX(D,M,N,X);'VALUESD,M,N,X;IINTEGÈRID,M,N;$REALIX;ICODEI;
O.00.1..3 e PROCE.DUR.E..'.PI.N.(.X.0...t'41F.KT.) ; SiM0...JOG
00014
..'INTEGER'N;'REAL'FKT;'ARRAy'xu;
SIMO1KOO
00017
F ..S.i:M0...LOO
00018
'PROCEDURE'MINMAX(FX,N,FL,FH,IL,IH);
SIMOLMOO
0.0.0..9 q INT...GER'N,lL....¡.H. ;..R..AL..l..F.L.,..F.H.;.S.A.R.R4.v..L.F.x..; S1MO1NOO
00022
. 'BEGIN'FL:='7;Fi-i:=-'7;S!MO1000
00024
SIM0I.POO00024
'BEGIN'SIMO1QOO
0002.4
S :=FX(íI--/);
00025
. 'IF'S >FH'THEN''BEGIN'.FH:=S; .IHIEND'SJM01ROO
0002.8
t;
IL:=i;'ENO....;.S.IMO1..s,o.o
00031
. 'END';SIMO1TOO
00032
END..L.; ... . SIMO1U0O00033
'PROCEDURE'SECMAX(FX,FS,N,IH,IS);
SIMOIVOO
000.34
'-INTEGER'N,
I SIMO1WOO00037
'BEGIN' FS:=-'i;
00038
.I FO...'i-:....1-'STEP'4'UNTIL-'N+1'DO'
SIMO..XO000038
'BEGIN'' IF'I=IH'TH[N' 'GOTO'SKIP;S:=FX(/I/) ; SIMO1XO100040
I IfS
IS:=I;'END....;
51MO..OO
00043
SKIP: 'END' ; 'END' ;SIMOILOO
00045
e PROCEDU'&EN.T.Ro.I.D....X-,XM,N,IH) ;
SIMO2A0O00046
'INTEGER'N,IH;'ARRAY'X,XM;
SIMO2BOO
00048
'-BEGI*'-'REAL-'S....'INTEGER'I,J;
S1MG2COO00050
'FOR'I:=l'STEP'l'UNTIL'N'Do'
SIMO2000
00050
e BEG:fN'SO"
SItIO...ECO 00051'FOR'J:=l'STEP'l'UNTIL'Nl'Do'
SIMO2FOO
00051
.S:=S-X±/-F,-J/-) ;
SIMO2G0000052
XM(/I/):=(S-X(/J,JH/))/N;
SIMO2HOO
00053
'END' ;
SIMO...F0000054
'END';SIMO2JOO
00055
'PROGEDURE'REFLEC-T(-XM,XH,*,.XR-)-;SIlO2KOO
00056
'INTEGER'N;'ARRAY'XM,XH,XR;
SIMO2LOO
00058
&FMO2M0O00058
XR(/I/):=2.5*XM(/J/)-105*XH(/I/p;
SIMO2NOO
OOO59 p PRQ.. ; SFMO200O00060
. 'INTEGER'N;'ARRAY'XM,XR,XE;
SIMO2POO
00062
'FUR'-I:=F'S.T..EP.'..1..'.UN.T..IL'N'Dt3
SIMO..00
00062
XE(tI/):=2*XR(/I/)-XM(/I/);
SIMO2ROO
SOURCE PROGRAM
PAGE 002
Sc
SOURCE SfATEME*T
0006-3 'PROcEDURE'eONfRÂ&T*XM , XH,N , xeì ; S i MO'2 S 00
00064
'JNTEGERN;
'ARRAY'XM,xH,xC;
SIMO2TOO
00066
LFOR.F.:=.FSfEPIi..I.UN.T..I*.I.ND ' .SIMO2U00
00066
xc(/1/):=o.5*(xH(/I/)+xM(/I/n;
SLMO2VOO
00067
PR0&EDURE'NEWSIMP(-X-fXL N);--- SFMO2 WOO00068
'TNTEGER'N;ARRAY'X,XL;
S!MO2XOO
OOCH0
'FOR'J:=F'SfEP'F1UNTI±'N+i'00'
. SIMO 2 YO000070
'FOR'I:=I'STEP'l'UNTIL'N'DO'
SIMO2ZOO
OOO?O
Xí/I,Jí)1Ow5*EXLf/j/)+X(/ 1,J / )) ;
SFMO3AO0
00071
SVSACT(1,8,60);SYSACT(1,12,1);
SIÑO3BOO
000 +3 'eoMMENT' MAfNPROG R AMI
SIMO 000
00073
'FOR'J:=l'STEP'l'UNTIL'N+I'DO'
.SIMO3EOO
O0O3
F0RII:=i.'.S±EPI..HUNTH.'..NI.DO fNREAtO,Xi1+,J-/)); ... SIMO 3 F0000074
OUTSTRING(1,'('INITJAL SIMPIEX')');SYSACT(I,14,1);
.SIMO3GOO
000m
S1 :S1M&3H00
00076
'BEGIN''FOR' I:=1'STEP'l'UNTIL'N'Do'xu(/I/):=x(/!,J/);
SIMO3IOO
000 T 7 P+N(»XU, NFK-T;FX(/J / ):=FKT;
StM03JO0
00079
'END'; .SIMO3KOO
00080
IFOR'J=i"STEP'1'uNTIL"N+-1'Do'
SIM03t00
00080
. 'BEGIN' 'FOR' I :=i' STEP' i 'UNTIL'N'DO'xUL/I/) :=X(/I,J/) ;SIMO3MOO
00 08 i FF(i»i , 10 , O, J); SIM0 3 NO0
00082
'FOR'K:=1'STEP'l'uNTIL'N'Do'FIx(1,5,4,xu(/K/));
SIMO3NIO
00083
BtANK(»1 p 1 ) ; S-1MO 3N2000084
OUTREAL(1,FX(/J/));SYSACT(1,14,1);
SIMO3000
00086
'fND ' ; .SiM03Q00
00087
S2:MINMAX(FX,N,FL,FH,IL,IH);
.SIMO3ROO
00088
'IF'FH-FL('-3 'THEP4G&T0TOP;
S I M03S0000089
SECMAX(FX,FS,N,IH,IS);
SIMO3TOO
00090
ENfR&iDtX , XM*N , 1H11 S I M03U0000091
.'FOR' I:=l'STEP'1'uNTL'N'oO'xu(/I/):=x(/I,IH/);
SIMO3WOO
00092
REFtECT(»XftXU , N,XR)1SIMO3X00
00093
PIN(XR,N,FKT);FR:=FKT;11F'FR>FL'THEN''GOTO'Ll;
SIMO3YOO
00096
EXPÂNS»IONtXMxR , N , X E)'; S IM03i0000097
PIN(XE,N,FKT);FE:=FKT;'IF'FE)FR'THEN''GoTo'L2;
.SIMO4AOO
O0i.O.o 'FOW't:=t'SPEP'1-'uNTiL'N-'Do'xfij , H 1 )1=XEt11»/1»; S I MO 4 BOO
00101
FX(/IH/):=FE;IND:=1;'GOTO'pRINT;
SIMO4COO
0O104
L 1: fF'-FR)FS'1HEN''GU 'T O't3;S1MO4D0O
00105
L2:'FOR'I:=l'STEp'l'UNrIL'N'Do'
.SIMO4EOO
00105
Xt/ I , FHí)XR(1i/11FX(/ «1'Ht):=FR;FND : =2iGO T U'PRTNt;SiMc4FOO
00109
L3:'!F'FR>FH'THEN''GÚTO'L4;
SIMO4GOO
0o1.1O 'FOR'I:=t'STEP '. t'UNTIt'N'DO' . . &iMcY4HOO
00110
X(/I,IH/):=XR(/I/);FX(/JH./):=FR;FH:=FR;
SIMO4IOO
00113
L4 : 'POR'I»:=i"STEP't'tjNT1t'N'D...Xti'(/ i /1:X(tt , I Hi); S I MO .4 JOO00114
CONTRACT(XM,XU,N,XC);
SIMO4KQO
00-115 PIN(XC,NF-K-T1iFC:=fKf; .
SiMO4L0O
00117
'IF'FC>FH'THEN''GOTQ'L5;
SIMO4MOO
00 i LB s i MO4N 00
o
SOURCE PROGRAM
PAGE 003
Sc
SOURCE STATEMENT
00.122 L.5: ' FOR'.I.-: -1 ' STEP 1'UNTII'.Ñ'DO....XU(/4/) :=X( / I ,LL/ ) ; S.I:M04p00
00123
NEWSIMP(X,XU,.N);S!MO4QOO
0.0.1.24 SY-SAC T(1 3-);O U T ST RJNG( I. ,' ( 'NEW S H1PLEX l
SlMO4ROO
00126
SYSACT(i,14,1);'GoTQ'Sl;
.SIMO4SOO
00.128 PRINT:
SYSACT(l,14,3;
.SiM04U0O
00129
'IF'IND=i'THENOUTSTRING(l,'('EXPANSIUN')'j;
SIMO4VOO
00.1.30 I IF ....INO-2THNi.OUT. ( 'REFLECT') ) ;
S1M04W0O
00131
SIMO4XOO
0.0 .1..3.3 F0.R.!..I ; - 1 '.S.T.EP '-1 .UNT 1L .'.N...DO.' XU( 1.1.1..).:
SiMO4YOO
00134
FIX(1,10,O,IH);
SIMO4ZOO
OO.135 a FOR'l( : -4 'STEP '.-1 UNTIL '-N'D O 'FIX (1. , 5...4,XU..../K/)) ;
SIMO5AL0
00136
BLANK(1,1O);OUTREAL(1,Fx(/LH/)J;
SIMO5A2O
00....38 GOTO.' S2;
S1MO5BOO
00139
STOP:SYSACT(1,14,5);OUTSTR1NG(1,1(1CONvERGEa');
SIMO5COO
00-141 a END.' ; V