...

/

Creating the Problem Behaviour

Creating the Problem Behaviour

Learn how to create a behaviour and integrate it into the genetic algorithm.

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:

Press + to interact
defmodule Problem do
alias Types.Chromosome
end

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 define callbacks that can be implemented by modules that adopt the Problem ...

Access this course and 1400+ top-rated courses and projects.