the standard genetic algorithm

8
The Standard Genetic Algorithm Start with a “population” of “individuals” Rank these individuals according to their “fitness” Select pairs of individuals to “reproduce” Higher fitness greater probability of selection Each pair of “parents” produces two “children” Because of “crossover,” children receive “genes” from both parents Introduce random “mutations” in some of the children Repeat until a desired fitness level has been reached or some number of generations have elapsed

Upload: conan-dickerson

Post on 01-Jan-2016

23 views

Category:

Documents


2 download

DESCRIPTION

The Standard Genetic Algorithm. Start with a “population” of “individuals” Rank these individuals according to their “fitness” Select pairs of individuals to “reproduce” Higher fitness  greater probability of selection Each pair of “parents” produces two “children” - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Standard Genetic Algorithm

The Standard Genetic Algorithm

• Start with a “population” of “individuals”• Rank these individuals according to their “fitness”• Select pairs of individuals to “reproduce”

– Higher fitness greater probability of selection

• Each pair of “parents” produces two “children”– Because of “crossover,” children receive “genes” from

both parents

• Introduce random “mutations” in some of the children

• Repeat until a desired fitness level has been reached or some number of generations have elapsed

Page 2: The Standard Genetic Algorithm

Individuals and Fitness

• In this system, the individuals are utility functions, and the genes are the weights assigned to the different factors.

• Population size is set by the user and must be a power of 2.

• Fitness is measured in a single-elimination tournament.– Games are played to a maximum of 40 moves.– A win in the tournament is worth 10 fitness points.– A tie is worth 5 fitness points.– The sum of all individuals’ fitnesses is normalized to 1.

• Parents are selected with probability equal to their fitness.– Parents are not necessarily monogamous.

Page 3: The Standard Genetic Algorithm

Finding Fitnesses

The Tournament

A0 pts

B0 pts

A+10 pts

C0 pts

D0 pts

C+10 pts

C+10 pts

E0 pts

F0 pts

F+10 pts

G0 pts

H0 pts

G+10 pts

F+10 pts

C+10 pts

Individual Points FitnessA 10 0.1429B 0 0C 30 0.4286D 0 0E 0 0F 20 0.2857G 10 0.1429H 0 0Total 70 1

Page 4: The Standard Genetic Algorithm

Crossover and Mutation

• Genes are listed in a fixed, arbitrary order, and crossover occurs at a single, randomly chosen point in the list.– One child receives from one parent the set of genes that

occur before the crossover point. It receives from its other parent the set of genes that occur after the crossover point.

– The other child receives the complementary set of genes from each parent.

• Each gene is subject to mutation with a small, independent probability that is set by the user.– The size of the mutation is random, but the distribution

is skewed toward smaller changes. – A gene can never change by more than its current value.

Page 5: The Standard Genetic Algorithm

Generating Children

AdvancementBack Row BridgeCenter ControlDiagonal MomentKing Center ControlTotal MobilityTriangle of OreoThreat

102835514

AdvancementBack Row BridgeCenter ControlDiagonal MomentKing Center ControlTotal MobilityTriangle of OreoThreat

69914825

Parents Children102835825

69914514

crossover

103835525

68914514

mutation

Page 6: The Standard Genetic Algorithm

Encoding Knowledge of Checkers

• Move Generator– Incorporates all of the rules of the game.– Computes the legal moves that are available in a given

board state.

• Utility Function– Attempts to quantify the desirability of a given board

state.– Consists of a simple linear combination of 16 factors taken

from A. L. Samuel’s original checkers program of 1959.– Coefficients can take on any value in the range of a Java double.

– Unfortunately, this function is too simple to represent the game, since it cannot even represent interactions between the factors.

Page 7: The Standard Genetic Algorithm

The Computer Player

• Basic Strategy: Minimax Search– Searches forward in time to find the best move to make

now.– Represents the game as a tree.

• Each level corresponds to a turn.• Each node corresponds to a possible game state.• Each edge represents a legal move.

– Assumes that, at each turn, players will choose the move that is most beneficial.

– In checkers, it is usually impossible to search to the end of the game because there are so many possible moves at each turn. In this system, the search is stopped at an arbitrary depth of 6 moves, and a utility function rates the desirability of every possible game state.

Page 8: The Standard Genetic Algorithm

Minimax Search

choose best (max)

choose worst (min)

choose best (max)

choose worst (min)

Example Minimax Search with Depth 5.

Each oval represents a possible game state. The numbers represent utility values.

–∞

–∞

100

100

100

100

5 20 45

121 204

100130