Search⌘ K

Using Behaviours to Model Problems

Explore how to use Elixir's behaviours to create abstractions that model genetic algorithm problems. Understand how behaviours enforce essential functions like fitness evaluation, genotype representation, and stopping criteria. This lesson helps you implement clear contracts for problem modules and integrate them seamlessly into your genetic algorithm framework.

What is abstraction?

Recall that one technique to solving problems is to transform them into a form we already understand. While every problem seems different and may require different techniques to solve, they almost always have patterns and similarities between them. This is especially true with the problems we’ll solve with genetic algorithms.

The framework you built in the lesson Building a Framework for Genetic Algorithms separates a few problem-specific parameters from the common aspects of a genetic algorithm. These parameters are a fitness function, a genotype, and termination criteria. This means that every problem we attempt to solve using a genetic ...