Skip to content

soriyath/genetics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Genetics

This is a loose Elixir port of the genetic algorithm shown by Daniel Shiffmann on his online tutorial.

Original project (Shakespeare)

YouTube video

Running

Install a working Elixir environement. Run iex -S mix in the terminal (no sugar shell, sorry). Query the genetic algorithm with Genetics.guess/3.

guess/3 arguments are :

  • enigma: string or charlist representing the targetted string to guess, defaults to the Shakespeare sentence (To be or not...) ;
  • population_size: integer representing the size of the population used by the algorithm, defaults to 500 ;
  • mutation_rate: float representing the probability of a mutation occuring after reproduction (0 <= n <= 1), defaults to 1%.

Documentation

Currently not much of the code is documented. I've tried to do domain driven design (any feedback welcomed).

In iex, you can run h Genetics.guess.

Benchmarking

Install bmark (dependency)

The benchmark uses bmark.

Install it by entering mix deps.get

Running bmark

Customize your benchmark by either editing the file bmark/evolution_bmark.ex or by adding a new file ending in _bmark.ex in the bmark directory.

Results appear in ms in the results folder.

Releases

No releases published

Packages

No packages published

Languages