SlideShare a Scribd company logo
1 of 44
Genetic Algorithms
Muhannad Harrim
Introduction
īŽ After scientists became disillusioned with
classical and neo-classical attempts at
modeling intelligence, they looked in other
directions.
īŽ Two prominent fields arose, connectionism
(neural networking, parallel processing) and
evolutionary computing.
īŽ It is the latter that this essay deals with -
genetic algorithms and genetic programming.
What is GA
īŽ A genetic algorithm (or GA) is a search technique
used in computing to find true or approximate
solutions to optimization and search problems.
īŽ Genetic algorithms are categorized as global search
heuristics.
īŽ Genetic algorithms are a particular class of
evolutionary algorithms that use techniques inspired
by evolutionary biology such as inheritance,
mutation, selection, and crossover (also called
recombination).
What is GA
īŽ Genetic algorithms are implemented as a computer
simulation in which a population of abstract
representations (called chromosomes or the genotype
or the genome) of candidate solutions (called
individuals, creatures, or phenotypes) to an
optimization problem evolves toward better solutions.
īŽ Traditionally, solutions are represented in binary as
strings of 0s and 1s, but other encodings are also
possible.
What is GA
īŽ The evolution usually starts from a population of
randomly generated individuals and happens in
generations.
īŽ In each generation, the fitness of every individual in
the population is evaluated, multiple individuals are
selected from the current population (based on their
fitness), and modified (recombined and possibly
mutated) to form a new population.
What is GA
īŽ The new population is then used in the next
iteration of the algorithm.
īŽ Commonly, the algorithm terminates when
either a maximum number of generations has
been produced, or a satisfactory fitness level
has been reached for the population.
īŽ If the algorithm has terminated due to a
maximum number of generations, a
satisfactory solution may or may not have been
reached.
Key terms
īŽ Individual - Any possible solution
īŽ Population - Group of all individuals
īŽ Search Space - All possible solutions to the problem
īŽ Chromosome - Blueprint for an individual
īŽ Trait - Possible aspect (features) of an individual
īŽ Allele - Possible settings of trait (black, blond, etc.)
īŽ Locus - The position of a gene on the chromosome
īŽ Genome - Collection of all chromosomes for an
individual
Chromosome, Genes and
Genomes
Genotype and Phenotype
īŽ Genotype:
– Particular set of genes in a genome
īŽ Phenotype:
– Physical characteristic of the genotype
(smart, beautiful, healthy, etc.)
Genotype and Phenotype
GA Requirements
īŽ A typical genetic algorithm requires two things to be defined:
īŽ a genetic representation of the solution domain, and
īŽ a fitness function to evaluate the solution domain.
īŽ A standard representation of the solution is as an array of bits.
Arrays of other types and structures can be used in essentially
the same way.
īŽ The main property that makes these genetic representations
convenient is that their parts are easily aligned due to their
fixed size, that facilitates simple crossover operation.
īŽ Variable length representations may also be used, but
crossover implementation is more complex in this case.
īŽ Tree-like representations are explored in Genetic
programming.
Representation
Chromosomes could be:
īŽ Bit strings (0101 ... 1100)
īŽ Real numbers (43.2 -33.1 ... 0.0 89.2)
īŽ Permutations of element (E11 E3 E7 ... E1 E15)
īŽ Lists of rules (R1 R2 R3 ... R22 R23)
īŽ Program elements (genetic programming)
īŽ ... any data structure ...
GA Requirements
īŽ The fitness function is defined over the genetic representation
and measures the quality of the represented solution.
īŽ The fitness function is always problem dependent.
īŽ For instance, in the knapsack problem we want to maximize
the total value of objects that we can put in a knapsack of some
fixed capacity.
īŽ A representation of a solution might be an array of bits, where
each bit represents a different object, and the value of the bit (0
or 1) represents whether or not the object is in the knapsack.
īŽ Not every such representation is valid, as the size of objects
may exceed the capacity of the knapsack.
īŽ The fitness of the solution is the sum of values of all objects in
the knapsack if the representation is valid, or 0 otherwise. In
some problems, it is hard or even impossible to define the
fitness expression; in these cases, interactive genetic
algorithms are used.
A fitness function
Basics of GA
īŽ The most common type of genetic algorithm works like this:
īŽ a population is created with a group of individuals created
randomly.
īŽ The individuals in the population are then evaluated.
īŽ The evaluation function is provided by the programmer and
gives the individuals a score based on how well they perform
at the given task.
īŽ Two individuals are then selected based on their fitness, the
higher the fitness, the higher the chance of being selected.
īŽ These individuals then "reproduce" to create one or more
offspring, after which the offspring are mutated randomly.
īŽ This continues until a suitable solution has been found or a
certain number of generations have passed, depending on the
needs of the programmer.
General Algorithm for GA
īŽ Initialization
īŽ Initially many individual solutions are randomly
generated to form an initial population. The
population size depends on the nature of the problem,
but typically contains several hundreds or thousands
of possible solutions.
īŽ Traditionally, the population is generated randomly,
covering the entire range of possible solutions (the
search space).
īŽ Occasionally, the solutions may be "seeded" in areas
where optimal solutions are likely to be found.
General Algorithm for GA
īŽ Selection
īŽ During each successive generation, a proportion of the existing
population is selected to breed a new generation.
īŽ Individual solutions are selected through a fitness-based
process, where fitter solutions (as measured by a fitness
function) are typically more likely to be selected.
īŽ Certain selection methods rate the fitness of each solution and
preferentially select the best solutions. Other methods rate only
a random sample of the population, as this process may be
very time-consuming.
īŽ Most functions are stochastic and designed so that a small
proportion of less fit solutions are selected. This helps keep the
diversity of the population large, preventing premature
convergence on poor solutions. Popular and well-studied
selection methods include roulette wheel selection and
tournament selection.
General Algorithm for GA
īŽ In roulette wheel selection, individuals are
given a probability of being selected that is
directly proportionate to their fitness.
īŽ Two individuals are then chosen randomly
based on these probabilities and produce
offspring.
General Algorithm for GA
Roulette Wheel’s Selection Pseudo Code:
for all members of population
sum += fitness of this individual
end for
for all members of population
probability = sum of probabilities + (fitness / sum)
sum of probabilities += probability
end for
loop until new population is full
do this twice
number = Random between 0 and 1
for all members of population
if number > probability but less than next probability then
you have been selected
end for
end
create offspring
end loop
General Algorithm for GA
īŽ Reproduction
īŽ The next step is to generate a second generation population of
solutions from those selected through genetic operators:
crossover (also called recombination), and/or mutation.
īŽ For each new solution to be produced, a pair of "parent"
solutions is selected for breeding from the pool selected
previously.
īŽ By producing a "child" solution using the above methods of
crossover and mutation, a new solution is created which
typically shares many of the characteristics of its "parents".
New parents are selected for each child, and the process
continues until a new population of solutions of appropriate
size is generated.
General Algorithm for GA
īŽ These processes ultimately result in the next
generation population of chromosomes that is
different from the initial generation.
īŽ Generally the average fitness will have
increased by this procedure for the population,
since only the best organisms from the first
generation are selected for breeding, along
with a small proportion of less fit solutions, for
reasons already mentioned above.
Crossover
īŽ the most common type is single point crossover. In single
point crossover, you choose a locus at which you swap the
remaining alleles from on parent to the other. This is complex
and is best understood visually.
īŽ As you can see, the children take one section of the
chromosome from each parent.
īŽ The point at which the chromosome is broken depends on the
randomly selected crossover point.
īŽ This particular method is called single point crossover because
only one crossover point exists. Sometimes only child 1 or
child 2 is created, but oftentimes both offspring are created and
put into the new population.
īŽ Crossover does not always occur, however. Sometimes, based
on a set probability, no crossover occurs and the parents are
copied directly to the new population. The probability of
crossover occurring is usually 60% to 70%.
Crossover
Mutation
īŽ After selection and crossover, you now have a new population
full of individuals.
īŽ Some are directly copied, and others are produced by
crossover.
īŽ In order to ensure that the individuals are not all exactly the
same, you allow for a small chance of mutation.
īŽ You loop through all the alleles of all the individuals, and if
that allele is selected for mutation, you can either change it by
a small amount or replace it with a new value. The probability
of mutation is usually between 1 and 2 tenths of a percent.
īŽ Mutation is fairly simple. You just change the selected alleles
based on what you feel is necessary and move on. Mutation is,
however, vital to ensuring genetic diversity within the
population.
Mutation
General Algorithm for GA
īŽ Termination
īŽ This generational process is repeated until a
termination condition has been reached.
īŽ Common terminating conditions are:
īŽ A solution is found that satisfies minimum criteria
īŽ Fixed number of generations reached
īŽ Allocated budget (computation time/money) reached
īŽ The highest ranking solution's fitness is reaching or has
reached a plateau such that successive iterations no longer
produce better results
īŽ Manual inspection
īŽ Any Combinations of the above
GA Pseudo-code
Choose initial population
Evaluate the fitness of each individual in the population
Repeat
Select best-ranking individuals to reproduce
Breed new generation through crossover and mutation (genetic
operations) and give birth to offspring
Evaluate the individual fitnesses of the offspring
Replace worst ranked part of population with offspring
Until <terminating condition>
Symbolic AI VS. Genetic Algorithms
īŽ Most symbolic AI systems are very static.
īŽ Most of them can usually only solve one given
specific problem, since their architecture was
designed for whatever that specific problem was in
the first place.
īŽ Thus, if the given problem were somehow to be
changed, these systems could have a hard time
adapting to them, since the algorithm that would
originally arrive to the solution may be either
incorrect or less efficient.
īŽ Genetic algorithms (or GA) were created to combat
these problems; they are basically algorithms based
on natural biological evolution.
Symbolic AI VS. Genetic Algorithms
īŽ The architecture of systems that implement genetic algorithms
(or GA) are more able to adapt to a wide range of problems.
īŽ A GA functions by generating a large set of possible solutions
to a given problem.
īŽ It then evaluates each of those solutions, and decides on a
"fitness level" (you may recall the phrase: "survival of the
fittest") for each solution set.
īŽ These solutions then breed new solutions.
īŽ The parent solutions that were more "fit" are more likely to
reproduce, while those that were less "fit" are more unlikely to
do so.
īŽ In essence, solutions are evolved over time. This way you
evolve your search space scope to a point where you can find
the solution.
īŽ Genetic algorithms can be incredibly efficient if programmed
correctly.
Genetic Programming
īŽ In programming languages such as LISP, the mathematical
notation is not written in standard notation, but in prefix
notation. Some examples of this:
īŽ + 2 1 : 2 + 1
īŽ * + 2 1 2 : 2 * (2+1)
īŽ * + - 2 1 4 9 : 9 * ((2 - 1) + 4)
īŽ Notice the difference between the left-hand side to the right?
Apart from the order being different, no parenthesis! The
prefix method makes it a lot easier for programmers and
compilers alike, because order precedence is not an issue.
īŽ You can build expression trees out of these strings that then
can be easily evaluated, for example, here are the trees for the
above three expressions.
Genetic Programming
Genetic Programming
īŽ You can see how expression evaluation is thus a lot
easier.
īŽ What this have to do with GAs? If for example you
have numerical data and 'answers', but no expression
to conjoin the data with the answers.
īŽ A genetic algorithm can be used to 'evolve' an
expression tree to create a very close fit to the data.
īŽ By 'splicing' and 'grafting' the trees and evaluating
the resulting expression with the data and testing it to
the answers, the fitness function can return how close
the expression is.
Genetic Programming
īŽ The limitations of genetic programming lie in
the huge search space the GAs have to search
for - an infinite number of equations.
īŽ Therefore, normally before running a GA to
search for an equation, the user tells the
program which operators and numerical ranges
to search under.
īŽ Uses of genetic programming can lie in stock
market prediction, advanced mathematics and
military applications .
Evolving Neural Networks
īŽ Evolving the architecture of neural network is
slightly more complicated, and there have been
several ways of doing it. For small nets, a
simple matrix represents which neuron
connects which, and then this matrix is, in
turn, converted into the necessary 'genes', and
various combinations of these are evolved.
Evolving Neural Networks
īŽ Many would think that a learning function could be
evolved via genetic programming. Unfortunately,
genetic programming combined with neural networks
could be incredibly slow, thus impractical.
īŽ As with many problems, you have to constrain what
you are attempting to create.
īŽ For example, in 1990, David Chalmers attempted to
evolve a function as good as the delta rule.
īŽ He did this by creating a general equation based upon
the delta rule with 8 unknowns, which the genetic
algorithm then evolved.
Other Areas
īŽ Genetic Algorithms can be applied to virtually any problem
that has a large search space.
īŽ Al Biles uses genetic algorithms to filter out 'good' and 'bad'
riffs for jazz improvisation.
īŽ The military uses GAs to evolve equations to differentiate
between different radar returns.
īŽ Stock companies use GA-powered programs to predict the
stock market.
Example
īŽ f(x) = {MAX(x2): 0 <= x <= 32 }
īŽ Encode Solution: Just use 5 bits (1 or 0).
īŽ Generate initial population.
īŽ Evaluate each solution against objective.
Sol. String Fitness % of Total
A 01101 169 14.4
B 11000 576 49.2
C 01000 64 5.5
D 10011 361 30.9
A 0 1 1 0 1
B 1 1 0 0 0
C 0 1 0 0 0
D 1 0 0 1 1
Example Cont’d
īŽ Create next generation of solutions
īŽ Probability of “being a parent” depends on the fitness.
īŽ Ways for parents to create next generation
īŽ Reproduction
īŽ Use a string again unmodified.
īŽ Crossover
īŽ Cut and paste portions of one string to another.
īŽ Mutation
īŽ Randomly flip a bit.
īŽ COMBINATION of all of the above.
Checkboard example
īŽ We are given an n by n checkboard in which every field
can have a different colour from a set of four colors.
īŽ Goal is to achieve a checkboard in a way that there are no
neighbours with the same color (not diagonal)
1 2 3 4 5 6 7 8 9 10
1
2
3
4
5
6
7
8
9
10
1 2 3 4 5 6 7 8 9 10
1
2
3
4
5
6
7
8
9
10
Checkboard example Cont’d
īŽ Chromosomes represent the way the checkboard is colored.
īŽ Chromosomes are not represented by bitstrings but by
bitmatrices
īŽ The bits in the bitmatrix can have one of the four values 0,
1, 2 or 3, depending on the color.
īŽ Crossing-over involves matrix manipulation instead of
point wise operating.
īŽ Crossing-over can be combining the parential matrices in a
horizontal, vertical, triangular or square way.
īŽ Mutation remains bitwise changing bits in either one of the
other numbers.
Checkboard example Cont’d
â€ĸ This problem can be seen as a graph with n nodes
and (n-1) edges, so the fitness f(x) is defined as:
f(x) = 2 ¡ (n-1) ¡n
Checkboard example Cont’d
â€ĸ Fitnesscurves for different cross-over rules:
0 100 200 300 400 500
130
140
150
160
170
180
Fitness
Lower-Triangular Crossing Over
0 200 400 600 800
130
140
150
160
170
180
Square Crossing Over
0 200 400 600 800
130
140
150
160
170
180
Generations
Fitness
Horizontal Cutting Crossing Over
0 500 1000 1500
130
140
150
160
170
180
Generations
Verical Cutting Crossing Over
Questions
??
THANK YOU

More Related Content

Similar to Genetic-Algorithms for machine learning and ai.ppt

Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmRespa Peter
 
Document1
Document1Document1
Document1shruti0293
 
Genetic Algorithm 2 -.pptx
Genetic Algorithm 2 -.pptxGenetic Algorithm 2 -.pptx
Genetic Algorithm 2 -.pptxTAHANMKH
 
Data Science - Part XIV - Genetic Algorithms
Data Science - Part XIV - Genetic AlgorithmsData Science - Part XIV - Genetic Algorithms
Data Science - Part XIV - Genetic AlgorithmsDerek Kane
 
Genetic algorithm fitness function
Genetic algorithm fitness functionGenetic algorithm fitness function
Genetic algorithm fitness functionProf Ansari
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsAmna Saeed
 
A genetic algorithm approach to static job shop scheduling
A genetic algorithm approach to static job shop schedulingA genetic algorithm approach to static job shop scheduling
A genetic algorithm approach to static job shop schedulingNagendra Bvs
 
CSA 3702 machine learning module 4
CSA 3702 machine learning module 4CSA 3702 machine learning module 4
CSA 3702 machine learning module 4Nandhini S
 
Genetic algorithms full lecture
Genetic algorithms full lectureGenetic algorithms full lecture
Genetic algorithms full lecturesadiacs
 
Genetic Algorithm (1).pdf
Genetic Algorithm (1).pdfGenetic Algorithm (1).pdf
Genetic Algorithm (1).pdfAzmiNizar1
 
Evolutionary computing - soft computing
Evolutionary computing - soft computingEvolutionary computing - soft computing
Evolutionary computing - soft computingSakshiMahto1
 
Advanced Optimization Techniques
Advanced Optimization TechniquesAdvanced Optimization Techniques
Advanced Optimization TechniquesValerie Felton
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsDEEPIKA T
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsbhuvaneshwariA5
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithmsRimpleDhamija
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithmgarima931
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GAIshucs
 
generic optimization techniques lecture slides
generic optimization techniques  lecture slidesgeneric optimization techniques  lecture slides
generic optimization techniques lecture slidesSardarHamidullah
 

Similar to Genetic-Algorithms for machine learning and ai.ppt (20)

Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Document1
Document1Document1
Document1
 
Ga
GaGa
Ga
 
Genetic Algorithm 2 -.pptx
Genetic Algorithm 2 -.pptxGenetic Algorithm 2 -.pptx
Genetic Algorithm 2 -.pptx
 
Data Science - Part XIV - Genetic Algorithms
Data Science - Part XIV - Genetic AlgorithmsData Science - Part XIV - Genetic Algorithms
Data Science - Part XIV - Genetic Algorithms
 
Genetic algorithm fitness function
Genetic algorithm fitness functionGenetic algorithm fitness function
Genetic algorithm fitness function
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Gadoc
GadocGadoc
Gadoc
 
A genetic algorithm approach to static job shop scheduling
A genetic algorithm approach to static job shop schedulingA genetic algorithm approach to static job shop scheduling
A genetic algorithm approach to static job shop scheduling
 
CSA 3702 machine learning module 4
CSA 3702 machine learning module 4CSA 3702 machine learning module 4
CSA 3702 machine learning module 4
 
Genetic algorithms full lecture
Genetic algorithms full lectureGenetic algorithms full lecture
Genetic algorithms full lecture
 
Genetic Algorithm (1).pdf
Genetic Algorithm (1).pdfGenetic Algorithm (1).pdf
Genetic Algorithm (1).pdf
 
Evolutionary computing - soft computing
Evolutionary computing - soft computingEvolutionary computing - soft computing
Evolutionary computing - soft computing
 
Advanced Optimization Techniques
Advanced Optimization TechniquesAdvanced Optimization Techniques
Advanced Optimization Techniques
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Genetic algorithms
Genetic algorithmsGenetic algorithms
Genetic algorithms
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Flowchart of GA
Flowchart of GAFlowchart of GA
Flowchart of GA
 
generic optimization techniques lecture slides
generic optimization techniques  lecture slidesgeneric optimization techniques  lecture slides
generic optimization techniques lecture slides
 

More from neelamsanjeevkumar

HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENG
HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENGHILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENG
HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENGneelamsanjeevkumar
 
simulated aneeleaning in artificial intelligence .pptx
simulated aneeleaning in artificial intelligence .pptxsimulated aneeleaning in artificial intelligence .pptx
simulated aneeleaning in artificial intelligence .pptxneelamsanjeevkumar
 
Feed forward back propogation algorithm .pptx
Feed forward back propogation algorithm .pptxFeed forward back propogation algorithm .pptx
Feed forward back propogation algorithm .pptxneelamsanjeevkumar
 
IOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptxIOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptxneelamsanjeevkumar
 
Genetic-Algorithms forv artificial .ppt
Genetic-Algorithms forv artificial  .pptGenetic-Algorithms forv artificial  .ppt
Genetic-Algorithms forv artificial .pptneelamsanjeevkumar
 
Genetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .pptGenetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .pptneelamsanjeevkumar
 
Stepwise Selection Choosing the Optimal Model .ppt
Stepwise Selection  Choosing the Optimal Model .pptStepwise Selection  Choosing the Optimal Model .ppt
Stepwise Selection Choosing the Optimal Model .pptneelamsanjeevkumar
 
the connection of iot with lora pan which enable
the connection of iot with lora pan which enablethe connection of iot with lora pan which enable
the connection of iot with lora pan which enableneelamsanjeevkumar
 
what is lorapan ,explanation of iot module with
what is lorapan ,explanation of iot module withwhat is lorapan ,explanation of iot module with
what is lorapan ,explanation of iot module withneelamsanjeevkumar
 
What is First Order Logic in AI or FOL in AI.docx
What is First Order Logic in AI or FOL in AI.docxWhat is First Order Logic in AI or FOL in AI.docx
What is First Order Logic in AI or FOL in AI.docxneelamsanjeevkumar
 
unit2_mental objects pruning and game theory .pptx
unit2_mental objects pruning and game theory .pptxunit2_mental objects pruning and game theory .pptx
unit2_mental objects pruning and game theory .pptxneelamsanjeevkumar
 
2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptxneelamsanjeevkumar
 
Adaline and Madaline.ppt
Adaline and Madaline.pptAdaline and Madaline.ppt
Adaline and Madaline.pptneelamsanjeevkumar
 
Neural networks are parallel computing devices.docx.pdf
Neural networks are parallel computing devices.docx.pdfNeural networks are parallel computing devices.docx.pdf
Neural networks are parallel computing devices.docx.pdfneelamsanjeevkumar
 
An_Introduction_To_The_Backpropagation_A.ppt
An_Introduction_To_The_Backpropagation_A.pptAn_Introduction_To_The_Backpropagation_A.ppt
An_Introduction_To_The_Backpropagation_A.pptneelamsanjeevkumar
 

More from neelamsanjeevkumar (20)

HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENG
HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENGHILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENG
HILL CLIMBING FOR ELECTRONICS AND COMMUNICATION ENG
 
simulated aneeleaning in artificial intelligence .pptx
simulated aneeleaning in artificial intelligence .pptxsimulated aneeleaning in artificial intelligence .pptx
simulated aneeleaning in artificial intelligence .pptx
 
Feed forward back propogation algorithm .pptx
Feed forward back propogation algorithm .pptxFeed forward back propogation algorithm .pptx
Feed forward back propogation algorithm .pptx
 
IOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptxIOT Unit 3 for engineering second year .pptx
IOT Unit 3 for engineering second year .pptx
 
Genetic-Algorithms forv artificial .ppt
Genetic-Algorithms forv artificial  .pptGenetic-Algorithms forv artificial  .ppt
Genetic-Algorithms forv artificial .ppt
 
Genetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .pptGenetic_Algorithms_genetic for_data .ppt
Genetic_Algorithms_genetic for_data .ppt
 
Stepwise Selection Choosing the Optimal Model .ppt
Stepwise Selection  Choosing the Optimal Model .pptStepwise Selection  Choosing the Optimal Model .ppt
Stepwise Selection Choosing the Optimal Model .ppt
 
the connection of iot with lora pan which enable
the connection of iot with lora pan which enablethe connection of iot with lora pan which enable
the connection of iot with lora pan which enable
 
what is lorapan ,explanation of iot module with
what is lorapan ,explanation of iot module withwhat is lorapan ,explanation of iot module with
what is lorapan ,explanation of iot module with
 
What is First Order Logic in AI or FOL in AI.docx
What is First Order Logic in AI or FOL in AI.docxWhat is First Order Logic in AI or FOL in AI.docx
What is First Order Logic in AI or FOL in AI.docx
 
unit2_mental objects pruning and game theory .pptx
unit2_mental objects pruning and game theory .pptxunit2_mental objects pruning and game theory .pptx
unit2_mental objects pruning and game theory .pptx
 
2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx2_RaspberryPi presentation.pptx
2_RaspberryPi presentation.pptx
 
LINEAR REGRESSION.pptx
LINEAR REGRESSION.pptxLINEAR REGRESSION.pptx
LINEAR REGRESSION.pptx
 
Adaline and Madaline.ppt
Adaline and Madaline.pptAdaline and Madaline.ppt
Adaline and Madaline.ppt
 
Neural networks are parallel computing devices.docx.pdf
Neural networks are parallel computing devices.docx.pdfNeural networks are parallel computing devices.docx.pdf
Neural networks are parallel computing devices.docx.pdf
 
PRNN syllabus.pdf
PRNN syllabus.pdfPRNN syllabus.pdf
PRNN syllabus.pdf
 
PRNN syllabus.pdf
PRNN syllabus.pdfPRNN syllabus.pdf
PRNN syllabus.pdf
 
backprop.ppt
backprop.pptbackprop.ppt
backprop.ppt
 
feedforward-network-
feedforward-network-feedforward-network-
feedforward-network-
 
An_Introduction_To_The_Backpropagation_A.ppt
An_Introduction_To_The_Backpropagation_A.pptAn_Introduction_To_The_Backpropagation_A.ppt
An_Introduction_To_The_Backpropagation_A.ppt
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 

Genetic-Algorithms for machine learning and ai.ppt

  • 2. Introduction īŽ After scientists became disillusioned with classical and neo-classical attempts at modeling intelligence, they looked in other directions. īŽ Two prominent fields arose, connectionism (neural networking, parallel processing) and evolutionary computing. īŽ It is the latter that this essay deals with - genetic algorithms and genetic programming.
  • 3. What is GA īŽ A genetic algorithm (or GA) is a search technique used in computing to find true or approximate solutions to optimization and search problems. īŽ Genetic algorithms are categorized as global search heuristics. īŽ Genetic algorithms are a particular class of evolutionary algorithms that use techniques inspired by evolutionary biology such as inheritance, mutation, selection, and crossover (also called recombination).
  • 4. What is GA īŽ Genetic algorithms are implemented as a computer simulation in which a population of abstract representations (called chromosomes or the genotype or the genome) of candidate solutions (called individuals, creatures, or phenotypes) to an optimization problem evolves toward better solutions. īŽ Traditionally, solutions are represented in binary as strings of 0s and 1s, but other encodings are also possible.
  • 5. What is GA īŽ The evolution usually starts from a population of randomly generated individuals and happens in generations. īŽ In each generation, the fitness of every individual in the population is evaluated, multiple individuals are selected from the current population (based on their fitness), and modified (recombined and possibly mutated) to form a new population.
  • 6. What is GA īŽ The new population is then used in the next iteration of the algorithm. īŽ Commonly, the algorithm terminates when either a maximum number of generations has been produced, or a satisfactory fitness level has been reached for the population. īŽ If the algorithm has terminated due to a maximum number of generations, a satisfactory solution may or may not have been reached.
  • 7. Key terms īŽ Individual - Any possible solution īŽ Population - Group of all individuals īŽ Search Space - All possible solutions to the problem īŽ Chromosome - Blueprint for an individual īŽ Trait - Possible aspect (features) of an individual īŽ Allele - Possible settings of trait (black, blond, etc.) īŽ Locus - The position of a gene on the chromosome īŽ Genome - Collection of all chromosomes for an individual
  • 9. Genotype and Phenotype īŽ Genotype: – Particular set of genes in a genome īŽ Phenotype: – Physical characteristic of the genotype (smart, beautiful, healthy, etc.)
  • 11. GA Requirements īŽ A typical genetic algorithm requires two things to be defined: īŽ a genetic representation of the solution domain, and īŽ a fitness function to evaluate the solution domain. īŽ A standard representation of the solution is as an array of bits. Arrays of other types and structures can be used in essentially the same way. īŽ The main property that makes these genetic representations convenient is that their parts are easily aligned due to their fixed size, that facilitates simple crossover operation. īŽ Variable length representations may also be used, but crossover implementation is more complex in this case. īŽ Tree-like representations are explored in Genetic programming.
  • 12. Representation Chromosomes could be: īŽ Bit strings (0101 ... 1100) īŽ Real numbers (43.2 -33.1 ... 0.0 89.2) īŽ Permutations of element (E11 E3 E7 ... E1 E15) īŽ Lists of rules (R1 R2 R3 ... R22 R23) īŽ Program elements (genetic programming) īŽ ... any data structure ...
  • 13. GA Requirements īŽ The fitness function is defined over the genetic representation and measures the quality of the represented solution. īŽ The fitness function is always problem dependent. īŽ For instance, in the knapsack problem we want to maximize the total value of objects that we can put in a knapsack of some fixed capacity. īŽ A representation of a solution might be an array of bits, where each bit represents a different object, and the value of the bit (0 or 1) represents whether or not the object is in the knapsack. īŽ Not every such representation is valid, as the size of objects may exceed the capacity of the knapsack. īŽ The fitness of the solution is the sum of values of all objects in the knapsack if the representation is valid, or 0 otherwise. In some problems, it is hard or even impossible to define the fitness expression; in these cases, interactive genetic algorithms are used.
  • 15. Basics of GA īŽ The most common type of genetic algorithm works like this: īŽ a population is created with a group of individuals created randomly. īŽ The individuals in the population are then evaluated. īŽ The evaluation function is provided by the programmer and gives the individuals a score based on how well they perform at the given task. īŽ Two individuals are then selected based on their fitness, the higher the fitness, the higher the chance of being selected. īŽ These individuals then "reproduce" to create one or more offspring, after which the offspring are mutated randomly. īŽ This continues until a suitable solution has been found or a certain number of generations have passed, depending on the needs of the programmer.
  • 16. General Algorithm for GA īŽ Initialization īŽ Initially many individual solutions are randomly generated to form an initial population. The population size depends on the nature of the problem, but typically contains several hundreds or thousands of possible solutions. īŽ Traditionally, the population is generated randomly, covering the entire range of possible solutions (the search space). īŽ Occasionally, the solutions may be "seeded" in areas where optimal solutions are likely to be found.
  • 17. General Algorithm for GA īŽ Selection īŽ During each successive generation, a proportion of the existing population is selected to breed a new generation. īŽ Individual solutions are selected through a fitness-based process, where fitter solutions (as measured by a fitness function) are typically more likely to be selected. īŽ Certain selection methods rate the fitness of each solution and preferentially select the best solutions. Other methods rate only a random sample of the population, as this process may be very time-consuming. īŽ Most functions are stochastic and designed so that a small proportion of less fit solutions are selected. This helps keep the diversity of the population large, preventing premature convergence on poor solutions. Popular and well-studied selection methods include roulette wheel selection and tournament selection.
  • 18. General Algorithm for GA īŽ In roulette wheel selection, individuals are given a probability of being selected that is directly proportionate to their fitness. īŽ Two individuals are then chosen randomly based on these probabilities and produce offspring.
  • 19. General Algorithm for GA Roulette Wheel’s Selection Pseudo Code: for all members of population sum += fitness of this individual end for for all members of population probability = sum of probabilities + (fitness / sum) sum of probabilities += probability end for loop until new population is full do this twice number = Random between 0 and 1 for all members of population if number > probability but less than next probability then you have been selected end for end create offspring end loop
  • 20. General Algorithm for GA īŽ Reproduction īŽ The next step is to generate a second generation population of solutions from those selected through genetic operators: crossover (also called recombination), and/or mutation. īŽ For each new solution to be produced, a pair of "parent" solutions is selected for breeding from the pool selected previously. īŽ By producing a "child" solution using the above methods of crossover and mutation, a new solution is created which typically shares many of the characteristics of its "parents". New parents are selected for each child, and the process continues until a new population of solutions of appropriate size is generated.
  • 21. General Algorithm for GA īŽ These processes ultimately result in the next generation population of chromosomes that is different from the initial generation. īŽ Generally the average fitness will have increased by this procedure for the population, since only the best organisms from the first generation are selected for breeding, along with a small proportion of less fit solutions, for reasons already mentioned above.
  • 22. Crossover īŽ the most common type is single point crossover. In single point crossover, you choose a locus at which you swap the remaining alleles from on parent to the other. This is complex and is best understood visually. īŽ As you can see, the children take one section of the chromosome from each parent. īŽ The point at which the chromosome is broken depends on the randomly selected crossover point. īŽ This particular method is called single point crossover because only one crossover point exists. Sometimes only child 1 or child 2 is created, but oftentimes both offspring are created and put into the new population. īŽ Crossover does not always occur, however. Sometimes, based on a set probability, no crossover occurs and the parents are copied directly to the new population. The probability of crossover occurring is usually 60% to 70%.
  • 24. Mutation īŽ After selection and crossover, you now have a new population full of individuals. īŽ Some are directly copied, and others are produced by crossover. īŽ In order to ensure that the individuals are not all exactly the same, you allow for a small chance of mutation. īŽ You loop through all the alleles of all the individuals, and if that allele is selected for mutation, you can either change it by a small amount or replace it with a new value. The probability of mutation is usually between 1 and 2 tenths of a percent. īŽ Mutation is fairly simple. You just change the selected alleles based on what you feel is necessary and move on. Mutation is, however, vital to ensuring genetic diversity within the population.
  • 26. General Algorithm for GA īŽ Termination īŽ This generational process is repeated until a termination condition has been reached. īŽ Common terminating conditions are: īŽ A solution is found that satisfies minimum criteria īŽ Fixed number of generations reached īŽ Allocated budget (computation time/money) reached īŽ The highest ranking solution's fitness is reaching or has reached a plateau such that successive iterations no longer produce better results īŽ Manual inspection īŽ Any Combinations of the above
  • 27. GA Pseudo-code Choose initial population Evaluate the fitness of each individual in the population Repeat Select best-ranking individuals to reproduce Breed new generation through crossover and mutation (genetic operations) and give birth to offspring Evaluate the individual fitnesses of the offspring Replace worst ranked part of population with offspring Until <terminating condition>
  • 28. Symbolic AI VS. Genetic Algorithms īŽ Most symbolic AI systems are very static. īŽ Most of them can usually only solve one given specific problem, since their architecture was designed for whatever that specific problem was in the first place. īŽ Thus, if the given problem were somehow to be changed, these systems could have a hard time adapting to them, since the algorithm that would originally arrive to the solution may be either incorrect or less efficient. īŽ Genetic algorithms (or GA) were created to combat these problems; they are basically algorithms based on natural biological evolution.
  • 29. Symbolic AI VS. Genetic Algorithms īŽ The architecture of systems that implement genetic algorithms (or GA) are more able to adapt to a wide range of problems. īŽ A GA functions by generating a large set of possible solutions to a given problem. īŽ It then evaluates each of those solutions, and decides on a "fitness level" (you may recall the phrase: "survival of the fittest") for each solution set. īŽ These solutions then breed new solutions. īŽ The parent solutions that were more "fit" are more likely to reproduce, while those that were less "fit" are more unlikely to do so. īŽ In essence, solutions are evolved over time. This way you evolve your search space scope to a point where you can find the solution. īŽ Genetic algorithms can be incredibly efficient if programmed correctly.
  • 30. Genetic Programming īŽ In programming languages such as LISP, the mathematical notation is not written in standard notation, but in prefix notation. Some examples of this: īŽ + 2 1 : 2 + 1 īŽ * + 2 1 2 : 2 * (2+1) īŽ * + - 2 1 4 9 : 9 * ((2 - 1) + 4) īŽ Notice the difference between the left-hand side to the right? Apart from the order being different, no parenthesis! The prefix method makes it a lot easier for programmers and compilers alike, because order precedence is not an issue. īŽ You can build expression trees out of these strings that then can be easily evaluated, for example, here are the trees for the above three expressions.
  • 32. Genetic Programming īŽ You can see how expression evaluation is thus a lot easier. īŽ What this have to do with GAs? If for example you have numerical data and 'answers', but no expression to conjoin the data with the answers. īŽ A genetic algorithm can be used to 'evolve' an expression tree to create a very close fit to the data. īŽ By 'splicing' and 'grafting' the trees and evaluating the resulting expression with the data and testing it to the answers, the fitness function can return how close the expression is.
  • 33. Genetic Programming īŽ The limitations of genetic programming lie in the huge search space the GAs have to search for - an infinite number of equations. īŽ Therefore, normally before running a GA to search for an equation, the user tells the program which operators and numerical ranges to search under. īŽ Uses of genetic programming can lie in stock market prediction, advanced mathematics and military applications .
  • 34. Evolving Neural Networks īŽ Evolving the architecture of neural network is slightly more complicated, and there have been several ways of doing it. For small nets, a simple matrix represents which neuron connects which, and then this matrix is, in turn, converted into the necessary 'genes', and various combinations of these are evolved.
  • 35. Evolving Neural Networks īŽ Many would think that a learning function could be evolved via genetic programming. Unfortunately, genetic programming combined with neural networks could be incredibly slow, thus impractical. īŽ As with many problems, you have to constrain what you are attempting to create. īŽ For example, in 1990, David Chalmers attempted to evolve a function as good as the delta rule. īŽ He did this by creating a general equation based upon the delta rule with 8 unknowns, which the genetic algorithm then evolved.
  • 36. Other Areas īŽ Genetic Algorithms can be applied to virtually any problem that has a large search space. īŽ Al Biles uses genetic algorithms to filter out 'good' and 'bad' riffs for jazz improvisation. īŽ The military uses GAs to evolve equations to differentiate between different radar returns. īŽ Stock companies use GA-powered programs to predict the stock market.
  • 37. Example īŽ f(x) = {MAX(x2): 0 <= x <= 32 } īŽ Encode Solution: Just use 5 bits (1 or 0). īŽ Generate initial population. īŽ Evaluate each solution against objective. Sol. String Fitness % of Total A 01101 169 14.4 B 11000 576 49.2 C 01000 64 5.5 D 10011 361 30.9 A 0 1 1 0 1 B 1 1 0 0 0 C 0 1 0 0 0 D 1 0 0 1 1
  • 38. Example Cont’d īŽ Create next generation of solutions īŽ Probability of “being a parent” depends on the fitness. īŽ Ways for parents to create next generation īŽ Reproduction īŽ Use a string again unmodified. īŽ Crossover īŽ Cut and paste portions of one string to another. īŽ Mutation īŽ Randomly flip a bit. īŽ COMBINATION of all of the above.
  • 39. Checkboard example īŽ We are given an n by n checkboard in which every field can have a different colour from a set of four colors. īŽ Goal is to achieve a checkboard in a way that there are no neighbours with the same color (not diagonal) 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
  • 40. Checkboard example Cont’d īŽ Chromosomes represent the way the checkboard is colored. īŽ Chromosomes are not represented by bitstrings but by bitmatrices īŽ The bits in the bitmatrix can have one of the four values 0, 1, 2 or 3, depending on the color. īŽ Crossing-over involves matrix manipulation instead of point wise operating. īŽ Crossing-over can be combining the parential matrices in a horizontal, vertical, triangular or square way. īŽ Mutation remains bitwise changing bits in either one of the other numbers.
  • 41. Checkboard example Cont’d â€ĸ This problem can be seen as a graph with n nodes and (n-1) edges, so the fitness f(x) is defined as: f(x) = 2 ¡ (n-1) ¡n
  • 42. Checkboard example Cont’d â€ĸ Fitnesscurves for different cross-over rules: 0 100 200 300 400 500 130 140 150 160 170 180 Fitness Lower-Triangular Crossing Over 0 200 400 600 800 130 140 150 160 170 180 Square Crossing Over 0 200 400 600 800 130 140 150 160 170 180 Generations Fitness Horizontal Cutting Crossing Over 0 500 1000 1500 130 140 150 160 170 180 Generations Verical Cutting Crossing Over