code wiki / _hdl_build / nx_evo_cross.nx
nx_evo_cross.nx
buildroot/runtime/_hdl_build/nx_evo_cross.nx
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
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
structs
| none |
consts
| 22 | const EVO_MAGIC_2862933555777941757: i64 = 2862933555777941757 |
| 23 | const EVO_MAGIC_3037000493: i64 = 3037000493 |
| 24 | const EVO_MAGIC_2654435761: i64 = 2654435761 |
| 25 | const EVO_MAGIC_12345: i64 = 12345 |
| 26 | const EVO_MAGIC_1000000000: i64 = 1000000000 |
| 27 | const EVO_MAGIC_65536: i64 = 65536 |
| 29 | const EVO_L: i64 = 6 |
| 30 | const EVO_P: i64 = 64 |
| 31 | const EVO_G: i64 = 400 |
| 32 | const EVO_T: i64 = 4 // tournament size |
functions
| 34 | func evc_rand(state: *i64) -> i64 |
| 38 | func evc_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x } called by 1: main |
| 39 | func evc_eval(pop: *i64, base: i64, start: i64) -> i64 called by 1: main |
| 51 | func evc_randfill(pop: *i64, base: i64, state: *i64) -> i64 |
| 57 | func evc_tourney(fit: *i64, state: *i64) -> i64 |
| 64 | func 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 |
| 65 | func evc_catn(dst: *u8, off: i64, v: i64) -> i64 |
| 75 | func 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 } |
| 76 | func evc_atoi(s: *u8) -> i64 called by 1: main |
| 84 | func main(argc: i64, argv: *i64) -> i64 |