code wiki / _hdl_build / nx_evolve_gap.nx
nx_evolve_gap.nx
buildroot/runtime/_hdl_build/nx_evolve_gap.nx
about
nx_evolve_gap.nx -- the EVOLUTIONARY-COMPUTATION team member, wired into team-solve as TIER-2: when
tier-1 mechanistic-search can't solve a gap (it needs PARAMETERS a bare capability can't supply),
EVOLUTION searches the parameter (GENE) space. Concretely: the team has a PARAMETERIZED capability
reduce_op <op> <init> (op in {add,mul,max,min}, init); this organ EVOLVES the (op,init) genes with
the EC operators from the taxonomy (evo_params.tsv): a POPULATION of genes, TOURNAMENT selection,
per-gene MUTATION, ELITISM, FIXED-seed reproducibility -- and the FITNESS is the EXTERNAL ALE HARNESS
SCORE (the designed "swap fitness_id for a gate permil"). It evolves until a gene scores 1000 -> the
gap is SOLVED by the evolutionary member, NO LLM. HONEST: for this small/binary gap evolution is a
guided search; nx_evolve validates GP's gradient-climbing on smooth/multimodal landscapes
(sphere/rastrigin) -- together they are the team's evolutionary search across landscapes. (DRY note:
the shared GP loop wants extraction to a lib once a 3rd consumer appears, per rule 15.)
args mode: nx_evolve_gap <gap_task> -> evolve genes; print the solving (op,init) or UNSOLVED.
no-arg: SELF-GATE on the product gap task_reduce -> evolution MUST discover (mul,1) -> GREEN.
license_tier: ORIGINAL
module: nishi-core.team.evolve_gap
depends: nishi-core.sys.syscalls
capability: EVOLUTIONARY_GAP_SOLVE
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
| 20 | const EG_MAGIC_262144: i64 = 262144 |
| 22 | const EG_POP: i64 = 16 |
| 23 | const EG_GENS: i64 = 4 |
| 24 | const EG_TOURK: i64 = 3 |
functions
| 26 | func eg_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 27 | func eg_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 } |
| 28 | func eg_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; 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 } |
| 29 | func eg_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 30 | func eg_unlink(path: *u8) -> i64 { return __syscall(263, AT_FDCWD, path, 0, 0, 0, 0) } |
| 32 | func eg_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 46 | func eg_score_of(path: *u8) -> i64 |
| 57 | func eg_rand(s: *i64) -> i64 called by 1: eg_evolve |
| 67 | func eg_modn(v: i64, n: i64) -> i64 { var r: i64 = v % n; if r < 0 { r = r + n } return r } called by 1: eg_evolve |
| 70 | func eg_variant(taskbuf: *u8, tn: i64, op: i64, init: i64, outpath: *u8) -> i64 |
| 117 | func eg_fitness(taskbuf: *u8, tn: i64, op: i64, init: i64) -> i64 |
| 146 | func eg_evolve(taskpath: *u8, bop: *i64, binit: *i64) -> i64 |
| 198 | func eg_opname(op: i64) -> *u8 { if op == 1 { return "mul" as *u8 } if op == 2 { return "max" as *u8 } if op == 3 { return "min" as *u8 } return "add" as *u8 } called by 1: main |
| 200 | func main(argc: i64, argv: *i64) -> i64 |