Skip to content
C++ Roff CMake Python Shell Scheme Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc Fix man, documentation and diary paths in README Mar 5, 2019
scripts Increase minor version from 6 to 7 Mar 15, 2019
LICENSE.AGPL Make MOSES double license clearer Apr 27, 2015
LICENSE.Apache Fix wording Dec 21, 2018

MOSES -- Meta-Optimizing Semantic Evolutionary Search


MOSES is a machine-learning tool; it is an "evolutionary program learner". It is capable of learning short programs that capture patterns in input datasets. These programs can be output in either the combo programming language, or in python. For a given data input, the programs will roughly recreate the dataset on which they were trained.

MOSES has been used in several commercial applications, including the analysis of medical patient and physician clinical data, and in several different financial systems. It is also used by OpenCog to learn automated behaviors, movements and actions in response to perceptual stimulus of artificial-life virtual agents (i.e. pet-dog game avatars). Future plans including using it to learn behavioral programs that control real-world robots, via the OpenPsi implementation of Psi-theory and ROS nodes running on the OpenCog AtomSpace.

The term "evolutionary" means that MOSES uses genetic programming techniques to "evolve" new programs. Each program can be thought of as a tree (similar to a "decision tree", but allowing intermediate nodes to be any programming-language construct). Evolution proceeds by selecting one exemplar tree from a collection of reasonably fit individuals, and then making random alterations to the program tree, in an attempt to find an even fitter (more accurate) program.

It is derived from the ideas forumlated in Moshe Looks' thesis, "Competent Program Evolution", 2006 (Washington University, Missouri) Moshe is also one of the primary authors of this code.


MOSES is under double license, Apache 2.0 and GNU AGPL 3.


Documentation can be found in the /docs directory, which includes a "QuickStart.pdf" that reviews the algorithms and data structures used within MOSES. A detailed man-page can be found in /moses/moses/man/moses.1. There is also a considerable amount of information in the OpenCog wiki:


To build and run MOSES, the packages listed below are required. With a few exceptions, most Linux distributions will provide these packages.


C++ utilities package | libboost-dev


Build management tool; v2.8 or higher recommended. | cmake


Test framework | | cxxtest


Common OpenCog C++ utilities It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.


OpenCog Atomspace database and reasoning engine It uses exactly the same build procedure as this package. Be sure to sudo make install at the end.


Embedded scheme REPL (version 2.2.2 or newer is required).

Optional Prerequisites

The following packages are optional. If they are not installed, some optional parts of MOSES will not be built. The CMake command, during the build, will be more precise as to which parts will not be built.


Message Passing Interface Required for compute-cluster version of MOSES Use either MPICHV2 or OpenMPI | | libopenmpi-dev

Building MOSES

Peform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=Release ..

Libraries will be built into subdirectories within build, mirroring the structure of the source directory root. The flag -DCMAKE_BUILD_TYPE=Release results in binaries that are optimized for for performance; ommitting this flag will result in faster builds, but slower executables.

Unit tests

To build and run the unit tests, from the ./build directory enter (after building moses as above):

    make test


Just say sudo make install after finishing the build.


MOSES can be used in one of two ways: either directly from the command line, or by embedding its low-level API into C++ programs. For almost all users, the command-line interface is strongly recommended.

For those who absolutely must used the low-level C++ programming API, there is the /examples directory. To build the examples, say:

    make examples
  • example-ant: Santa Fe Trail ant example
  • example-data: Simple data sets on which moses can be run.
  • example-progs: Other example programs.
You can’t perform that action at this time.