Stochastic Search: Part 2. Genetic Algorithms. Vincent A. Cicirello. Robotics Institute. Carnegie Mellon University

Similar documents
how should the GA proceed?

Evolutionary computation

Lecture 15: Genetic Algorithms

Crossover Techniques in GAs

Evolutionary Computation. DEIS-Cesena Alma Mater Studiorum Università di Bologna Cesena (Italia)

Scaling Up. So far, we have considered methods that systematically explore the full search space, possibly using principled pruning (A* etc.).

Lecture 9 Evolutionary Computation: Genetic algorithms

Fundamentals of Genetic Algorithms

Evolutionary computation

Matt Heavner CSE710 Fall 2009

Search. Search is a key component of intelligent problem solving. Get closer to the goal if time is not enough

Individual learning and population evolution

Local Search & Optimization

Lecture 5: Linear Genetic Programming

Evolutionary Computation

Genetic Algorithms & Modeling

The Story So Far... The central problem of this course: Smartness( X ) arg max X. Possibly with some constraints on X.

CSC 4510 Machine Learning

Fall 2003 BMI 226 / CS 426 LIMITED VALIDITY STRUCTURES

Evolutionary Computation: introduction

Local and Stochastic Search

PROBLEM SOLVING AND SEARCH IN ARTIFICIAL INTELLIGENCE

Adaptive Generalized Crowding for Genetic Algorithms

Koza s Algorithm. Choose a set of possible functions and terminals for the program.

Local Search & Optimization

Evolutionary Design I

Evolving a New Feature for a Working Program

Genetic Algorithm. Outline

Artificial Intelligence Methods (G5BAIM) - Examination

Bounded Approximation Algorithms

4 th ECADA Evolutionary Computation for the Automated Design of Algorithms GECCO WORKSHOP 2014

Chapter 8: Introduction to Evolutionary Computation

The Role of Crossover in Genetic Algorithms to Solve Optimization of a Function Problem Falih Hassan

Contents 1 Introduction 4 2 Go and genetic programming 4 3 Description of the go board evaluation function 4 4 Fitness Criteria for tness : : :

Lecture 22. Introduction to Genetic Algorithms

Interplanetary Trajectory Optimization using a Genetic Algorithm

Genetic Algorithms: Basic Principles and Applications

Artificial Intelligence (AI) Common AI Methods. Training. Signals to Perceptrons. Artificial Neural Networks (ANN) Artificial Intelligence

V. Evolutionary Computing. Read Flake, ch. 20. Genetic Algorithms. Part 5A: Genetic Algorithms 4/10/17. A. Genetic Algorithms

Local Search (Greedy Descent): Maintain an assignment of a value to each variable. Repeat:

CHAPTER 4 INTRODUCTION TO DISCRETE VARIABLE OPTIMIZATION

CSC242: Intro to AI. Lecture 5. Tuesday, February 26, 13

GENETIC ALGORITHM FOR CELL DESIGN UNDER SINGLE AND MULTIPLE PERIODS

Evolutionary Algorithms: Introduction. Department of Cybernetics, CTU Prague.

Zebo Peng Embedded Systems Laboratory IDA, Linköping University

Local and Online search algorithms

Methods for finding optimal configurations

Local Search and Optimization

Geometric Semantic Genetic Programming (GSGP): theory-laden design of variation operators

V. Evolutionary Computing. Read Flake, ch. 20. Assumptions. Genetic Algorithms. Fitness-Biased Selection. Outline of Simplified GA

Summary. AIMA sections 4.3,4.4. Hill-climbing Simulated annealing Genetic algorithms (briey) Local search in continuous spaces (very briey)

CSC242: Artificial Intelligence. Lecture 4 Local Search

Intelligens Számítási Módszerek Genetikus algoritmusok, gradiens mentes optimálási módszerek

IV. Evolutionary Computing. Read Flake, ch. 20. Assumptions. Genetic Algorithms. Fitness-Biased Selection. Outline of Simplified GA

S0214 : GPU Based Stacking Sequence Generation For Composite Skins Using GA

[Read Chapter 9] [Exercises 9.1, 9.2, 9.3, 9.4]

LOCAL SEARCH. Today. Reading AIMA Chapter , Goals Local search algorithms. Introduce adversarial search 1/31/14

CS 380: ARTIFICIAL INTELLIGENCE

A.I.: Beyond Classical Search

Integer weight training by differential evolution algorithms

Data Warehousing & Data Mining

DETECTING THE FAULT FROM SPECTROGRAMS BY USING GENETIC ALGORITHM TECHNIQUES

