hmep: HMEP Multi Expression Programming – a genetic programming variant

[ ai, bsd3, library, program ] [ Propose Tags ]

A multi expression programming implementation with focus on speed.

[Skip to Readme]
Versions [faq] 0.0.0, 0.0.1, 0.1.0, 0.1.1
Change log
Dependencies base (>=4.7 && <5), hmep, mwc-random, primitive, probable, statistics (>=0.10 && <0.14), vector [details]
License BSD-3-Clause
Copyright 2017 Bogdan Penkovsky
Author Bogdan Penkovsky
Maintainer dev at penkovsky dot com
Category AI
Home page
Source repo head: git clone
Uploaded by penkovsky at Sun Oct 8 17:56:57 UTC 2017
Distributions NixOS:0.1.1
Executables hmep-demo
Downloads 859 total (24 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2017-10-08 [all 1 reports]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for hmep-0.1.0

[back to package description]

Multi Expression Programming

You say, not enough Haskell machine learning libraries?

Here is yet another one!


There exist many other Genetic Algorithm (GA) Haskell packages. Personally I have used simple genetic algorithm, GA, and moo for quite a long time. The last package was the most preferred, but the other two are also great.

However, when I came up with this MEP paper, to my surprise there was no MEP realization in Haskell. Soon I realized that existing GA packages are limited, and it would be more efficient to implement MEP from scratch.

That is how this package was started. I also wish to say thank you to the authors of the moo GA library, which inspired the present hmep package.

About MEP

Multi Expression Programming is a genetic programming variant encoding multiple solutions in the same chromosome. A chromosome is a computer program. Each gene is featuring code reuse. For more details, please check and

How to build

Use Stack.

 $ git clone && cd hmep
 $ stack build --install-ghc

Now, run the demo to calculate cos^2(x) through sin(x):

 $ stack exec hmep-demo

 Average loss in the initial population 15.268705681244962
 Population 10: average loss 14.709728527360586
 Population 20: average loss 13.497114190675477
 Population 30: average loss 8.953185872653737
 Population 40: average loss 8.953185872653737
 Population 50: average loss 3.3219954564955856e-15

 Interpreted expression:
 v1 = sin x0
 v2 = v1 * v1
 result = 1 - v2


This library is written and maintained by Bogdan Penkovsky