/d-CGP

Implementation of the differential CGP (Cartesian Genetic Programming)

Primary LanguageC++GNU General Public License v3.0GPL-3.0

DOI Build status Build Status PyPI

d-CGP

Implementation of differentiable Cartesian Genetic Programming (d-CGP)

The d-CGP is a recent development in the field of Genetic Programming that adds the information about the derivatives of the output nodes (the programs, or expressions encoded) with respect to the input nodes (the input values) and weights. In doing so, it enables a number of new applications currently the subject of active research.

  • The evolution of the genetic program can now be helped by using the information on the derivatives, enabling for the equivalent of backpropagation in Neural Networks.
  • The fitness function can be defined in terms of the derivatives, allowing to go beyond simple regression tasks and, instead, solve differential equations, learn differential models, capture conserved quantities in dynamical systems.

The first research paper describing d-CGP use to solve symbolic regressions problems such is:

Izzo, Dario, Francesco Biscani, and Alessio Mereta. "Differentiable Genetic Programming." arXiv preprint arXiv:1611.04766 (2016).

Preliminary documentation can be found at http://darioizzo.github.io/d-CGP/

dcgpy

If you have a win 64bit system or a linux based system (32 or 64 bits), the python package dcgpy (python binding of the C++ code) can be installed via:

pip install dcgpy

otherwise you will have to compile it by activating the BUILD_DCGPY option in CMake

Compiling the source code or using the header only library

Dependencies

Several dependencies are necessary to successfully compile d-CGP

After making sure the dependencies above are installed in your system, you may download the latest dCGP version via git:

git clone https://github.com/darioizzo/d-CGP.git

and configure your build using CMake.

cd d-CGP

mkdir build

cd build

ccmake ../

To build the python package activate the BUILD_DCGPY option.

When done, type (in your build directory):

make install

The headers will be installed in the CMAKE_INSTALL_PREFIX/include directory. To check that all went well compile the quick-start example.

Other CGP libraries

Comparison to the CGP-Library

If all below statements are true:

  • You do not care about knowing derivatives of your encoded program
  • You do not care about run-time capabilities
  • You do not care about the Python module
  • You do not care about the possibility of defining your kernel functions as complex functors (e.g. CGP expressions.)
  • You do not care about thread-safety

then you should consider using, instead, Andrew Turner's CGP-Library (http://www.cgplibrary.co.uk/files2/About-txt.html) which is, roughly, twice as fast to compute a CGP expression as it makes use of function pointers rather than a std::function to define the kernel functions.