Havrda and Charvat Entropy Based Genetic Algorithm for Traveling Salesman Problem

Comparison of Evolutionary Methods for. Smoother Evolution. 2-4 Hikaridai, Seika-cho. Soraku-gun, Kyoto , JAPAN

Artificial Intelligence Methods (G5BAIM) - Examination

Geometric Semantic Genetic Programming (GSGP): theory-laden design of semantic mutation operators

Local search algorithms. Chapter 4, Sections 3 4 1

Evolutionary Algorithms: Introduction. The Czech Institute of Informatics, Robotics and Cybernetics CTU Prague

Lecture 1 : Data Compression and Entropy

Genetic Algorithms and Genetic Programming Lecture 17

Unit 1A: Computational Complexity

Introduction to Simulated Annealing 22c:145

LandscapeEC: Adding Geographical Structure to Cellular Evolutionary Algorithms

Evolutionary computation in high-energy physics

TUTORIAL: HYPER-HEURISTICS AND COMPUTATIONAL INTELLIGENCE

EVOLUTIONARY COMPUTATION. Th. Back, Leiden Institute of Advanced Computer Science, Leiden University, NL and

Parallel Genetic Algorithms

Columbia University. and it is not natural to add this new component. another information measure based on length of

Genetic Learning of Firms in a Competitive Market

Introduction. Genetic Algorithm Theory. Overview of tutorial. The Simple Genetic Algorithm. Jonathan E. Rowe

New rubric: AI in the news

Introduction to Evolutionary Computation

A Generalized Quantum-Inspired Evolutionary Algorithm for Combinatorial Optimization Problems

School of EECS Washington State University. Artificial Intelligence

Forming Neural Networks through Ecient and Adaptive. Coevolution. Abstract

Using Evolutionary Techniques to Hunt for Snakes and Coils

Genetic Algorithms with Dynamic Niche Sharing. for Multimodal Function Optimization. at Urbana-Champaign. IlliGAL Report No

NUMERICAL SOLUTION FOR FREDHOLM FIRST KIND INTEGRAL EQUATIONS OCCURRING IN SYNTHESIS OF ELECTROMAGNETIC FIELDS

Data Mining. Preamble: Control Application. Industrial Researcher s Approach. Practitioner s Approach. Example. Example. Goal: Maintain T ~Td

Evolution Strategies for Constants Optimization in Genetic Programming

NP and Computational Intractability

Program Evolution by Integrating EDP and GP

Heuristic Optimisation

Pengju

Genetic Algorithm approach to Solve Shortest Path and Travelling Salesman Problem

MITOCW watch?v=y6ma-zn4olk

Extended breadth-first search algorithm in practice

COMBINATION OF TAGUCHI METHOD AND ARTIFICIAL INTELLIGENCE TECHNIQUES FOR THE OPTIMAL DESIGN OF FLAT-PLATE COLLECTORS

Program Evolution by Integrating EDP and GP

Optimal Operation of Large Power System by GA Method

Transcription:

Stochastic Search: Part 2 Genetic Algorithms Vincent A. Cicirello Robotics Institute Carnegie Mellon University 5000 Forbes Avenue Pittsburgh, PA 15213 cicirello@ri.cmu.edu 1

The Genetic Algorithm (GA) The genetic algorithm is based on the mechanics of natural genetics and natural selection. Population based Survival of the ttest Variation Mutations 2

The Simple GA: Representation You begin with a population of random bit strings. Each bit string encodes some problem conguration. For example, you can encode SAT by representing each boolean variable by a position in the bit string: A B C D E F G H 1 0 0 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 1 A _:B _ C ^ :A _ C _ D ^ B _ D _:E ^ :C _:D _:E ^ :A _:C _ E And you begin with a population of n randomly generated individuals. 3

The Simple GA: Selection Selection determines which from among your initial population reproduce. As in Nature, the ttest survive. We need a measure of tness... For example, for SAT we can use the number of satised clauses. 4

The Simple GA: Selection Once we have a tness function, how do we choose which individuals survive? Fitness proportionate (Weighted roulette wheel) 1. Each individual gets a chunk of a roulette wheel proportional to its tness relative to the rest of the population. 2. Spin the roulette wheel n times where n is the size of the population. 3. Repeat selection is allowed. f0 = 3 f1 = 2 f2 = 1 f3 = 6 s3 s0 s1 s2 5

Stochastic Universal Sampling (SUS) Spin n-pointer roulette wheel once f0 = 3 f1 = 2 f2 = 1 f3 = 6 s3 s0 s1 s2 6

7

