Founder, author, speaker

Genetic algorithms are a fascinating technique for solving optimisation problems. If you can create a set of rules that can measure a solution's performance, you can probably use a GA to help solve the problem. Here are some ways to encode solutions.

If you missed my article on the intuition of genetic algorithms, check this out before continuing:

Real-value encoding represents a gene with numeric values, strings, or symbols. The solution is expressed in its natural state. This encoding is used when potential solutions contain continuous values that cannot be encoded easily with binary encoding.

Order encoding, also known as permutation encoding, represents a chromosome as a sequence of elements. Order encoding usually requires all elements to be present in the chromosome. It's useful for problems where the sequence in the solution is important.

Tree encoding represents a chromosome as a tree of elements. Tree encoding is versatile for representing potential solutions where the hierarchy of elements is important or required. Tree encoding can even represent code functions, which consist of a tree of expressions.

Encoding solutions is the first step in setting up a genetic algorithm for success. It can solve interesting problems on its own or even be used with artificial neural networks, like in this Super Mario example.

If you're interested in more details about genetic algorithms, see Grokking AI Algorithms with Manning Publications:, consider following me - @RishalHurbans, or join my mailing list for infrequent knowledge drops:

You’ve successfully subscribed to Rishal Hurbans
Welcome back! You’ve successfully signed in.
Great! You’ve successfully signed up.
Success! Your email is updated.
Your link has expired
Success! Check your email for magic link to sign-in.