# DEFINITION OF THE GENETIC ALGORITHM GA The genetic

• Slides: 24

DEFINITION OF THE GENETIC ALGORITHM (GA) The genetic algorithm is a probabalistic search algorithm that iteratively transforms a set (called a population) of mathematical objects (typically fixed-length binary character strings), each with an associated fitness value, into a new population of offspring objects using the Darwinian principle of natural selection and using operations that are patterned after naturally occurring genetic operations, such as crossover (sexual recombination) and mutation.

GA FLOWCHART (familiar with)

PROBABILISTIC SELECTION BASED ON FITNESS • • • Better individuals are preferred Best is not always picked Worst is not necessarily excluded Nothing is guaranteed Mixture of greedy exploitation and adventurous exploration • Similarities to simulated annealing (SA)

MUTATION OPERATION • Parent chosen probabilistically based on fitness Parent 010 • Mutation point chosen at random Parent --0 • One offspring Offspring 011

CROSSOVER OPERATION • 2 parents chosen probabilistically based on fitness P a r e n t 1 P a r e n t 2

CROSSOVER (CONTINUED) • Interstitial point picked at random Fragment 1 01 - Fragment 2 11 - • 2 remainders Remainder 1 Remainder 2 --1 --0 • 2 offspring produced by crossover Offspring 1 111 Offspring 2 010

PROBABILISTIC STEPS • The initial population is typically random • Probabilistic selection based on fitness - Best is not always picked - Worst is not necessarily excluded • Random picking of mutation and crossover points • Often, there is probabilistic scenario as part of the fitness measure

GENETIC PROGRAMMING

A COMPUTER PROGRAM

GENETIC PROGRAMMING (GP) • GP applies the approach of the genetic algorithm to the space of possible computer programs

GP FLOWCHART (familiar with)

PROGRAM TREE (+ 1 2 (IF (> TIME 10) 3 4))

CREATING RANDOM PROGRAMS • Available functions set F = {+, -, *, %, IFLTE} • Available terminals of function set T = {X, Y, Random-Constants} • The random programs are: – Of different sizes and shapes – Syntactically valid – Executable

GP GENETIC OPERATIONS • • Reproduction Mutation Crossover (sexual recombination) Architecture-altering operations

MUTATION OPERATION • • Select 1 parent probabilistically based on fitness Pick point from 1 to NUMBER-OF-POINTS Delete subtree at the picked point Grow new subtree at the mutation point in same way as generated trees for initial random population (generation 0) • The result is a syntactically valid executable program • Put the offspring into the next generation of the population

CROSSOVER OPERATION • Select 2 parents probabilistically based on fitness • Randomly pick a number from 1 to NUMBER-OFPOINTS for 1 st parent • Independently randomly pick a number for 2 nd parent • The result is a syntactically valid executable program • Put the offspring into the next generation of the population • Identify the subtrees rooted at the two picked points

REPRODUCTION OPERATION • Select parent probabilistically based on fitness • Copy it (unchanged) into the next generation of the population

FIVE MAJOR PREPARATORY STEPS FOR GP • • • Determining the set of terminals Determining the set of functions Determining the fitness measure Determining the parameters for the run Determining the method for designating a result and the criterion for terminating a run

PREPARATORY STEPS ( example ) Objective: Find a computer program with one input (independent variable X) whose output equals the given data 1 Terminal set: T = {X, Random-Constants} 2 Function set: F = {+, 3 Fitness: The sum of the absolute value of the differences between the candidate program’s output and the given data (computed over numerous values of the independent variable x from – 1. 0 to +1. 0) 4 Parameters: Population size M = 4 5 Termination: An individual emerges whose sum of absolute errors is less than 0. 1 -, *, %}

ROLE OF HILL CLIMBING IN THE SEARCH Genetic programming does not rely exclusively on greedy hill climbing to conduct its search, but instead allocates a certain number of trials, in a principled way, to choices that are known to be inferior

DETERMINISM IN THE SEARCH Genetic programming conducts its search probabilistically

ROLE OF AN EXPLICIT KNOWLEDGE BASE Genetic programming does NOT make use of a knowledge base

ROLE OF FORMAL LOGIC IN THE SEARCH Genetic programming does not utilize formal logic in it’s search strategy. Contradictory alternatives are created and actively maintained.

UNDERPINNINGS OF THE TECHNIQUE Biologically inspired