code wiki / _hdl_build / nx_evolve.nx

nx_evolve.nx

buildroot/runtime/_hdl_build/nx_evolve.nx

14400 B290 linesdepth 5pulls 5 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 2 imports · 0 importers

nx_syscalls.nx nx_tool_run.nx nx_evolve.nx

imports: nx_syscalls.nxnx_tool_run.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 sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ _p sys_write ↻ _fn sys_mmap ↻ sys_write ↻ ev_fit ev_fit_ext sys_mmap ↻ tr_run_capture_to tr_run_capture_tr tr_run_capture_core tr_run_capture_core_owned sys_exit ↻ ev_rand sys_openat_append _fp sys_write ↻ sys_now_realtime_sec sys_mmap ↻ sys_clock_gettime_real sys_close

structs

none

consts

20const K_MAGIC_1000000: i64 = 1000000
21const K_MAGIC_2463534242: i64 = 2463534242
48const EV_FIT_UNREADABLE: i64 = 0 - 1000000000
49const EV_EXT_TIMEOUT_MS: i64 = 60000
50const EV_EXT_OUTCAP: i64 = 65536

functions

22func _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
23func _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
24func _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
25func ev_atoi(s: *u8) -> i64
called by 1: main
35func ev_rand(s: *i64) -> i64
called by 1: main
59func ev_fit_ext(g: *i64, dims: i64, cmd: *u8, pre: *i64) -> i64
called by 1: ev_fit calls 2: sys_mmaptr_run_capture_to
119func ev_fit(g: *i64, dims: i64, target: i64, kind: i64, cmd: *u8, pre: *i64) -> i64
called by 1: main calls 1: ev_fit_ext
131func main(argc: i64, argv: *i64) -> i64