Using Behaviours to Model Problems

Learn about the concept of abstraction as well as behaviours.

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 algorithm must implement all three of these functions. This therefore creates an unavoidable natural abstraction for problems.

An abstraction is a simplification of underlying complexities and implementations. The purpose of abstraction is to force us to think of things at different levels of specificity. It gives us an idea of what to look for before we approach a problem.

This is especially useful when approaching new problems with genetic algorithms. When we want to approach a new problem, we already know that we need a fitness function or a way to measure success, a genotype or a way to represent solutions, and some termination criteria, or a way to tell the algorithm when to stop. While the specifics are the difficult part, we’re never starting from scratch with this abstraction in place.

Get hands-on with 1200+ tech skills courses.