Tabellab
AI & Data Science Intermediate

Genetic Algorithms by Hand: Selection, Crossover, Mutation & Fitness

Run a genetic algorithm cell by cell with given random numbers: encode solutions as bits, score them with penalties, spin the roulette wheel, hold tournaments, cross and mutate chromosomes, step a full generation and check convergence against the brute-force optimum.

8 lessons 8 labs 2.1 h Certificate

The first lesson is free โ€” no account needed.

About this course

A genetic algorithms course that runs a genetic algorithm cell by cell with given random numbers, so every step can be checked, for computer science and AI students, data scientists and anyone curious about evolutionary optimisation. You decode 5-bit chromosomes into numbers with BIN2DEC and score them with a fitness function, penalise over-weight solutions of a backpack (knapsack) problem, spin a roulette wheel with cumulative shares and MATCH and draw it as a pie chart, hold 2-way tournaments, cross parents at a single point with LEFT and RIGHT and gene by gene with IF, flip bits when a random number falls below the mutation rate, run one full generation of selection, crossover and mutation, and chart how best and average fitness converge over ten generations against the brute-force optimum of all 32 values. The first lab is free.

Lessons

  1. Encoding Solutions as Bit Strings: BIN2DEC & SUMPRODUCTLab14 minFree
  2. Fitness with a Penalty: Scoring Over-Weight BackpacksLab15 min Pro
  3. Roulette-Wheel Selection: Cumulative Shares & MATCHLab16 min Pro
  4. Tournament Selection: Random Entrants, Fitter One WinsLab15 min Pro
  5. Single-Point Crossover: LEFT, RIGHT & a Gene-Wise IFLab16 min Pro
  6. Bit-Flip Mutation: Flip a Gene When u < pmLab14 min Pro
  7. One Full Generation: Select, Cross, Mutate, Re-ScoreLab18 min Pro
  8. Convergence over Generations vs the Brute-Force OptimumLab16 min Pro