Download presentation
Presentation is loading. Please wait.
1
Genetic Algorithms CPSC 212 Spring 2004
2
Heuristic Stochastic optimization algorithm
Used to search for good/excellent solutions to large NP-complete problems Does not guarantee optimal solution Provides good solution very quickly
3
Basic Algorithm Create population of solutions Evaluate each solution
Sort in increasing order of quality of solution (i.e., best solution is #1) Repeat: Select and mate parents Produce and evaluate offspring Insert offspring into population
4
GAs Applied to Traveling Salesperson Problem
Given n cities: 0, 1, …, (n-1) A solution is a permutation of the values 0 through (n-1) Randomly create an initial population of solutions (permutations) Evaluate (determine cost of each tour) Sort by increasing cost
5
Traveling Salesperson Problem
Example: 6 cities Initial population: Adjacency Matrix: =47
6
Traveling Salesperson Problem
Sort the population Adjacency Matrix:
7
Traveling Salesperson Problem
Randomly select parents (2 and 5)
8
Traveling Salesperson Problem
Mate parents (1-point crossover) randomly select crossover point cross-selection of genes ____ ____
9
Traveling Salesperson Problem
Produce offspring ____ ____
10
Traveling Salesperson Problem
Evaluate offspring Adjacency Matrix:
11
Traveling Salesperson Problem
Insert offspring into population
12
Traveling Salesperson Problem
Repeat mating
13
Traveling Salesperson Problem
Mutation: Randomly select 1 parent
14
Traveling Salesperson Problem
Mutation: Randomly select 2 genes ^ ^
15
Traveling Salesperson Problem
Mutation: Swap 2 genes Adjacency Matrix: =>
16
Traveling Salesperson Problem
Mutation: Insert mutant solution into population if it is better than worst member
17
Traveling Salesperson Problem
Perform mating 90% of time Perform mutation 10% of time Stop when time has expired
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.