The Simple GA: Selection Other selection methods: ranking, expected number, tournaments, truncation What happens if we repeat this process iteratively? With high probability we getpopulation full of best individual in the initial population. i.e., a noisy expensive way of choosing the best from a set (not very useful by itself) 8

The Simple GA: Recombination Single point crossover Two individuals are mated at random Cross site chosen at random. Cut and splice pieces of parents to form two new individuals: 1 0 0 0 1 0 0 1 0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 9

The Simple GA: Recombination k-point crossover Instead of above, k cross sites are chosen at random More disruptive. Uniform crossover Don't choose any cross sites. Line up parents Iterate through strings and with probability p c swap bit values between strings. 10

The Simple GA: Mutation With some small probability, randomly alter a bit position (i.e., ip a 0 to a 1 or vice versa). 1. Iterate through the bit string. 2. And for each bit, with probability p m ip the bit. 0 1 1 1 1 1 0 0 0 1 1 1 1 0 0 0 What do we get if we repeat mutation iteratively on an initial population? Get a random population (i.e., perform a random walk). Not very useful by itself. 11

What do we have so far? So far we have seen three operators that separately are rather useless. Selection (by itself): inecient way of choosing best from an unordered set. Crossover (by itself): a random shue Mutation (by itself): a random walk Can we make something useful out of a combination of these? 12

Putting it all together Selection + Crossover = Innovation Selection gives us a population of the strongest individuals. Crossover attempts to combine parts of good individuals to make even better new ones. Selection + Mutation = Stochastic Hill Climbing Selection gives us a population of the strongest individuals. Mutation makes slight alterations to these. Repeating this process will weed out the bad mutations and keep the good. We essentially have the equivalent of stochastic hill climbing. 13

Putting it all together Selection + Crossover + Mutation = The Power of the GA So \selection + mutation = stochastic hill climbing" Add crossover to that, and we have stochastic hill climbing with a means of jumping to potentially \interesting" parts of the search space. Mutation is also often seen as an insurance policy against the irreversible loss of key bits. 14

The Simple GA 1. Let P := a random population of n bitstrings 2. Until \Convergence" or \bored" do 3. Let f i = Fitness(P i ) for i =1:::n 4. Let P 0 = SelectNewPopulation(P, f) 5. Pair up the individuals in P 0 at random and for each pair with probability C perform crossover replacing the parents with the children otherwise keep the parents unaltered. 6. For each P 0 i in P 0 perform mutation i.e. iterate through bitstring ipping each bit with probability M 7. Let P = P 0 So how long do we iterate this? 15

When to Stop Some possibilities: If we've found an individual with the maximum value of the tness function or After iterating entire process some prede- ned maximum number of \generations" or When population converges upon a single individual (i.e., they are all the same). When f i = f j for all P i P j in P. After some number of generations without improving upon the best so far. ::: Usually you use two or three stopping criteria. 16

Example: SAT 1 1 1 1 1 1 1 (f 0 =6) 1 0 0 0 1 0 1 (f 1 =4) 0 1 1 1 0 0 1 (f 2 =6) 0 0 0 0 0 0 0 (f 3 =6) 1 0 0 1 0 1 1 (f 4 =6) 0 1 1 0 0 1 1 (f 5 =6) A _:B _ C ^ :A _ C _ D ^ B _ D _:E ^ :C _:D _:E ^ :A _:C _ E ^ E _ F _:G ^ B _ C _ D Let's simulate one iteration of the GA given this initial population. 17

18

What about the TSP? So, how should we encode the TSP? Cities on a stack some number of bits to choose which by position. City stack B A D A C B C H E D G F E F G H encoding 101..111..110..111..000..010..110..001 F A B E C H D G 19

Why you might not want to do this Crossover parents 101..111..110..111..000..010..110..001 F A B E C H D G 000..000..000..000..000..000..000..000 A B C D E F G H children 101..111..110..111..000..000..000..000 F A B E C D G H 000..000..000..000..000..010..110..001 A B C D E H F G --children tend to differ from parents --most noticeable in 2nd child above --can be much worse!! 20

Why you might not want to do this Mutation encoding 101..111..110..111..000..010..110..001 F A B E C H D G 111..111..110..111..000..010..110..001 H A B E C G D F A single bit mutation has replaced 4 edges from parent tour!!! Can we do any better? Any suggestions? 21

Other Representations: Permutations no bitstrings F A B E C H D G F A B E C H D G but what happens with xover? F A B E C H D G A B C D E F G H F A B E E F G H A B C D C H D G 22

