490
UNTIL (NORM(Grad)<DDELTA) or (it=max_it) or ( (abs(norm(x)-norm(x_ant))<DDelta) and (abs(f_ant-fii)<DDelta));
END;
PROCEDURĘ INITIALIZE;
VAR I,J:INTEGER;
BEGIN
FOR I:=2 TO N DO FOR J:=l TO N DO BEGIN IDEN[I,J]:=0.0;H[I,J]:=0.0;JAC[I,J]:=0.0 END; FOR I:=2 TO N DO BEGIN X[I]:=0.0;GRAD[I]:=0.0;IDEN[I,I]:=1.0; END;
END;
PROCEDURĘ PRINT SOLUTION;
BEGIN
Power:=PNORM(Dełta*Sqrt(Best[4])-best[3]);Alpha:=2.0*PNORM(-Best[3]);
BESTCOST :=Fun(best)-pen*ck-bar/ck;
WRITE(T1 jj,' ',C0:2:2,' ',C1:2:2,' \C2:3:1,' \C3:3:1,' ',C4:3:1,' ’,C5:3:1,’ ',LAMBDA:2:2,’ \DELTA:2:2,' ’,F0:2:2,'');
WRJTE(tl,Best[4):2:0,' ^WRITEOn.BESTlSJ.^.S,' ^WRITECn.BESTp]*^,''); WRITE(T1,BEST[ 1 ]:6:2,' *);WRITE(Tl,BESTCOST:6:4,’ ^WRITECTl.POWER^iS,"); WRITELN(T1,ALPHA:2:5,''); end;
ProcedurÄ™ INPUT DATA;
BEGIN
READ(F 1 ,C0);READ(F 1 ,C 1 );RE AD(F 1 ,C2);READ(F 1 ,C3);READ(F 1 ,C4);READ(F 1 ,C5);
RE AD(F 1 ,Lambda);READ(F 1 ,Delta);RE AD(F 1 ,F0);RE AD(F 1 ,PP);READ(F 1 ,CC);
READ(F 1 ,Powlb);READ(F 1,Alphaub);READLN(F 1 ,X[ 1 ]); {*** x(l]=T isfixed ***}
END;
Function count_active(x:nxl):integer, var j:integer, be gin
Power:=PNORM(DelU*Sqrt(x[4])-xI3 ]); Alpha. =2.0*PNORM(-x[3])J: =0; if Power <= Powlb then j:=j+I;if Alpha >= Alphaub then j:=j+l; if Power <= CC/x(2] then j:=j+l;if x[4]*x(2] >= x[l]*PP then j:=j+l; count active:=j; end;
ProcedurÄ™ penalty barrier(var x:nxl); var fbest,fk,beta:extended; ok:boolean; iterations: integer, xbest:nxl; begin
ck:=1 ;iterations:=0;
beta:=10;ok:=false;for i:=l to n do xbest[i]:=x[i];fbest:=le20;bestck:=ck; repeat
iterations:=iterations+1 ;limit.=count active(X)+1;{*** for restarts in BFGS ***} BFGS(X,limit);fk:=fun(x)-pen*ck-bar/ck;gra(x);
{********* Termination criteria based on feasibility and tightness of bounds (tighter bounds less strict) ***♦}
if (abs(pen*ck+bar/ck)<DDelta) or (abs(fk-fbest)<=max(0.3,mini/100)) or (iterations>10) then ok:=true else ck:=beta*ck;