Creating the Problem Behaviour
Explore how to create a Problem behaviour in Elixir for genetic algorithms. Learn to define essential callbacks like genotype, fitness function, and termination criteria, and adapt your framework to work with a custom chromosome struct to effectively manage evolution processes.
We'll cover the following...
Behaviour creation
To start writing your behaviour, we will first create a new file within the lib directory named problem.ex.
Then, we will open this problem.ex file and add a new module named Problem, like this:
This is a barebones module that contains an alias for the Chromosome module we created at the beginning of this chapter. The alias makes accessing the Chromosome module easier later on.
At this point, it’s time to start thinking about what a problem consists of? Remember, we need to ...