# MOSES example programs

Example programs illustrating the use of the MOSES API can be found in the source directory opencog/learning/moses/main. These programs are used to perform manual testing and evaluation of the current MOSES code base. These examples implement various different types of problems that MOSES is expected to be able to solve.

## Example tests

The "Ant on the Santa Fe Trail" problem (a simple, mechanical ant that can turn and move in four directions, following a trail of bread-crumbs on a 32x32 grid). This problem is highly symmetric, has a high density of global optima, and is deceptive at all levels:

• moses-ant-hillclimbing

Learning of artificial neural nets, for the pole-balancing problem, and for the XOR function:

• moses-ann-pole1
• moses-ann-pole2
• moses-ann-pole2-hillclimbing
• moses-ann-pole2nv
• moses-ann-xor

Assorted composable deceptive problems:

• nmax
• onemax -- Sum total number of bits in a boolean bit-string.
• ontomax
• contimax

Assorted basic composable problems. These are built into the main moses executable, and specified with the -H (--problem) flag:

• even parity -- Parity problems compute the parity of a bit-string. Even parity problems are hard to learn, because the global maxima are very rare in formula-space, because formula are highly symmetrical (fully symmetrical in all variables), and because there is little gradient information (any formula that does not contain all variables will be correct half the time!)
• disjunction
• multiplex -- Multiplex problems take an input of k bits (an "address") to generate a 2k "storage location". Allowing a boolean 'if' makes these easier to learn.
• regression of sum
• regression on input table
• regression on input table, using artificial neural nets
• regression based on combo program

## Discussion

Moshe's PhD thesis, "Competent program Learning" (2006) presents a discussion and quantitative results for the Santa Fe Trail, even parity, and multiplex problems, including a comparison to evolutionary programming and genetic programming systems.