Genetic Algorithms in Elixir: String.bag_distance() is unsorted evaluation

In final example in Chapter 3, is String.bag_distance() correct choice for the fitness_function()? It will return 1 if two strings contain same characters no matter the order of the characters. This will cause terminate? to terminate the run with the wrong string most of the time.

Title: Genetic Algorithms in Elixir: Chapter 3

#book-genetic-algorithms-in-elixir

1 Like

You can use String.jaro_distance/2. That should work better. I’ll fix this example. You’ll use Jaro Distance later as well.

1 Like