Being Creative with Genetic Algorithms and Typeclasses
summary
Implements a reusable genetic algorithm in Scala that decouples genotype decoding via a typeclass for genotype decoding, plugs in different fitness functions, and exercises ScalaCheck property tests for roulette-wheel selection, crossover and mutation. Demos include numeric optimization (population 30, 1,000 iterations) and an image-evolution experiment using 50 triangles (~4,000 bits) that required ~5,700 iterations and ~3 days of runs — works but converges slowly. Uses REPL-driven examples and deterministic RNG injection for testability.
AI-written summary · about
chapters (24)
- 0:00Introduction
- 2:05Outline
- 2:50Where can we start
- 4:07Creating our own types
- 4:47Creating our comparator
- 5:55Martins paper
- 8:09Skylar
- 10:00Type classes
- 12:19Examples
- 15:19Proposal
- 17:56Proposed Algorithm
- 22:37One Idea
- 23:16Test
- 25:05Next Double
- 25:57Marriage
- 27:10Crossover
- 28:08Random mutations
- 29:02Final iteration
- 30:08Finding the optimal solution
- 31:52Modern art
- 33:35Image comparison
- 34:11Fitness function
- 36:46Suggestions
- 37:42References
related talks
24mLet the Scala compiler work for you
35mCellular Automata How to become an artist with a few lines
20mType Classes for the Rest of Us
28mA Reinforcement Learning Framework in Scala 3
25mAuto code generation using AI & Scala Macros
29mADVENTURES IN META-PROGRAMMING
39mA few tips on modelling things in Scala
30mHaving a cake and eating it too Introduction to Typeclasses
