loadNet ("win17-20relu-10relu-5relu-1sig.net")
loadPattern ("tra.pat")
loadPattern ("val.pat")
resfile := "test.res"
ep := 0
initNet ()
while(TRUE)
 setPattern ("tra.pat")
 for i := 1 to 10 do
  trainNet ()
 endfor

 setPattern ("val.pat")
#testNet ()
 saveResult (resfile, 1, PAT, FALSE, TRUE, "create")
 command := "/home/reczko/doc/foukas/dat/foukas/snns/SNNSv4.3/tools/sources/analyze -s -e WTA -i " + resfile + " | awk -f /home/reczko/doc/foukas/dat/foukas/snns/SNNSv4.3/tools/sources/analyze.gawk"
 execute(command, w, r, u, e)
 print("ep: ",ep, "wrong: ",w, " right: ",r, " unknown: ",u, " error: ",e)
 saveNet("tmp.net")
 if((ep > 0)&&(r<lr)) break
 ep := ep + 1
 lr := r
endwhile
