Linear Genetic Programming in Python Bytecode
summary
A practical demo shows how genetic programming uses DEAP and pyevolve for tree-based symbolic regression but then attempts to evolve Python bytecode directly to avoid repeated parsing and eval overhead. The prototype (mgard) compiles trees to code strings, inspects function.code.co_code, and constructs CodeType objects; a tiny run (population 4, fitness threshold 0.1) converges to x**2 + x + 1 using protected divide and subtree crossover. Implementation limits include CPython-version bytecode incompatibility and restricting to a safe subset of opcodes.
AI-written summary · about
chapters (14)
- 0:00Intro
- 2:36Evolution
- 4:37Representations
- 6:55Evolution of Programs
- 8:20Initial Population
- 9:13Evaluation
- 10:00Selection
- 10:58Mutations
- 11:40Variation
- 12:04Symbolic Regression
- 18:13Deep
- 18:53Example
- 26:00Bytecode
- 31:04Looping
related talks
45mKeynote: Writing Code? Pfft... Evolve it Instead!
40mGenetic Programming in Clojure
24mGenetic Algorithms in Go
48mTight Genes: Intro to Genetic Algorithms
46mTight Genes: Intro to Genetic Algorithms
01h 21mExploring Python Code Objects
56mTeach Your Computer to Code FizzBuzz
32mBuilding a Beginner's Programming Language with Go
