fix: Push3 evolution: mutation operators for bytecode programs (#544)
Implements the five Push3 mutation operators and the meta-operator for the optimizer evolution pipeline: - mutateConstant: shifts a random integer literal by ±δ (clamped to 0) - swapOperator: swaps ADD↔SUB, MUL↔DIV, GT↔LT, GTE↔LTE - deleteInstruction: removes a random non-EXEC.IF instr; validates result - insertInstruction: inserts stack-neutral pair (push 0 + DYADIC.POP) - crossover: single-point crossover of two programs at instruction boundaries - mutate: applies N random mutations from the four single-program operators All mutations validate output via transpile() symbolic stack simulation. Invalid mutations silently return the original program. 35 unit tests cover all operators, edge cases (empty program, single instruction, deep stack), and the acceptance criterion that mutate(optimizer_v3, 3) produces ≥10 distinct valid variants in 20 trials. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
02069464d4
commit
a6b64d3219
5 changed files with 2363 additions and 0 deletions
14
tools/push3-evolution/tsconfig.json
Normal file
14
tools/push3-evolution/tsconfig.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./**/*.ts"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue