Grammar-guided genetic programming

Evolve programs in any context-free language for any quantifiable goal

This website contains an example gallery created with a preliminary prototype of two grammar-guided genetic programming methods: CFG-GP and GE. Two proposals for Deep Funding aim to extend this prototype considerably and apply it to a hard optimization problem from practice:
The plan is to improve the two existing methods in the prototype and additionally implement three more recent ones that claim to have better performance: piGE , DSGE and WHGE . Once all five methods are stable, suitable benchmark problems will be collected according to guidelines developed by the genetic programming community. This will allow to compare the methods objectively, analyze their sensitivity to hyperparameter settings and identify the best choice of method and parameter combination for tackling different use cases. All that functionality will be integrated and provided in form of an open-source software package on GitHub and PyPI. The most performant method will then be onboarded on the SingularityNET platform as general-purpose optimization service that can be used to solve hard optimization problems in a wide range of domains.
The plan is to apply the best grammar-guided genetic programming method in a real-world setting: evolutionary search for robust trading strategies, presumably many of which can not be designed by human traders or other machine-learning approaches. This essentially requires the formulation of 1) context-free grammars to define search spaces of candidate strategies and 2) an objective functions to correctly evaluate the quality of candidate strategies. The second task is suspected to be the main challenge, because properly evaluating candidate trading strategies requires a non-trivial setup of backtesting simulations together with proper statistical evaluation techniques to prevent overfitting and suitable risk-adjusted performance metrics to optimize the correct goal. Only if that setup is done right, the evolved trading strategies will have good performance both on the training data but more importantly also on future data in live markets.
If you click on an image you are redirected to a Jupyter notebook that shows prototype code and the results it produced. Please note that some of the prototype examples are still fairly simple toy problems, which shall primarily demonstrate the flexiblity of grammar-guided genetic programming to operate in various search spaces, such as subsets of the Python, Rust, Atomese (for OpenCog) and MeTTa (for OpenCog Hyperon) language as well as user-created domain-specific languages. Beyond such simple demonstrations, there is a long list of real-world applications where evolutionary algorithms have produced human-competitive results, including methods from classical genetic programming and more recent grammar-guided genetic programming (e.g. under the names "grammatical evolution" and "structured grammatical evolution" in the list, both covered by proposal 1).
Symbolic regression in Python

Symbolic regression
Evolve a Python program to find an algebraic expression based on NumPy that fits to given data points.

Symbolic regression in Atomese

Symbolic regression
Evolve an Atomese program to find an algebraic expression in OpenCog that fits to given data points.

Rust number literals

Numeric literals
Evolve a Rust program that prints a binary, octal or hexadecimal number which evaluates to decimal 42.

Arithmetic expressions in MeTTa

Arithmetic expressions
Evolve a MeTTa program to find an expression in OpenCog Hyperon that evaluates to a target number.

Evolution of trading strategy

Algorithmic trading
Evolve a trading strategy to optimize a performance metric like Sortino ratio in backtesting simulations.

Image approximation

Algorithmic art
Evolve locations and colors of semi-transparent geometrical shapes to resemble a target image.

Cartpole-v1

OpenAI Gym: Cartpole-v1
Evolve an agent that moves a cart to balance a pole while remaining within a boundary.

Mountaincar-v0

OpenAI Gym: Mountaincar-v0
Evolve an agent that moves an underpowered car up the hill on the right.

Pendulum-v0

OpenAI Gym: Pendulum-v0
Evolve an agent that actuates a pendulum to swing it up and balance it there.

Acrobot-v1

OpenAI Gym: Acrobot-v1
Evolve an agent that actuates one joint of a double pendulum to swing it up.