Go to content

Being Creative with Genetic Algorithms and Typeclasses - by Noel Markham

This talk was recorded at Scala Days New York, 2016. Follow along on Twitter @scaladays and on the website for more information http://scaladays.org/. Abstract: Typeclasses are a hidden gem of the Scala language. They provide an immense power not seen in imperative languages, and so their approach might be unusual or alien to those approaching Scala from an imperative background. I will show how typeclasses allow developers to effectively attach their own interfaces to code written by others. In this talk, I describe what a genetic algorithm is and provide an example implementation in Scala. Using this implementation, I will demonstrate how to define a specific typeclass for our problem. I will then derive several different implementations, showing how to get rock solid confidence in testing our algorithm - with the help of ScalaCheck - and then provide a completely different typeclass to provide a fun, visual and creative solution, illustrating the iterations and improvements as the genetic algorithm’s fitness function runs. The talk will be particularly hands-on, with plenty of examples run directly from the REPL.

May 9, 2016