function run(ignore1,ignore2,ignore3,ignore4,ignore5) { return run1(Era,Repeats,Top,Seed,Maximize); } function seeded() { srand(Seed ? Seed : 1) } function run1(era,repeats,top,seed,maximize, e,score) { seeded(); while(repeats--) { for(e=1;e<=era;e++) { Cache[0]=e score=step() keep(top,score,maximize); guess() } newGuesses(best); } } function newGuesses() { # adjust the guesses return 1 } function keep(top,sscore,maximize) { return 1 # is "s" score better than "top" n, keep it and lose one old item } function guess() { # set some subset of the cache values return 1 } function between(min,max) { if (max==min) {return min} else {return min+ ((max-min)*rand())}} function real(min,max) { return between(min,max)} function integer(min,max) { return round(between(min,max))} function round(x) { return int(x+0.5) } function nominal(range) { return ordinal(range) } function ordinal(range, i,j,dim) { dim=range[0]; j=round(dim*rand()) return range[j]; } function normal(m,s) { return m+box_muller()*s; } function box_muller(m,s, n,x1,x2,w) { w=1; while (w >= 1) { x1= 2.0 * rand() - 1; x2= 2.0 * rand() - 1; w = x1*x1 + x2*x2}; w = sqrt((-2.0 * log(w))/w); return x1 * w; } function within(min,max,bias) { return min + (max - min)*rand()^bias # if bias >= 1 then mean = (max+min)*B is towards to "min" end # BIAS mean # ---- ---- # 1 0.5 # 2 0.33 # 3 0.25 # 4 0.2 # 5 0.17 # 6 0.14 # 7 0.13 # 8 0.11 # 9 0.10 # 10 0.09 # 0.5 0.67 # 0.33 0.75 # 0.25 0.8 # 0.2 0.83 # 0.167 0.86 # 0.14 0.87 # 0.125 0.89 # 0.11 0.9 # 0.10 0.91 } function def(r,s, n) { n=split(s,r,/,/); r[0]=n } function saya(s,a,q1,q2,eol, com,i,j,n,tmp,str,sep) { com="sort #" rand(); q1= q1 ? "\"" : ""; q2= q2 ? "\"" : ""; for(i in a) { sep=""; str= s"["; n=split(i,tmp,SUBSEP); for(j=1;j<=n;j++) { str=str sep q1 tmp[j] q1; sep=","; } print str "] = " q2 a[i] q2 eol | com; }; close(com); }