code wiki / _hdl_build / nx_evolve.nx

nx_evolve.nx

buildroot/runtime/_hdl_build/nx_evolve.nx

7763 B167 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_evolve.nx -- X-EVO-001: the EVOLUTION HARNESS (operator self-sufficiency arc; configured from the EC taxonomy evo_params.tsv, not invention). Rung 1 validates the MACHINERY on a fitness with a KNOWN optimum (you cannot trust an optimizer you cannot verify) -- then rung 2 swaps fitness_id for a GATE permil (the exceed: we grow evaluators). Every EC operator from the taxonomy, wired: population = candidate integer vectors selection = TOURNAMENT (best-of-k) mutation = per-gene +-1 at mutation_rate elitism = best carried unchanged generation = one loop; best logged (lineage) termination = convergence streak seeding = xorshift64 from cfg seed (FIXED-PER-RUN reproducibility law) diversity = tournament_k tunes greed<->variety (the niching knob) fitness 0 = -sphere(target) (unimodal, optimum known = target vector, fitness 0) fitness 1 = -rastrigin-ish (multimodal: -(sum (g-t)^2 + 8*(g!=t)) -- many basins) cfg ints: pop gens mut_rate_inv tour_k dims seed fitness_id target (mut_rate = 1/mut_rate_inv per gene per gen). Durable: EVOLVE-GEN + EVOLVE rows -> knowledge/status/evolve.log. Exit 0 = converged to optimum; 1 = did not. argv[1..]=cfg override ints (gates drive scratch configs deterministically). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_evolve.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ev_atoi _p sys_write sys_mmap ev_rand ev_fit sys_openat_append sys_exit _fp sys_write ↻ _fn sys_mmap ↻ sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_close

structs

none

consts

19const K_MAGIC_1000000: i64 = 1000000
20const K_MAGIC_2463534242: i64 = 2463534242

functions

21func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
22func _fp(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
23func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
24func ev_atoi(s: *u8) -> i64
called by 1: main
34func ev_rand(s: *i64) -> i64
called by 1: main
45func ev_fit(g: *i64, dims: i64, target: i64, kind: i64) -> i64
called by 1: main
56func main(argc: i64, argv: *i64) -> i64