Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Genetic Algorithms: A Problem-Solving Approach using Evolution and Natural Selection, Slides of Computational Physics

An introduction to genetic algorithms (gas), a search heuristic inspired by the process of natural selection. The basic steps of implementing a ga, including the representation of problem variables as chromosomes, the definition of a fitness function, and the use of genetic operators such as crossover and mutation. The document also discusses the advantages of using gas for optimization problems and provides examples of different types of chromosome representations.

Typology: Slides

2011/2012

Uploaded on 07/05/2012

imran
imran 🇵🇰

5

(1)

16 documents

1 / 36

Toggle sidebar

Related documents


Partial preview of the text

Download Genetic Algorithms: A Problem-Solving Approach using Evolution and Natural Selection and more Slides Computational Physics in PDF only on Docsity! Introduction to Genetic Algorithms Dr. Nasir M Mirza Computational Physics Email: nasirmm@yahoo.com Docsity.com Basic genetic algorithms Step 1: Represent the problem variable domain as a chromosome of a fixed length, choose the size of a chromosome population N, the crossover probability pc and the mutation probability pm . Step 2: Define a fitness function to measure the performance, or fitness, of an individual chromosome in the problem domain. The fitness function establishes the basis for selecting chromosomes that will be mated during reproduction. Docsity.com Genetic algorithms GA represents an iterative process. Each iteration is called a generation. A typical number of generations for a simple GA can range from 50 to over 500. The entire set of generations is called a run. A common practice is to terminate a GA after a specified number of generations and then examine the best chromosomes in the population. If no satisfactory solution is found, the GA is restarted. Because GAs use a stochastic search method, the fitness of a population may remain stable for a number of generations before a superior chromosome appears. Docsity.com Now: • Consider operating on and maintaining an entire “population” of points simultaneously. • So what? It would be easier to just run my single point algorithm many times or maybe on multiple processors to save wall clock time. Docsity.com Advantage • We can now simulate the processes of natural selection and competition within our population. • We can have our candidate designs fight for places in the population of future generations (iterations). Docsity.com Basic Terminology • Gene: The fundamental physical and functional unit of heredity. • A gene is an ordered sequence of nucleotides located in a particular position on a particular chromosome that encodes a specific functional product. • Chromosome: The self-replicating genetic structures of cells each containing the entire genome of an organism. • Its main feature is its self-replicating structure Docsity.com Basic Terminology • Alleles: Alternative forms of a genetic locus. • Crossing Over: The breaking during meiosis of one maternal and one paternal chromosome, the exchange of corresponding sections of DNA, and the rejoining of the chromosomes. • This process can result in an exchange of alleles between chromosomes. • Mutation: A heritable change in the genetic makeup of an organism. Docsity.com Important Note We are not constrained by any of the rules of biological systems. • For example, we can have as many parents as we wish contribute to the makeup of our offspring; • we can have members that live forever (don’t age). What is important to note here is that we are using nature as a model for our mathematical algorithms. Docsity.com Representation of Candidate Solutions • GAs can have the following types of representations: • Binary-Coded; • Encoding as Vectors of integers; • Vectors of real numbers; • Vectors of binary bits; • Combination of the previous types; • Binary-Coded GAs must decode a chromosome into a candidate solution (CS), evaluate the CS and return the resulting fitness back to the binary-coded chromosome representing the evaluated CS. Docsity.com GAs: Binary Coded Representations • For Example, let’s say that we are trying to optimize the following function, • f(x) = x2 • for 2 ≥ x ≥ 1 • If we were to use binary-coded representations we would first need to develop a mapping function form our genotype representation (binary string) to our phenotype representation (our CS). This can be done using a mapping function: Docsity.com Encoding Individual Chromosome: 00101 Fitness = ????? d(2,1,5,00101) = 1.16 f(1.16) = 1.35 Individual Chromosome: 00101 Fitness = 1.35 The Fitness Assignment Process for Binary Coded Chromosomes (ub=2, lb=1, l=5) Binary Coded Representations: Docsity.com Encoding Vectors of real numbers • Real-Coded GAs can be regarded as GAs that operate on the actual phenotype. • For Real-Coded GAs, no genotype-to- phenotype mapping is needed. Docsity.com Real-Coded Representations Individual Chromosome: 1.16 Fitness = ????? f(1.16) = 1.35 Individual Chromosome: 1.16 Fitness = 1.35 The Fitness Assignment Process for Real Coded Chromosomes Docsity.com Encoding • Vectors of binary bits. • Useful for packing and shipping problems. 4 1 2 3 What’s in the bag: [ 0 1 1 0 ] [ 1 0 1 0 ] [ 1 1 1 1 ] Docsity.com Encoding Common Method It is common to use binary encoding for problems involving integer, real, and binary type variables. Previously we saw that vectors of bits may be useful for problems involving binary state variables (T, F) (like is item 1 in the bag?) Docsity.com Common Method The binary encoding is done primarily because of its flexibility (it handles many types of variables) and because we can take advantage of the way that computers work. Also, this method of encoding lends itself to a number of common variation operators as we will see. Docsity.com Common Method A note on flexibility: Flexibility usually comes at the expense of optimality. In our case, this method may not work best for many of the problems we do, but it should work fairly well for many of them. Specialization on a problem by problem basis will usually improve performance. Docsity.com Binary Encoding Back to why. We will not likely be doing this by hand. We will probably us a computer. All numbers in a computer are represented as a string of bits ( 1’s and 0’s). We can take advantage of this. Docsity.com Binary Encoding Because of this, it is not necessary to explicitly create vectors of bits to represent our design variables. Advantages (assuming we decided on BE): • Memory efficient • 32 bit integer value requires 4 bytes instead of what would be a minimum of 32 bytes otherwise. Docsity.com Binary Encoding Advantages (vs. explicit vectors of bits): • Code simplification • No explicit conversion from binary to decimal is necessary for use of the design variables. • Most languages support operation directly on the bits of integers. Docsity.com Binary Encoding In general: Xi-int = Xi * 10(prec) (truncated). Xi = Xi-int / 10(prec) Docsity.com 5 Basic Components • An encoded representation of solutions to the problem. • Ex. binary encoding, real number encoding, integer encoding, data structure encoding. • A means of generating an initial population. • Ex. random initialization, patterned initialization. • A means of evaluating design fitness. • Need a consistent means of determining which designs are “better” than others. • Operators for producing and selecting new designs. • Ex. selection, crossover, mutation. • Values for the parameters of the algorithm. • Ex. How much crossover and mutation, how big is population. Docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved