seanmor5/genex
{ "createdAt": "2019-08-03T23:30:33Z", "defaultBranch": "master", "description": "Genetic Algorithms in Elixir!", "fullName": "seanmor5/genex", "homepage": "", "language": "Elixir", "name": "genex", "pushedAt": "2024-02-24T14:11:25Z", "stargazersCount": 155, "topics": [], "updatedAt": "2025-10-01T13:47:18Z", "url": "https://github.com/seanmor5/genex"}Genex makes it easy to write Genetic Algorithms with Elixir.
This library is inspired by Python’s DEAP.
Documentation
Section titled “Documentation”Documentation is available at here.
Installation
Section titled “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"} ]endGenex 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 == 10endNow, run iex -S mix.
Then:
iex> OneMax.run()Features
Section titled “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:
- 6 Selection Operators (14 anticipated)
- 12 Crossover Operators (17 anticipated)
- 4 Mutation Operators (9 anticipated)
- Fully Customizable Evolutions
- Multi-Objective Optimization
- Penalty Functions
- Genotype Generation Helpers
- Benchmarking of Common Problems
- Exportable Genealogy Tree
- Exportable Hall of Fame
- Flexible Encoding of Chromosomes (any
Enum) - Extendable Visualizations
To request a feature, please open an issue.
Examples
Section titled “Examples”There are currently 5 basic examples available in the examples directory. To run them, clone the repo and run:
mix run examples/[example].exsThe current examples are:
one_max.exsknapsack.exsspeller.exstsp.exsn_queens.exsknapsack.exs
Genex in Practice
Section titled “Genex in Practice”These projects use Genex in practice:
To feature yours, please submit a pull request.
Contributing
Section titled “Contributing”If you have any problems with Genex, please open an issue! If you have a fix for an issue, submit a pull request.