This repository contains the tutorial materials for the Cartesian Genetic Programming (CGP) tutorial presented at GECCO 2025. The tutorial provides a hands-on introduction to CGP through a simple, educational implementation built from scratch.
Cartesian Genetic Programming is a form of genetic programming that represents programs as directed acyclic graphs. This tutorial covers:
- CGP representation: Linear genome encoding computational graphs
- Evolution: Simple (1+λ) evolutionary strategy
- Applications: Symbolic regression and reinforcement learning policy evolution
- Implementation: Complete CGP system built from scratch in Python
By the end of this tutorial, you will understand:
- How CGP represents programs as graphs with linear genomes
- The role of active and inactive nodes in CGP
- How to apply CGP to symbolic regression problems
- How to evolve policies for reinforcement learning tasks
The main tutorial is contained in the Jupyter notebook:
cgp_tutorial.ipynb- Complete tutorial with theory and hands-on examples
- Representation - CGP's graph-based program representation
- Random Initialization - Creating random CGP programs
- Active vs Inactive Nodes - Understanding program execution flow
- Mutation - Point mutation and neutral evolution
- Evolution - Simple (1+λ) evolutionary algorithm
- Example 1: Symbolic regression (evolving f(x,y) = x² + y²)
- Example 2: Reinforcement learning (Mountain Car policy evolution)
- Clone this repository
- Install the required dependencies
pip install numpy matplotlib gymnasium[classic_control]- Open
cgp_tutorial.ipynbin Jupyter Lab/Notebook - Follow along with the tutorial!
This is a simplified educational implementation designed for learning purposes. For production use or advanced research, consider the implementations listed below.
- pyCGP: Python implementation focused on symbolic regression and image analysis
- CGPython: Another Python CGP implementation
- cartesian: Lightweight Python CGP for symbolic regression
- cartesian_genetic_programming: Sklearn-compatible CGP with cross-validation and grid search
- hal-cgp: Extensible pure Python library supporting symbolic regression with export to NumPy, SymPy, and PyTorch
- CartesianGeneticProgramming.jl: Julia implementation based on Cambrian.jl framework
- MAGE.jl: Multimodal Adaptive Graph Evolution, a typed extension of CGP
- cgp-plusplus: Modern C++ implementation with concurrency, checkpointing, and benchmarks
- CGP-Library: Cross-platform C library for integration into larger projects
- dcgp: Differentiable CGP with derivative information for advanced optimization
- dcgp.js: JavaScript bindings for differential CGP (Node.js and web)
- CGPExperiments: Python framework for CGP experiments in image processing
- CGPNAS: CGP for multi-objective neural architecture search
- gpFlappyBird: CGP trained to play Flappy Bird
This tutorial was developed for the GECCO 2025 conference. For questions or feedback about the tutorial materials, please open an issue in this repository.
This tutorial is provided for educational purposes. Please refer to individual implementation repositories for their specific licenses.
Happy Learning! 🧬💻