seanmor5 / genex

Genetic Algorithms in Elixir!
Apache License 2.0
144 stars 13 forks source link

Genex

Genex makes it easy to write Genetic Algorithms with Elixir.

Build Status Coverage Status Hex Version

This library is inspired by Python's DEAP.

Documentation

Documentation is available at here.

Installation

The package can be installed by adding genex to your list of dependencies in mix.exs.

def deps do
  [
    {:genex, "~> 1.0.0-beta"}
  ]
end

Usage

Genex requires an implementation module with 3 functions: genotype/0, fitness_function/1, and terminate?/1.

defmodule OneMax do
  use Genex

  def genotype, do: Genotype.binary(10)

  def fitness_function(chromosome), do: Enum.sum(chromosome.genes)

  def terminate?(population), do: population.max_fitness == 10
end

Now, run iex -S mix.

Then:

  iex> OneMax.run()

Features

Genex strives to be as simple and customizable as possible. Along with the ability to customize EVERY step of your Genetic algorithm, Genex comes with the following features:

To request a feature, please open an issue.

Examples

There are currently 5 basic examples available in the examples directory. To run them, clone the repo and run:

mix run examples/[example].exs

The current examples are:

Genex in Practice

These projects use Genex in practice:

To feature yours, please submit a pull request.

Contributing

If you have any problems with Genex, please open an issue! If you have a fix for an issue, submit a pull request.