37
Introduction Biological Inspiration Search Spaces A Genetic Algorithm Experimental Setup Genetic Operators Applications Conclusions GENETIC ALGORITHMS Muhammad Adil Raja Roaming Researchers, Inc. August 12, 2014 Muhammad Adil Raja Genetic Algorithms

Genetic Algorithms

Embed Size (px)

DESCRIPTION

A small presentation about genetic algorithms and their uses.

Citation preview

Page 1: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

GENETIC ALGORITHMS

Muhammad Adil Raja

Roaming Researchers, Inc.

August 12, 2014

Muhammad Adil Raja Genetic Algorithms

Page 2: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 3: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 4: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 5: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 6: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 7: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 8: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 9: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

OUTLINE

INTRODUCTION

BIOLOGICAL INSPIRATION

SEARCH SPACES

A GENETIC ALGORITHM

EXPERIMENTAL SETUP

GENETIC OPERATORS

APPLICATIONS

CONCLUSIONS

Muhammad Adil Raja Genetic Algorithms

Page 10: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

INTRODUCTION TO GENETIC ALGORITHMS (GAS)

I Genetic algorithms are inspired by Charles Darwin’s theoryof evolution.

I Fall under the umbrella of evolutionary computing.I Idea came from John Holland.I

Muhammad Adil Raja Genetic Algorithms

Page 11: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

BIOLOGICAL INSPIRATION I

I The idea is inspired from naturalevolutionary biological systems.

I In natural biological evolutionary systems,organisms are made of cells.

I A cell is composed of a set ofchromosomes.

I Chromosomes are found in the nucleus.I Chromosomes are made of DNA. FIGURE: Structure

of a Biological CellMuhammad Adil Raja Genetic Algorithms

Page 12: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

BIOLOGICAL INSPIRATION II

I Sections of Chromosomes are calledgenes.

I DNA - deoxyribonucleic acid.I it is the genetic code that contains all the

information needed to build and maintainan organism.

FIGURE:ChromosomeStructure

Muhammad Adil Raja Genetic Algorithms

Page 13: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

BIOLOGICAL INSPIRATION III

I Each organism has a distinct number of chromosomes.I In humans every cell contains 46 chromosomes (23 pairs).I Other organisms have different numbers.I A dog has 76 chromosomes per cell.I Chromosomes come in pairs.I These are called homologous pairs (homologs).I Homologs can be imagined as matching pairs.I But they are not exactly alike.I Like a pair of shoes they can be different.

Muhammad Adil Raja Genetic Algorithms

Page 14: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SOME JARGON I

I Chromosomes are composed of DNA.I DNA (and consequently chromosomes) are made of

genes.I A chromosome contains hundreds of thousands of genes.I Trait: Each gene encodes a particular protein, e.g. eye

color.I Alleles: Possible settings for a trait (e.g. color can be blue,

brown or black).

Muhammad Adil Raja Genetic Algorithms

Page 15: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SOME JARGON II

I Locus: Each gene’s own position in chromosome.I Genome: Complete set of genetic material.I Genotype: A particular set of genes in a genome.I Phenotype: A genotype’s physical and apparent

characteristics. (e.g. color, height, intelligence etc.)

Muhammad Adil Raja Genetic Algorithms

Page 16: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

REPRODUCTION I

I Crossover: (recombination): Happens duringreproduction.

I Genes from parents recombine in a meaningful sense toform a whole new chromosome.

I Offspring.I They can be genetically mutated.

Muhammad Adil Raja Genetic Algorithms

Page 17: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

REPRODUCTION II

I Mutation: Elements of the DNA are randomly changed alittle bit.

I This change is mainly caused during reproduction by errorscommitted during copying genes from parents.

I Fitness: A measure of success of the organism in a typicalecosystem.

Muhammad Adil Raja Genetic Algorithms

Page 18: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SEARCH SPACES I

I Space of all feasible solutions.I Each point in a search space represents

one feasible solution.I Each feasible solution can be marked by

its value or fitness for a problem.I Good solutions are desired.I It is often not possible to prove what is an

optimum solution.FIGURE: A Non-LinearSearch Space

Muhammad Adil Raja Genetic Algorithms

Page 19: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SEARCH SPACES II

I Search spaces can be very non-linear.I Like a mountainous terrain.I Finding the optimum solution is the real challenge.I Many locally optimum solutions can exist.I One or few globally optimum solutions may also exist.I How to find the best one?I That is what optimization is all about.

Muhammad Adil Raja Genetic Algorithms

Page 20: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

A GENETIC ALGORITHM I

I Solutions to problems are actually evolved.I The algorithm starts with a set of randomly chosen

solutions.I The solutions can be good or really really bad.I Solutions are evaluated for their fitness.

Muhammad Adil Raja Genetic Algorithms

Page 21: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

A GENETIC ALGORITHM II

I Solutions from one population are taken and used to forma new population of better solutions.

