Skip to content

d9w/CGP-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to Cartesian Genetic Programming (CGP) - GECCO 2026 Tutorial

This repository contains the tutorial materials for the Cartesian Genetic Programming (CGP) tutorial presented at GECCO 2026. The tutorial provides a hands-on introduction to CGP through a simple, educational implementation built from scratch.

📖 About This Tutorial

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

🎯 Learning Objectives

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

📚 Tutorial Structure

The main tutorial is contained in the Jupyter notebook:

  • cgp_tutorial_notebook.ipynb - Complete tutorial with theory and hands-on examples

Topics Covered:

  1. Representation - CGP's graph-based program representation
  2. Random Initialization - Creating random CGP programs
  3. Active vs Inactive Nodes - Understanding program execution flow
  4. Mutation - Point mutation and neutral evolution
  5. Evolution - Simple (1+λ) evolutionary algorithm
  6. Example 1: Symbolic regression (evolving f(x,y) = x² + y²)
  7. Example 2: Reinforcement learning (Mountain Car policy evolution)

🚀 Getting Started

Local Installation

  1. Clone this repository
  2. Install the required dependencies
pip install -r requirements.txt
  1. Open cgp_tutorial_notebook.ipynb in Jupyter Lab/Notebook
  2. Follow along with the tutorial!

Google Colab

  1. Open this notebook directly on Colab

⚠️ Important Note

This is a simplified educational implementation designed for learning purposes. For production use or advanced research, consider the implementations listed below.

🌐 Community & Resources

  • GPBench: A benchmarking initiative for genetic programming, home of TinyverseGP
  • Graph GP workshop: A workshop dedicated to graph-based genetic programming, including CGP

🔗 Production CGP Implementations

Python

  • TinyverseGP: Compact, modern GP framework from the GPBench project, including a CGP implementation
  • 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

Julia

C/C++

  • cgp-plusplus: Modern C++ implementation with concurrency, checkpointing, and benchmarks
  • CGP-Library: Cross-platform C library for integration into larger projects

Specialized Implementations

  • 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

👥 Tutorial Authors

This tutorial was developed for the GECCO 2025 conference and updated for GECCO 2026. For questions or feedback about the tutorial materials, please open an issue in this repository.

📄 License

This tutorial is provided for educational purposes. Please refer to individual implementation repositories for their specific licenses.


Happy Learning! 🧬💻

About

No description, website, or topics provided.

Resources

License

Stars

2 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors