code wiki / _hdl_build / nx_evo_cross.nx

nx_evo_cross.nx

buildroot/runtime/_hdl_build/nx_evo_cross.nx

9368 B191 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic evo
docsdependenciesstructsconstsfunctions

about

nx_evo_cross.nx -- EVOLUTIONARY SYNTHESIS roadmap RUNG 1: CROSSOVER (X-AUT-006M). nx_evo_synth (006L) is a (1+lambda) ES: elite + mutants-of-the-ONE-best = a hill climber that stalls in local optima (it left target 1000 at NEAR dist=15). This organ is a real GENETIC ALGORITHM: a DIVERSE population, TOURNAMENT selection, and ONE-POINT CROSSOVER (recombine two parents) + mutation + elitism. Crossover mixes building blocks from different lineages, so the search escapes the basins that trap the mutation-only climber. Same I/O + champion-materialization as 006L, so the two are a head-to-head MEASURED-EXCEED pair. nx_evo_cross <champion_basename> <start> <target> <seed> genome = EVO_L ops; pop EVO_P; gens EVO_G; tournament size EVO_T. Deterministic seeded LCG. Prints FOUND/NEAR gen dist result genome; writes the DISCOVERED champion organ (runtime/_hdl_build/<name>.nx) for compile+run verification. MEASURED-EXCEED gate (no-false-green): on a target the 006L baseline leaves NEAR (e.g. 1000), this GA reaches dist=0 (FOUND) and the champion COMPILES+RUNS to the target -- a measured improvement, pos vs the documented baseline NEAR. Sovereign, no gcc/.sh. HONEST SCOPE: still linear op-list genomes / distance fitness; adds crossover+tournament+diversity. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_evo_cross.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 evc_p sys_write evc_atoi sys_mmap evc_randfill evc_rand evc_eval evc_abs evc_tourney evc_rand ↻ evc_rand ↻ evc_catn evc_catn ↻ sys_mmap ↻ sys_write ↻ evc_cat sys_openat_wr sys_close

structs

none

consts

22const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757
23const EVO_MAGIC_3037000493: i64 = 3037000493
24const EVO_MAGIC_2654435761: i64 = 2654435761
25const EVO_MAGIC_12345: i64 = 12345
26const EVO_MAGIC_1000000000: i64 = 1000000000
27const EVO_MAGIC_65536: i64 = 65536
29const EVO_L: i64 = 6
30const EVO_P: i64 = 64
31const EVO_G: i64 = 400
32const EVO_T: i64 = 4 // tournament size

functions

34func evc_rand(state: *i64) -> i64
38func evc_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: main
39func evc_eval(pop: *i64, base: i64, start: i64) -> i64
called by 1: main
51func evc_randfill(pop: *i64, base: i64, state: *i64) -> i64
called by 1: main calls 1: evc_rand
57func evc_tourney(fit: *i64, state: *i64) -> i64
called by 1: main calls 1: evc_rand
64func evc_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 1: main
65func evc_catn(dst: *u8, off: i64, v: i64) -> i64
called by 2: evc_catnmain calls 2: evc_catnsys_mmap
75func evc_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
76func evc_atoi(s: *u8) -> i64
called by 1: main
84func main(argc: i64, argv: *i64) -> i64