Partially Matched Crossover (PMX) F A B E C H D G A B C D E F G H choose 2 cross sites F A B E C H D G A B C D E F G H --work left-to-right in cross region H A B C E F G D A B E G C H D F H A B C E F G D A B E G C H D F hmmm...not any better? Respects absolute position 23

choose 2 cross sites Order Crossover (OX) F A B E C H D G A B C D E F G H -- A B -- C H D -- A B -- -- E F G -- B C H D -- -- -- A B E F G -- -- -- A B B C H D E F G A B E F G C H D A C H D E F G A B E F G C H D A Respects relative position 24

Control Parameters So far, we've dened many parameters: Crossover rate Mutation rate Max number of generations Population size And there can be many others depending on choice of operators (for example, uniform crossover has an additional parameter). Even what crossover operator we use can be seen as a parameter. Some of the possible stopping criteria have their own parameters. How do we set these? Any ideas? 25

Parameter Tuning GA parameter tuning is a wide open research area. There is no general set of rules or guidelines to follow in parameter tuning. Unfortunately, the most often used method is that of hand-tuning, or trial-and-error (i.e., make up a set, try it and see what happens, repeat). This doesn't sound pleasant. Can we do any better? 26

Parameter Tuning De Jong (1975) systematically studied the eects of the control parameters on a class of GAs. These parameters are often blindly used. Population Size Typically people set this to between 50 and 100 for the simple GA. Some feel that the appropriate population size is related to the encoding length in some way. Mutation Rate Usually set to some \low" value Some design it in such a way to lead to an expected number of mutated bits per individual (if length is 100 and 1 bit mutation desired then p M =0:01). Why not decay mutation rate? high rate early for exploration and decay rate as we begin converging toward a solution. 27

Parameter Tuning Metalevel Optimization Employing a second GA to optimize the parameters. Fitness evaluation expensive! (have to execute the primary GA some number of times! Argh!) Also, what determines tness? Quality of result? Convergence time? Combination of both and how? Adapting Control Parameters Over Time Adding parameters to encoding and evolving with solution to problem. Using problem related feedback in some way and adapting parameters based on current population in some way. 28

A Representation: Vector of Reals Are bit strings and permutations the only thing we can evolve with GAs? No. Let's take Metalevel Optimization as an example. How would we encode the control parameters of the primary GA? One possibility: bit strings. Another possibility: a vector of real valued parameters (R 1 R 2 ::: R n ) Crossover: same as with bit strings only with reals rather than bits. Mutation: Add g to some real parameter where g is drawn from a Gaussian distribution with ( =0 ). Decay over time. 29

Genetic Programming (GP) Formulated by Koza (1990?) automatic programming. as a means of Terminals: X, Y, 1, 2, zero-arg-functions, etc. Functions: +, ;,, =, >, if, ifte, etc. Programs are encoded by parse trees typically representing a computer program in Lisp. ifte > X Y X Y (ifte (> X Y) X Y) 30

GP: Random Creation After dening your terminal set and function set you randomly generate an initial population. Each random parse tree is generated as follows: 1. Let T equal an empty parse tree. 2. Let C = a random function or terminal. 3. Add C to T. 4. If C at predened maximum initial depth then choose random terminals for each of the children of C and add these to T 5. Otherwise recurse on this procedure for each of the children of C. 31

GP: Crossover Pick two parents at random based on tness. Independently, pick a random node in each of the parse trees. Swap the two subtrees identied by these nodes between the trees. ifte + > X Y X * X Y 2 Y ifte + > X * X Y X Y 2 Y 32

GP: Mutation Pick one parent at random based on tness. Pick a random node in this tree. Remove the subtree rooted here. Grow a new subtree in the same manner as the initial population was grown. ifte ifte > X Y > X - X Y X Y Y 4 33

GP 1. Let P = random initial population. 2. Until Stopping Criterion 3. Choose R% of next population P 0 from P unaltered. 4. Choose M% of next population P 0 from P and perform Mutation. 5. Choose C% of next population P 0 from P, pair up at random and perform crossover. 6. Note: (R + M + C = 100%) Repeat selection allowed. All selections based on tness. Population sizes tend to be quite large for GP (i.e., 500-1000 individuals would not be unreasonable). 34

GA Issues Choice of representation is critical (bit strings not always the best choice). Choice of genetic operators often critical. Design of tness function is often critical. A \bad" choice of encoding / tness function combo may result in poor performance. Control parameter tuning is critical and no good guidelines for doing so. 35

GA Discussion Often the \second best way" to solve a problem. But relatively easy to implement. The simple GA is blind and doesn't care about problem specics other than the tness function. Can sometimes improve performance with problem specic heuristic operators. 36