I Solutions that are selected to form new offspring solutionsare selected according to their fitness.

I The more suitable ones have more chances to reproduce.I The algorithm is repeated until some stopping criterion is

met.

Muhammad Adil Raja Genetic Algorithms

Page 22: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

A GA LIFE CYCLE: THE PSEUDOCODE

I A GA Life Cycle: The Pseudo Code1. Create an initial population of candidate solutions to a given

problem.2. Evaluation.3. Selection.4. Reproduction.5. Evaluation.6. Replacement.7. Continue from 3.

Muhammad Adil Raja Genetic Algorithms

Page 23: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

A TYPICAL GA BREEDING CYCLE

FIGURE:

Muhammad Adil Raja Genetic Algorithms

Page 24: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

TABLE: Fiddle Parameters of a Typical GA ExperimentParameter ValueInitial Population Size 300Initial Tree Depth 6Selection Tournament Selection & Roulette WheelTournament Size 2Genetic Operators Crossover and MutationOperators Probability Type AdaptiveInitial Operator probabilities 0.5 eachSurvival Elitism and GenerationalGeneration Gap 1

Muhammad Adil Raja Genetic Algorithms

Page 25: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SELECTION

I Roulette Wheel Selection – Fitness ProportionateSelection.

I Tournament Selection.

Muhammad Adil Raja Genetic Algorithms

Page 26: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SOLUTION REPRESENTATION IN GAS I

I Depending upon the problem and its formulation, a solutioncan be represented in various ways in a GA.

I Most notable representations are:1. Binary string representation.

I This is one of the most common way of representing asolution in a GA.

I The solution is represented as a string of binary numbers.I Akin to a chromosome in biology.

2. Integer-valued arrays – Integer programming (?).3. Real-valued arrays – for continuous parameter optimization.4. Complete computer programs – as in GP.

Muhammad Adil Raja Genetic Algorithms

Page 27: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SOLUTION REPRESENTATION IN GAS II

TABLE: Binary String Representation

Chromosome 1 1101100100110110Chromosome 2 1101111000011110

Muhammad Adil Raja Genetic Algorithms

Page 28: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

CROSSOVER I

1. Randomly choose two individuals(chromosomes/individuals).

2. Choose crossover points on each one of them.3. Swap the sub-parts around crossover points to form new

offspring.

I Respect Syntactic or semantic constraints.I The child should solve the problem somehow.

Muhammad Adil Raja Genetic Algorithms

Page 29: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

CROSSOVER II

TABLE: Binary String Crossover

Chromosome 1 110110010 0110110Chromosome 2 110111100 0011110Child Chromosome 1 110110010 110111100Child Chromosome 2 0110110 0011110

Muhammad Adil Raja Genetic Algorithms

Page 30: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

MUTATION I

1. Choose a newly created offspring.

2. Pick a random gene, or a few genes, on it.

3. Change its value to something else randomly – Changeallele.

Muhammad Adil Raja Genetic Algorithms

Page 31: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

MUTATION II

TABLE: Binary String Mutation

Chromosome 1 1101100100110110Chromosome 2 1101111010011110

Muhammad Adil Raja Genetic Algorithms

Page 32: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

SURVIVAL

I ElitismI Replacement

Muhammad Adil Raja Genetic Algorithms

Page 33: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

FITNESS EVALUATION

I Mean squared error (MSE).I Chi squared error.I Scaled mean squared error.

Muhammad Adil Raja Genetic Algorithms

Page 34: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

APPLICATIONS OF GAS I

I Applications are quite too many.I GA as a hammer.I A hammer that finds almost everything else as a nail.

Muhammad Adil Raja Genetic Algorithms

Page 35: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

APPLICATIONS OF GAS II

I In regression and classification.I Regression or Classification of nonlinear problems.I In Telecommunications: Speech quality estimation.I In Computer Networks: Network coding.I In Finance: In evolving effective bidding strategies.I In Clinical: Cancer detectors, seizure detectors, mental

health diagnosis etc.

Muhammad Adil Raja Genetic Algorithms

Page 36: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

APPLICATIONS OF GAS III

I In evolving chess players.I In evolving antenna designs.I Evolvable hardware.

Muhammad Adil Raja Genetic Algorithms

Page 37: Genetic Algorithms

IntroductionBiological Inspiration

Search SpacesA Genetic AlgorithmExperimental Setup

Genetic OperatorsApplicationsConclusions

CONCLUSIONS

I GAs are strong problem solving algorithms.I They can be applied to a large number of optimization

problems.I Alternative solution representations render them suitable

for a wide variety of problem domains.I They are easy to understand.I The analogue from biological evolution is quite helpful.I They are easy to implement and fun to use.I They can be used to solved difficult problems.I Particularly suitable for finding acceptable solutions to

otherwise intractable problems.I ...

Muhammad Adil Raja Genetic Algorithms