Midterm structure
- some short answers
- is this true/false and why
- no simple true/false or multiple choice
- topics
- agents
- informed search
- blind search (bit less than informed search)
- search algorithms & cost
- why is utility based better than x
Assignment 1
- “not extended” to Oct 12/13
Genetic Algorithms
Note
Skipping past a lot of stuff → officially starting slide 34
Selection techniques
- Tournament selection: select K individuals, keep best for reproduction
Important
“What is tournament selection” will be asked on a quiz/midterm/exam
- Roulette wheel selection: probabilistic selection based on fitness
Genetic Operators
Crossover
provides a method of combining two candidates form the population to create new candidates
- swaps pieces of genetic material between two individuals (represents mating)
- usually two individuals (parents) combine to produce two more individuals (children)
- can also define an asexual or single-child crossover as well
Mutation
changing gene value(s)
- lets offspring evolve in new directions → introduces a certain amount of randomness
- certain traits may become fixed
Replication
copy an individual to the next generation without alteration
Crossover Operations
- 1-point, n-point crossover
- uniform order crossover (UOX)
- vs uniform crossover
Step 1: Setup
Parents (P1, P2) and Mask
P1: 6 2 1 4 5 7 3
Mask: 0 1 1 0 1 0 1 → generate new mask for every 2 parents
P2: 4 3 7 2 1 6 5
Step 2: Copy Genes by Mask
- Copy genes from P1 → C1 where mask = 1
- Copy genes from P2 → C2 where mask = 1
C1: - 2 1 - 5 - 3
C2: - 3 7 - 1 - 5
Step 3: Fill Remaining from Opposite Parent
- Fill blanks (-) with remaining genes from the other parent in order
C1: 4 2 1 7 5 6 3
C2: 6 3 7 2 1 4 5
✅ Final Offspring
C1: 4 2 1 7 5 6 3
C2: 6 3 7 2 1 4 5
- order crossover (OX)
- Copying a randomly selected set from the first parent.
- Filling the remaining positions with the order of elements from the second
Example 1
Step 1: Copy randomly selected set from first parent
p1: 1 2 3 4 5 6 7 8 9
p2: 9 3 7 8 2 6 5 1 4
c1: * * * 4 5 6 7 * *
c2: * * * 8 2 6 5 * *
Step 2: Copy rest from second parent in order
Remaining order from p2: 1, 9, 3, 8, 2
C1: 3 8 2 4 5 6 7 1 9
C2: ?
Example 2
Step 1: Copy randomly selected set from first parent
p1: 1 2 3 4 5 6 7 8 9
p2: 4 5 2 1 8 7 6 9 3
c1: * * * 4 5 6 7 * *
Step 2: Copy rest from second parent in order
Remaining order from p2: 9, 3, 2, 1, 8
C1: 2 1 8 4 5 6 7 9 3
- partially mapped (PMX)
- cycle crossover (CX)
Learning illegal structures
consider the travelling salesman problem (TSP) where an individual represents a potential solution. the standard crossover operation can produce illegal children
Parent A: Thorold, St.Catharines, Hamilton, Oakville, Toronto
Parent B: Hamilton, Oakville, Toronto, St.Catharines, Thorold
Parent AB: Thorold, St.Catharines, Hamilton, St.Catharines, Thorold
Parent BA: Hamilton, Oakville, Toronto, Oakville, Toronto
possible solution: replace duplicates with a different city
Mutation
examples:
- Inversion: reverse it
- Insertion: pick a random thing and move it
Note
ended slide 65 (take notes on everything that was skipped by in lecture)
Important
midterm is up to slide 65 in GA slides