{$R-} {Range checking off} {$B+} {Boolean complete evaluation on} {$S+} {Stack checking on} {$I+} {I/O checking on} {$N+} { numeric coprocessor} {$M 16384,0,655360} {Turbo 3 default stack and heap} Program decmpstr(input,output); (*Prg reads std nw network LST and evaluates wts*) (*Prg is NOT general, only for bindind site inputs,with <=10(for>binary code input)interneurons*) (*sum over all hidden neurons for rel effect of one position on a SINGLE o.n.*) (* within the context of a specific input sequence*) (*LST file must be edited out 1st, input 2nd, all'bias' replaced w0000*) Uses WinCRT; Label 1; Type numptr=^darr; darr=record nnum:real; linker:numptr; end; Var z,l,n,j,k,g,F,ct,basect,first,second,third,seql,ans,opn,flag10,sct, totct :integer; x,y,basevar,ch,query,reply :char; ifil,ifil2,ifil3,ofil,ofil2,ifil4 :text; namei,w,filename,seqstr,teststr :string; a,b,c,d,e,maxwt,sumactwt,sumposwt,relf,f1,f2,f3,f4,f5, maxf,tal,sumoutal,p1actwt,currseqval,currexp,d1,d2,relfA,relfB,relfD, relfC,maxfp,maxfn,totout :single; infline,tstline,tstlinel :string[12]; flag1 :boolean; top1,top2,top3,top4,top5, top6,top7,top8,top9,top10,top11,top12, top13,top14,top15,top16,top17,top18,top19,top20, top21,top22,top23,top24,top25,top26,top27,top28,top29, top30,top31,top32,top33,frac,frac1,top,top34,top35,top36,top37,top38, top39,top40,top41,top42,top43,top44,top45, top46,top47,top48,top49,top50,top51,top52,top53, top54,top55,top56,top57,top58,top59,top60,top61,top62, top63,top64,top65,top66,top67,top68,top69,top70,top71,top72, top73,top74,top75,top76,top77,top78,top79, top80,top81,top82,top83,top84,top85,top86,top87, top88,top89,top90,top91,top92,top93,top94,top95,top96, top97,top98,top99,top100 :numptr; wtout :array[0..101] of single; (*=second+1*) actwt :numptr; sumout :array[1..3328] of single; (*=first/4*) artfrac :array[1..100] of single; (*=second*) (**********************************************************************) Procedure Initialize; Begin (* writeln('Enter the name of the modified LST input file'); readln(namei); *) NAMEI:='d:\pros\thirds\3\1c.lst'; assign(ifil,namei); reset(ifil); assign(ofil,'dec'); rewrite(ofil); (* writeln('Enter # in 1st, 2nd<=100,and 3rd layers, and first again'); readln(first,second,third,seql);*) first:=13312; second:=100; third:=1; seql:=3328; (*=first/4*) if second>100 then writeln('second layer out of range'); (* writeln('Enter the name of the nna file for example being decompiled'); readln(namei);*) namei:='d:\pros\thirds\3\tst311.nna' ; assign(ifil2,namei); reset(ifil2); (* writeln('Enter name of nnr file chk correct format'); readln(namei);*) NAMEI:='d:\pros\thirds\3\tst311.nn'; assign(ifil3,namei); reset(ifil3); readln(ifil3,currseqval); (*Specific for single output*) ans:=1; sumoutal:=0; totout:=0; totct:=1; for n:=1 to seql do sumout[n]:=0; flag10:=0; sct:=1; opn:=1; relfA:=0; relfB:=0; relfC:=0; flag1:=false; end; (***********************************************************************) Procedure Readin; var val,mult :real; d :longint; ctr :integer; Begin n:=0; k:=0; l:=1; { for n:=1 to second do for k:=1 to (first +1) do frac[k,n]:=0;} for k:=1 to second do begin wtout[k]:=0; end; wtout[0]:=0; { for k:=1 to (seql+1) do for n:=1 to second do actwt[k,n]:=0;} case second of 1:tstlinel:=' PE: 13315'; (*=first+3*) 2:tstlinel:=' PE: 13316'; 3:tstlinel:=' PE: 13317'; 4:tstlinel:=' PE: 13318'; 5:tstlinel:=' PE: 13319'; 6:tstlinel:=' PE: 13320'; 7:tstlinel:=' PE: 13321'; 8:tstlinel:=' PE: 13322'; 9:tstlinel:=' PE: 13323'; 10:tstlinel:=' PE: 13324'; 11:tstlinel:=' PE: 13325'; 12:tstlinel:=' PE: 13326'; 13:tstlinel:=' PE: 13327'; 14:tstlinel:=' PE: 13328'; 15:tstlinel:=' PE: 13329'; 16:tstlinel:=' PE: 13330'; 17:tstlinel:=' PE: 13331'; 18:tstlinel:=' PE: 13332'; 19:tstlinel:=' PE: 13333'; 20:tstlinel:=' PE: 13334'; 21:tstlinel:=' PE: 13335'; 22:tstlinel:=' PE: 13336'; 23:tstlinel:=' PE: 13337'; 24:tstlinel:=' PE: 13338'; (*=end of second*) 25:tstlinel:=' PE: 13339'; (*1+end of second*) 26:tstlinel:=' PE: 13340'; 27:tstlinel:=' PE: 13341'; 28:tstlinel:=' PE: 13342'; 29:tstlinel:=' PE: 13343'; 30:tstlinel:=' PE: 13344'; 31:tstlinel:=' PE: 13345'; 32:tstlinel:=' PE: 13346'; 33:tstlinel:=' PE: 13347'; 34:tstlinel:=' PE: 13348'; 35:tstlinel:=' PE: 13349'; 36:tstlinel:=' PE: 13350'; 37:tstlinel:=' PE: 13351'; 38:tstlinel:=' PE: 13352'; 39:tstlinel:=' PE: 13353'; 40:tstlinel:=' PE: 13354'; 41:tstlinel:=' PE: 13355'; 42:tstlinel:=' PE: 13356'; 43:tstlinel:=' PE: 13357'; 44:tstlinel:=' PE: 13358'; 45:tstlinel:=' PE: 13359'; 46:tstlinel:=' PE: 13360'; 47:tstlinel:=' PE: 13361'; 48:tstlinel:=' PE: 13362'; 49:tstlinel:=' PE: 13363'; 50:tstlinel:=' PE: 13364'; 51:tstlinel:=' PE: 13365'; 52:tstlinel:=' PE: 13366'; 53:tstlinel:=' PE: 13367'; 54:tstlinel:=' PE: 13368'; 55:tstlinel:=' PE: 13369'; 56:tstlinel:=' PE: 13370'; 57:tstlinel:=' PE: 13371'; 58:tstlinel:=' PE: 13372'; 59:tstlinel:=' PE: 13373'; 60:tstlinel:=' PE: 13374'; 61:tstlinel:=' PE: 13375'; 62:tstlinel:=' PE: 13376'; 63:tstlinel:=' PE: 13377'; 64:tstlinel:=' PE: 13378'; 65:tstlinel:=' PE: 13379'; 66:tstlinel:=' PE: 13380'; 67:tstlinel:=' PE: 13381'; 68:tstlinel:=' PE: 13382'; 69:tstlinel:=' PE: 13383'; 70:tstlinel:=' PE: 13384'; 71:tstlinel:=' PE: 13385'; 72:tstlinel:=' PE: 13386'; 73:tstlinel:=' PE: 13387'; 74:tstlinel:=' PE: 13388'; 75:tstlinel:=' PE: 13389'; 76:tstlinel:=' PE: 13390'; 77:tstlinel:=' PE: 13391'; 78:tstlinel:=' PE: 13392'; 79:tstlinel:=' PE: 13393'; 80:tstlinel:=' PE: 13394'; 81:tstlinel:=' PE: 13395'; 82:tstlinel:=' PE: 13396'; 83:tstlinel:=' PE: 13397'; 84:tstlinel:=' PE: 13398'; 85:tstlinel:=' PE: 13399'; 86:tstlinel:=' PE: 13400'; 87:tstlinel:=' PE: 13401'; 88:tstlinel:=' PE: 13402'; 89:tstlinel:=' PE: 13403'; 90:tstlinel:=' PE: 13404'; 91:tstlinel:=' PE: 13405'; (*=end of second*) 92:tstlinel:=' PE: 13406'; (*1+end of second*) 93:tstlinel:=' PE: 13407'; 94:tstlinel:=' PE: 13408'; 95:tstlinel:=' PE: 13409'; 96:tstlinel:=' PE: 13410'; 97:tstlinel:=' PE: 13411'; 98:tstlinel:=' PE: 13412'; 99:tstlinel:=' PE: 13413'; 100:tstlinel:=' PE: 13414'; end;(*case*) repeat (****case st would allow var hidden****) readln(ifil,infline); until infline=tstlinel; readln(ifil); readln(ifil); readln(ifil); readln(ifil); readln(ifil); for l:=1 to third do begin for k:=0 to (second) do begin readln(ifil,a,b,c,w); wtout[k]:=c; end; readln(ifil); readln(ifil); readln(ifil); readln(ifil); readln(ifil); readln(ifil); end; reset(ifil); for k:=1 to second do (*kindexes interneuron*) begin case second of 1:tstlinel:=' PE: 13314'; (*=first+2*) 2:tstlinel:=' PE: 13315'; 3:tstlinel:=' PE: 13316'; 4:tstlinel:=' PE: 13317'; 5:tstlinel:=' PE: 13318'; 6:tstlinel:=' PE: 13319'; 7:tstlinel:=' PE: 13320'; 8:tstlinel:=' PE: 13321'; 9:tstlinel:=' PE: 13322'; 10:tstlinel:=' PE: 13323'; 11:tstlinel:=' PE: 13324'; 12:tstlinel:=' PE: 13325'; 13:tstlinel:=' PE: 13326'; 14:tstlinel:=' PE: 13327'; 15:tstlinel:=' PE: 13328'; 16:tstlinel:=' PE: 13329'; 17:tstlinel:=' PE: 13330'; 18:tstlinel:=' PE: 13331'; 19:tstlinel:=' PE: 13332'; 20:tstlinel:=' PE: 13333'; 21:tstlinel:=' PE: 13334'; 22:tstlinel:=' PE: 13335'; 23:tstlinel:=' PE: 13336'; 24:tstlinel:=' PE: 13337'; (*=end of second*) 25:tstlinel:=' PE: 13338'; (*1+end of second*) 26:tstlinel:=' PE: 13339'; 27:tstlinel:=' PE: 13340'; 28:tstlinel:=' PE: 13341'; 29:tstlinel:=' PE: 13342'; 30:tstlinel:=' PE: 13343'; 31:tstlinel:=' PE: 13344'; 32:tstlinel:=' PE: 13345'; 33:tstlinel:=' PE: 13346'; 34:tstlinel:=' PE: 13347'; 35:tstlinel:=' PE: 13348'; 36:tstlinel:=' PE: 13349'; 37:tstlinel:=' PE: 13350'; 38:tstlinel:=' PE: 13351'; 39:tstlinel:=' PE: 13352'; 40:tstlinel:=' PE: 13353'; 41:tstlinel:=' PE: 13354'; 42:tstlinel:=' PE: 13355'; 43:tstlinel:=' PE: 13356'; 44:tstlinel:=' PE: 13357'; 45:tstlinel:=' PE: 13358'; 46:tstlinel:=' PE: 13359'; 47:tstlinel:=' PE: 13360'; 48:tstlinel:=' PE: 13361'; 49:tstlinel:=' PE: 13362'; 50:tstlinel:=' PE: 13363'; 51:tstlinel:=' PE: 13364'; 52:tstlinel:=' PE: 13365'; 53:tstlinel:=' PE: 13366'; 54:tstlinel:=' PE: 13367'; 55:tstlinel:=' PE: 13368'; 56:tstlinel:=' PE: 13369'; 57:tstlinel:=' PE: 13370'; 58:tstlinel:=' PE: 13371'; 59:tstlinel:=' PE: 13372'; 60:tstlinel:=' PE: 13373'; 61:tstlinel:=' PE: 13374'; 62:tstlinel:=' PE: 13375'; 63:tstlinel:=' PE: 13376'; 64:tstlinel:=' PE: 13377'; 65:tstlinel:=' PE: 13378'; 66:tstlinel:=' PE: 13379'; 67:tstlinel:=' PE: 13380'; 68:tstlinel:=' PE: 13381'; 69:tstlinel:=' PE: 13382'; 70:tstlinel:=' PE: 13383'; 71:tstlinel:=' PE: 13384'; 72:tstlinel:=' PE: 13385'; 73:tstlinel:=' PE: 13386'; 74:tstlinel:=' PE: 13387'; 75:tstlinel:=' PE: 13388'; 76:tstlinel:=' PE: 13389'; 77:tstlinel:=' PE: 13390'; 78:tstlinel:=' PE: 13391'; 79:tstlinel:=' PE: 13392'; 80:tstlinel:=' PE: 13393'; 81:tstlinel:=' PE: 13394'; 82:tstlinel:=' PE: 13395'; 83:tstlinel:=' PE: 13396'; 84:tstlinel:=' PE: 13397'; 85:tstlinel:=' PE: 13398'; 86:tstlinel:=' PE: 13399'; 87:tstlinel:=' PE: 13400'; 88:tstlinel:=' PE: 13401'; 89:tstlinel:=' PE: 13402'; 90:tstlinel:=' PE: 13403'; 91:tstlinel:=' PE: 13404'; (*=end of second*) 92:tstlinel:=' PE: 13405'; (*1+end of second*) 93:tstlinel:=' PE: 13406'; 94:tstlinel:=' PE: 13407'; 95:tstlinel:=' PE: 13408'; 96:tstlinel:=' PE: 13409'; 97:tstlinel:=' PE: 13410'; 98:tstlinel:=' PE: 13411'; 99:tstlinel:=' PE: 13412'; 100:tstlinel:=' PE: 13413'; end;(*case*) repeat readln(ifil,infline); until infline=tstline; readln(ifil); readln(ifil); readln(ifil); readln(ifil); readln(ifil); readln(ifil,a,b,c,w); new(frac1); new(frac); frac^.linker:=nil; frac^.nnum:=c; artfrac[k]:=c; (*reads in bias for each middle neuron*) frac^.linker:=frac; frac1:=frac; case k of 1:top1:=frac; (*sets ptr to each set of input wts for ea middle neuron,includes bias at pos1*) 2:top2:=frac; 3:top3:=frac; 4:top4:=frac; 5:top5:=frac; 6:top6:=frac; 7:top7:=frac; 8:top8:=frac; 9:top9:=frac; 10:top10:=frac; 11:top11:=frac; 12:top12:=frac; 13:top13:=frac; 14:top14:=frac; 15:top15:=frac; 16:top16:=frac; 17:top17:=frac; 18:top18:=frac; 19:top19:=frac; 20:top20:=frac; 21:top21:=frac; 22:top22:=frac; 23:top23:=frac; 24:top24:=frac; 25:top25:=frac; 26:top26:=frac; 27:top27:=frac; 28:top28:=frac; 29:top29:=frac; 30:top30:=frac; 31:top31:=frac; 32:top32:=frac; 33:top33:=frac; 34:top34:=frac; (*sets ptr to each set of input wts for ea middle neuron,includes bias at pos1*) 35:top35:=frac; 36:top36:=frac; 37:top37:=frac; 38:top38:=frac; 39:top39:=frac; 40:top40:=frac; 41:top41:=frac; 42:top42:=frac; 43:top43:=frac; 44:top44:=frac; 45:top45:=frac; 46:top46:=frac; 47:top47:=frac; 48:top48:=frac; 49:top49:=frac; 50:top50:=frac; 51:top51:=frac; 52:top52:=frac; 53:top53:=frac; 54:top54:=frac; 55:top55:=frac; 56:top56:=frac; 57:top57:=frac; 58:top58:=frac; 59:top59:=frac; 60:top60:=frac; 61:top61:=frac; 62:top62:=frac; 63:top63:=frac; 64:top64:=frac; 65:top65:=frac; 66:top66:=frac; 67:top67:=frac; 68:top68:=frac; (*sets ptr to each set of input wts for ea middle neuron,includes bias at pos1*) 69:top69:=frac; 70:top70:=frac; 71:top71:=frac; 72:top72:=frac; 73:top73:=frac; 74:top74:=frac; 75:top75:=frac; 76:top76:=frac; 77:top77:=frac; 78:top78:=frac; 79:top79:=frac; 80:top80:=frac; 81:top81:=frac; 82:top82:=frac; 83:top83:=frac; 84:top84:=frac; 85:top85:=frac; 86:top86:=frac; 87:top87:=frac; 88:top88:=frac; 89:top89:=frac; 90:top90:=frac; 91:top91:=frac; 92:top92:=frac; 93:top93:=frac; 94:top94:=frac; 95:top95:=frac; 96:top96:=frac; 97:top97:=frac; 98:top98:=frac; 99:top99:=frac; 100:top100:=frac; end; for n:=1 to (first ) do (*reads input wts to ea middle neuron*) begin new(frac); readln(ifil,a,b,c,w); frac^.linker:=nil; frac^.nnum:=c; frac1^.linker:=frac; frac1:=frac; end; { case k of 1:top:=top1; 2:top:=top2; 3:top:=top3; 4:top:=top4; 5:top:=top5; 6:top:=top6; 7:top:=top7; 8:top:=top8; 9:top:=top9; 10:top:=top10; 11:top:=top11; 12:top:=top12; 13:top:=top13; 14:top:=top14; 15:top:=top15; 16:top:=top16; 17:top:=top17; 18:top:=top18; 19:top:=top19; 20:top:=top20; 21:top:=top21; 22:top:=top22; 23:top:=top23; 24:top:=top24; 25:top:=top25; 26:top:=top26; 27:top:=top27; 28:top:=top28; 29:top:=top29; 30:top:=top30; 31:top:=top31; 32:top:=top32; 33:top:=top33; end; frac:=top; if frac<>nil then begin while frac^.linker<>nil do begin val:=frac^.nnum; write(val,' '); frac:=frac^.linker; end; val:=frac^.nnum; write(val); end;} end;(*for k*) n:=0; z:=0; relf:=0; sumactwt:=0; while n<(first+1) do (* chk first or first + 1 *) begin repeat read(ifil2,ch); until ch in ['0','1']; n:=succ(n); if ch='0'then mult:=0 else mult:=1; for k:=1 to second do begin case k of 1:top:=top1; 2:top:=top2; 3:top:=top3; 4:top:=top4; 5:top:=top5; 6:top:=top6; 7:top:=top7; 8:top:=top8; 9:top:=top9; 10:top:=top10; 11:top:=top11; 12:top:=top12; 13:top:=top13; 14:top:=top14; 15:top:=top15; 16:top:=top16; 17:top:=top17; 18:top:=top18; 19:top:=top19; 20:top:=top20; 21:top:=top21; 22:top:=top22; 23:top:=top23; 24:top:=top24; 25:top:=top25; 26:top:=top26; 27:top:=top27; 28:top:=top28; 29:top:=top29; 30:top:=top30; 31:top:=top31; 32:top:=top32; 33:top:=top33; 34:top:=top34; 35:top:=top35; 36:top:=top36; 37:top:=top37; 38:top:=top38; 39:top:=top39; 40:top:=top40; 41:top:=top41; 42:top:=top42; 43:top:=top43; 44:top:=top44; 45:top:=top45; 46:top:=top46; 47:top:=top47; 48:top:=top48; 49:top:=top49; 50:top:=top50; 51:top:=top51; 52:top:=top52; 53:top:=top53; 54:top:=top54; 55:top:=top55; 56:top:=top56; 57:top:=top57; 58:top:=top58; 59:top:=top59; 60:top:=top60; 61:top:=top61; 62:top:=top62; 63:top:=top63; 64:top:=top64; 65:top:=top65; 66:top:=top66; 67:top:=top67; 67:top:=top67; 68:top:=top68; 69:top:=top69; 70:top:=top70; 71:top:=top71; 72:top:=top72; 73:top:=top73; 74:top:=top74; 75:top:=top75; 76:top:=top76; 77:top:=top77; 78:top:=top78; 79:top:=top79; 80:top:=top80; 81:top:=top81; 82:top:=top82; 83:top:=top83; 84:top:=top84; 85:top:=top85; 86:top:=top86; 87:top:=top87; 88:top:=top88; 89:top:=top89; 90:top:=top90; 91:top:=top91; 92:top:=top92; 93:top:=top93; 94:top:=top94; 95:top:=top95; 96:top:=top96; 97:top:=top97; 98:top:=top98; 99:top:=top99; 100:top:=top100; end; if n=1 then begin frac:=top; frac:=frac^.linker; val:=frac^.nnum; (*first of input wts for ea of middle neuron*) if val=0 then val:=0.0000001; val:=(mult)*(val); frac^.nnum:=val; (* if input neuron inactive , ch wt to 0*) end else begin frac:=top; if n<=(first)then for ctr:=1 to (n) do frac:=frac^.linker ; (*positions ptr to neutralize inactive inputs*) val:=frac^.nnum; if val=0 then val:=0.0000001; val:=(mult)*(val); frac^.nnum:=(val); end; end; (*for k*) end;(*while n*) { top:=top1; frac:=top; while (frac<>nil) and (frac^.linker<>nil) do for n:=1 to 4026 do begin writeln(frac^.nnum); frac:=frac^.linker; end; READLN;} end; (***********************************************************************) Procedure Calc; Label 2; Var topp :numptr; val1 :real; Begin relf:=0; for k:=1 to second do (*computes single input effect thru all i.n.*) begin case k of 1:topp:=top1; 2:topp:=top2; 3:topp:=top3; 4:topp:=top4; 5:topp:=top5; 6:topp:=top6; 7:topp:=top7; 8:topp:=top8; 9:topp:=top9; 10:topp:=top10; 11:topp:=top11; 12:topp:=top12; 13:topp:=top13; 14:topp:=top14; 15:topp:=top15; 16:topp:=top16; 17:topp:=top17; 18:topp:=top18; 19:topp:=top19; 20:topp:=top20; 21:topp:=top21; 22:topp:=top22; 23:topp:=top23; 24:topp:=top24; 25:topp:=top25; 26:topp:=top26; 27:topp:=top27; 28:topp:=top28; 29:topp:=top29; 30:topp:=top30; 31:topp:=top31; 32:topp:=top32; 33:topp:=top33; 34:topp:=top34; (*sets ptr to each set of input wts for ea middle neuron,includes bias at pos1*) 35:topp:=top35; 36:topp:=top36; 37:topp:=top37; 38:topp:=top38; 39:topp:=top39; 40:topp:=top40; 41:topp:=top41; 42:topp:=top42; 43:topp:=top43; 44:topp:=top44; 45:topp:=top45; 46:topp:=top46; 47:topp:=top47; 48:topp:=top48; 49:topp:=top49; 50:topp:=top50; 51:topp:=top51; 52:topp:=top52; 53:topp:=top53; 54:topp:=top54; 55:topp:=top55; 56:topp:=top56; 57:topp:=top57; 58:topp:=top58; 59:topp:=top59; 60:topp:=top60; 61:topp:=top61; 62:topp:=top62; 63:topp:=top63; 64:topp:=top64; 65:topp:=top65; 66:topp:=top66; 67:topp:=top67; 68:topp:=top68; 69:topp:=top69; 70:topp:=top70; 71:topp:=top71; 72:topp:=top72; 73:topp:=top73; 74:topp:=top74; 75:topp:=top75; 76:topp:=top76; 77:topp:=top77; 78:topp:=top78; 79:topp:=top79; 80:topp:=top80; 81:topp:=top81; 82:topp:=top82; 83:topp:=top83; 84:topp:=top84; 85:topp:=top85; 86:topp:=top86; 87:topp:=top87; 88:topp:=top88; 89:topp:=top89; 90:topp:=top90; 91:topp:=top91; 92:topp:=top92; 93:topp:=top93; 94:topp:=top94; 95:topp:=top95; 96:topp:=top96; 97:topp:=top97; 98:topp:=top98; 99:topp:=top99; 100:topp:=top100; end; frac:=topp; frac:=frac^.linker; (*move ptr past bias val*) for j:=1 to (first) do begin sumactwt:=sumactwt+frac^.nnum; (*sum all active wts to each middle neuron in turn*) frac:=frac^.linker; end; frac:=topp; (* frac:=frac^.linker; *) (*move ptr past bias val*) if (frac<>nil) and (frac^.linker<>nil) then for ct:=1 to totct do begin frac:=frac^.linker; end; val1:=frac^.nnum; (*CHECK INDEXING*) if val1<>0 then sumactwt:=sumactwt-0.30*val1 (* reduce sum by 15% of current active input neuron designated by 'ans'*) else begin relf:=-1000; k:=second; (* if 'ans' calls inactice input, set relf= -1000 , go to next input*) goto 2; end; (* f1:=((actwt[ans,k]+artfrac[k]/seql)/(sumactwt+artfrac[k]));*) f2:=wtout[k]/(1+exp(-(sumactwt+artfrac[k]))); (*wt-prod of k middle neuron to output neuron*) (*f3:=f2/wtout[k];*) (* f4:=(f3-0.5)/abs(f3-0.5); f5:=(f2*(1-f4)/seql) +f2*f4*f1; *) relf:=relf + f2 +wtout[0]/(second); (*total sum to output neuron from all middle neurons, OUTPUT BIAS included*) 2: sumactwt:=0; end;(*for k*) end; (*********************************************************************) (*main*) Begin Initialize; Readin; 1: Calc; (* if ((totct=1) or (totct mod 3 =1)) then relfA:=relf else if ((totct=2) or (totct mod 3=2)) then relfB:=relf else if (totct mod 3 =0) then relfC:=relf ; if ((relfA= -1000)and(relfB= -1000)and(relfC= -1000)) then begin sumout[ans]:= -1000; ans:=ans+1; if ((totct=1) or (totct mod 3 =1)) then relfC:=relfC+1000 else if ((totct=2) or (totct mod 3=2)) then relfA:=relfA+1000 else if (totct mod 3 =0) then relfB:=relfB+1000; end else *) if relf<> -1000 then begin sumout[ans]:=relf; ans:=ans+1 end; totct:=succ(totct); (* flag1:=false; if totct=16351 then begin writeln(ans,' ',totct); READLN; end; *) if ans<3329 then (*=first/4 + 1*) goto 1; for k:=1 to (seql) do if sumout[k]= -1000 then sumout[k]:=0 else begin sumout[k]:=1/(1+exp(-(sumout[k]))); (*computed output from each active input neuron reduced 15% at input*) sumout[k]:=currseqval-sumout[k] (* computed change from real output due to single input perturbation*) end; maxfp:=sumout[1]; maxfn:=sumout[1]; n:=0; ct:=0; for k:=1 to seql do if sumout[k]>0 then n:=n+1 else ct:=ct+1; for k:=1 to (seql) do begin if sumout[k]>0 then if maxfpsumout[k] then maxfn:=sumout[k]; end; maxfn:=-maxfn; if maxfp>maxfn then maxf:=maxfp else maxf:=maxfn; for k:= 1 to (seql) do sumout[k]:= sumout[k]/maxf; (* MUST REMOVE if want actual values*) for k:=1 to (seql) do if abs(sumout[k])>0.75 then writeln(ofil,'output neuron',opn,' position',' ',k,' ',sumout[k]); writeln(ofil, 'Maxf is ',maxf); for k:=1 to seql do totout:= totout+sumout[k]; writeln(ofil,totout); close(ifil2); close(ifil3); close(ofil); close(ifil); end.