Local search & optimization

  • path to goal irrelevant, only goal state matters
  • uses single current state → moves to neighbors
  • Advantages:
    • low memory use
    • works in huge/infinite state spaces
    • good for optimization problems

Example: N-Queens

  • goal: place n queens with no conflicts
  • state: configuration of queens
  • solution: valid arrangement

  • moves to neighbour with best heuristic
  • stops at local maxima (no better neighbours)
  • doesn’t look ahead
graph TD
    Start[Initial state] --> A[Neighbor 1]
    Start --> B[Neighbor 2]
    A --> Peak1[Local maximum]
    B --> Peak2[Goal or Local max]

Variations:

  • Stochastic: random among uphill moves
  • First-choice: pick first better successor
  • Random-restart: try multiple random states to avoid local maxima

Drawbacks of hill-climbing

  • Local maxima: stuck at non-optimal peaks
  • Ridges: difficult sequences for greedy search
  • Plateaux: flat evaluation function → random walk
  • success rate can be low (e.g., 86% stuck in 8-queens)

Genetic Algorithms

Darwinian Evolution 1: survival of the fittest

  • all environments have finite resources (can only support a limited number of individuals)
  • lifeforms have basic instinct/lifecycles geared towards reproduction
    • some kind of selection is inevitable
  • the individuals that compete for the resources most effectively have increased chance of reproduction

Note

skipped everything else lol?

Biological evolution

  • genes are like parameters control our development/adjust how the GA works
  • evolution creates the genes and specifies the different values a gene can take (alleles)
  • Reproduction with inheritance: individuals make copies of themselves
    • copies should resemble their parents (not be duplicates)
  • Variation: ensure that copies are not identical to parents
    • mutations, crossover produces individuals with different traits
  • Selection: need a method to ensure that some individuals make copies of themselves more than others
    • fittest individuals (favourable traits) have more offspring than unfit individuals, and population therefore has those traits
    • over time, changes will cause new species that can specialize for particular environments
  • Evolution: reproduction with inheritance + variability + selection

Evolutionary computation

  • very important take notes on this

Note

up to slide 24