Genetic Algorithm Optimization Using the HP Prime Presented by Namir Shammas 1.

Slides:



Advertisements
Similar presentations
Genetic Algorithms Chapter 3. A.E. Eiben and J.E. Smith, Introduction to Evolutionary Computing Genetic Algorithms GA Quick Overview Developed: USA in.
Advertisements

Population-based metaheuristics Nature-inspired Initialize a population A new population of solutions is generated Integrate the new population into the.
Local Search Algorithms
CS6800 Advanced Theory of Computation
1 An Adaptive GA for Multi Objective Flexible Manufacturing Systems A. Younes, H. Ghenniwa, S. Areibi uoguelph.ca.
Using Parallel Genetic Algorithm in a Predictive Job Scheduling
Student : Mateja Saković 3015/2011.  Genetic algorithms are based on evolution and natural selection  Evolution is any change across successive generations.
CSM6120 Introduction to Intelligent Systems Evolutionary and Genetic Algorithms.
Tuesday, May 14 Genetic Algorithms Handouts: Lecture Notes Question: when should there be an additional review session?
CHAPTER 9 E VOLUTIONARY C OMPUTATION I : G ENETIC A LGORITHMS Organization of chapter in ISSO –Introduction and history –Coding of  –Standard GA operations.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Evolutionary Computational Intelligence
Intro to AI Genetic Algorithm Ruth Bergman Fall 2002.
Genetic Algorithms Nehaya Tayseer 1.Introduction What is a Genetic algorithm? A search technique used in computer science to find approximate solutions.
7/2/2015Intelligent Systems and Soft Computing1 Lecture 9 Evolutionary Computation: Genetic algorithms Introduction, or can evolution be intelligent? Introduction,
Intro to AI Genetic Algorithm Ruth Bergman Fall 2004.
Chapter 6: Transform and Conquer Genetic Algorithms The Design and Analysis of Algorithms.
Universidad de los Andes-CODENSA The Continuous Genetic Algorithm.
Prepared by Barış GÖKÇE 1.  Search Methods  Evolutionary Algorithms (EA)  Characteristics of EAs  Genetic Programming (GP)  Evolutionary Programming.
Genetic Algorithm.
Genetic Algorithms and Ant Colony Optimisation
Evolutionary Intelligence
© Negnevitsky, Pearson Education, CSC 4510 – Machine Learning Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Intro. ANN & Fuzzy Systems Lecture 36 GENETIC ALGORITHM (1)
Optimization in Engineering Design Georgia Institute of Technology Systems Realization Laboratory Mixed Integer Problems Most optimization algorithms deal.
Zorica Stanimirović Faculty of Mathematics, University of Belgrade
Genetic algorithms Charles Darwin "A man who dares to waste an hour of life has not discovered the value of life"
Genetic Algorithms Genetic algorithms imitate a natural optimization process: natural selection in evolution. Developed by John Holland at the University.
Genetic Algorithms Introduction Advanced. Simple Genetic Algorithms: Introduction What is it? In a Nutshell References The Pseudo Code Illustrations Applications.
1 “Genetic Algorithms are good at taking large, potentially huge search spaces and navigating them, looking for optimal combinations of things, solutions.
FINAL EXAM SCHEDULER (FES) Department of Computer Engineering Faculty of Engineering & Architecture Yeditepe University By Ersan ERSOY (Engineering Project)
Genetic Algorithms Siddhartha K. Shakya School of Computing. The Robert Gordon University Aberdeen, UK
Derivative Free Optimization G.Anuradha. Contents Genetic Algorithm Simulated Annealing Random search method Downhill simplex method.
EE459 I ntroduction to Artificial I ntelligence Genetic Algorithms Kasin Prakobwaitayakit Department of Electrical Engineering Chiangmai University.
© Negnevitsky, Pearson Education, Lecture 9 Evolutionary Computation: Genetic algorithms Introduction, or can evolution be intelligent? Introduction,
Genetic Algorithms. Evolutionary Methods Methods inspired by the process of biological evolution. Main ideas: Population of solutions Assign a score or.
2005MEE Software Engineering Lecture 11 – Optimisation Techniques.
 Negnevitsky, Pearson Education, Lecture 9 Evolutionary Computation: Genetic algorithms n Introduction, or can evolution be intelligent? n Simulation.
1 Genetic Algorithms and Ant Colony Optimisation.
Genetic Algorithms What is a GA Terms and definitions Basic algorithm.
Genetic Algorithms. 2 Overview Introduction To Genetic Algorithms (GAs) GA Operators and Parameters Genetic Algorithms To Solve The Traveling Salesman.
EE749 I ntroduction to Artificial I ntelligence Genetic Algorithms The Simple GA.
CS621: Artificial Intelligence Pushpak Bhattacharyya CSE Dept., IIT Bombay Lecture 5: Power of Heuristic; non- conventional search.
Particle Swarm Optimization Using the HP Prime Presented by Namir Shammas 1.
Solving Function Optimization Problems with Genetic Algorithms September 26, 2001 Cho, Dong-Yeon , Tel:
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
1 Contents 1. Basic Concepts 2. Algorithm 3. Practical considerations Genetic Algorithm (GA)
Genetic Algorithms. Underlying Concept  Charles Darwin outlined the principle of natural selection.  Natural Selection is the process by which evolution.
Genetic Algorithm Dr. Md. Al-amin Bhuiyan Professor, Dept. of CSE Jahangirnagar University.
Artificial Intelligence By Mr. Ejaz CIIT Sahiwal Evolutionary Computation.
1 Comparative Study of two Genetic Algorithms Based Task Allocation Models in Distributed Computing System Oğuzhan TAŞ 2005.
Genetic Algorithms. Solution Search in Problem Space.
EVOLUTIONARY SYSTEMS AND GENETIC ALGORITHMS NAME: AKSHITKUMAR PATEL STUDENT ID: GRAD POSITION PAPER.
Genetic Algorithms And other approaches for similar applications Optimization Techniques.
Genetic Algorithm(GA)
Genetic Algorithm. Outline Motivation Genetic algorithms An illustrative example Hypothesis space search.
 Presented By: Abdul Aziz Ghazi  Roll No:  Presented to: Sir Harris.
Presented By: Farid, Alidoust Vahid, Akbari 18 th May IAUT University – Faculty.
Hirophysics.com The Genetic Algorithm vs. Simulated Annealing Charles Barnes PHY 327.
Chapter 14 Genetic Algorithms.
Genetic Algorithms Author: A.E. Eiben and J.E. Smith
Genetic Algorithms.
CS621: Artificial Intelligence
Genetic Algorithms Chapter 3.
EE368 Soft Computing Genetic Algorithms.
Searching for solutions: Genetic Algorithms
Traveling Salesman Problem by Genetic Algorithm
Population Based Metaheuristics
Population Methods.
Presentation transcript:

Genetic Algorithm Optimization Using the HP Prime Presented by Namir Shammas 1

Dedication To Felix Gross for being a wonderful catalyst (pun intended) to visit his city of Berlin and for being a wonderful host. 2

Genetic Algorithms—The Basics A class of search heuristics that imitates the process of natural selection. Commonly known as GA. GA belongs to a bigger class of Evolutionary Algorithms (EA). Developed by John Holland in the 1960s at the University of Michigan. Also popularized by his student David E. Goldberg. 3

Evolutionary Algorithms— The Wild Bunch! Simulated annealing. Genetic algorithms. Differential algorithms. Ant colony optimization. Particle swarm optimization. And many others. The variants of evolutionary algorithms number near or above one hundred!! 4

GA—The Building Blocks Uses genes to represent variables. Uses chromosomes (made up several genes) to represent a data point with a set of variables. Each variable has a value based on a sequence of binary digits. The binary digits are mapped onto the ranges for each real-value variable. 5

GA—The Building Blocks Fitness function is basically the function to be optimized (minimized or maximized). The values for the function at different points (i.e. chromosomes) are cost functions. GA uses a population which corresponds to the number of observations (or probes). GA uses a number of generations that represent the number of iterations. 6

Why Stick with Binary Digits? Question that may come across your mind! “If you are storing 0s and 1s in a numeric matrix, why can’t we extend the representation of variables using 0 to 9?” Allows us to represent variables with large integers or reduce the number of digits. 7

Why Stick with Binary Digits? (Cont.) This approach SEEMS like a good idea, but its not! Main weakness is that using 0 to 9 lowers the variations in the values of the variables. The GA variant struggles with covering a wide range of values and reaching the solution. 8

GA—The Steps 1.Initialize the population of chromosomes with random values within ranges for the variables. 2.Select from the populations the fittest (one with best cost functions) chromosome to mate. Usually select the best half of the population. 3.Mate the fittest individual genes. Each two parents produce two children. 4.The children replace the lower half of unfit population of chromosomes. 9

GA—The Steps (Cont.) 3.(Ver b) Mate each entire chromosome at a single (or even multiple) crossover point. Reduces the variations in the values of variables. Each two parents produce two children. 4.(Ver b) The children replace only those population members that are less fit. This step adds more complexity: Must sort children according to fitness function. Merge the sorted children and the sorted current generation. 10

GA—The Steps (Cont.) 5.Selectively mutate the updated chromosomes. You can shield the elite chromosomes from this process to avoid losing good solutions. 6.Repeat steps 2 to 5 for the specified number of generations. You can include other criteria to stop the iterations if satisfactory results are achieved. 11

How to Initialize 12 Specify the number of bits for the genes/variables. Specify the range of values for each variable. Create a matrix of binary digits or Booleans. The number of rows equal the population size. The number of columns equal the number of variables TIMES the number of bits per variable. Set each matrix element to 1 or 0 (True of False) using a RNGs.

How to Initialize (Cont.) 13 Chromosome =[ , ,…, ] gene 1 gene 2 gene n

GA—Get New Generation 14 ChromosomeCost

Sorting the Function Values 15 Calculate the function value for each chromosome. Sort the function values and the chromosomes. You can use an index array to postpone swapping the chromosome values until the end of the sorting process.

GA—Sort by Cost Fx 16 ChromosomeCost

Selecting the Mates 17 Select pairs of the best chromosomes, starting with the fittest. Roulette selection by ranking of function value OR post-sorting position. Randomly select the fittest chromosomes using a inverse Gaussian distribution. This approach allows you to select randomly among the elite.

Roulette Selection 18 Y-axis values are calculated based cumulative sums of x(i)/∑x(i), where the x’s are ranks or function values.

Inverse Gaussian Selection 19 Use the absolute values of the resulting x’s to use the right side of the Gaussian curve and obtain the indices to the parents. Since the lowest value of the Gaussian curve is 0, you may need to add 1 (as is the case with PPL) to access the first element.

GA—Select for Mating 20 ChromosomeCost

Mating 21 With the parents paired, select a random crossover point to copy the chromosomes from the two parents to the two children.

GA—Mating 22 ChromosomeFamilyBinary Digits 3Mom(1) Dad(1) Child(1) Child(2) Mom(2) Dad(2) Child(3) Child(4)

Mutation 23 For the non-elite chromosome test the possibility that each binary digit can be mutated. For each digit, compare a uniform random number with the mutation rate. It the random number is less that the mutation rate, flip that digit.

GA—Mutation =>

GA—Iteration Results 25 Pop. After MatingPop After MutationNew Cost

How to Enhance GA? 26 There are many ways to enhance the basic GA. Use a variant of the basic GA to handle continuous (i.e. floating point) variables. This change speeds up calculations since we don’t need to map values from binary digits to floating-point values. The algorithm implementation has to be adapted for floating-point variables.

How to Enhance GA? (Cont.) 27 Initialize half of the population and assign the second half of the population complimentary values to the first half. This trick ensures that the initial population covers a wide range of values. Allow the mating parents to generate a litter of 3 or more children. Select the best two children. Select the mating crossover point at random.

How to Enhance GA? (Cont.) 28 Select the two crossover points at random. This approach gives a better mix of the parent’s chromosomes. Use a random bit mask (same number of bits as a chromosome) as a Boolean filter to select the chromosomes for either child. Allow mating of multiple parents (polygamy, or perhaps hyper-polygamy) to mate, produce a litter of children, and then select the best fit children.

How to Enhance GA? (Cont.) 29 Allow mating of multiple parents? Shackwazoo!! Need I say more?

How to Enhance GA? (Cont.) 30 Allow mating of multiple parents? Sacre Bleu!! Need I say more?

How to Enhance GA? (Cont.) 31 Include search for local optimum using hill-climbing methods. This enhancement is leads to the Memetic Algorithm (MA) based on the memes theory. The hill- climbing step can be placed in one or more stages: Enhance the entire population at the start of each iteration. Enhance the parents before mating.

How to Enhance GA? (Cont.) 32 Enhance the new children before mutation. Enhance mutated population. Apply any combination of the above with the exception of the first alternative.

How to Enhance GA? (Cont.) 33 Use masking with several of the previous mate selection methods. A mask is a binary/logical filter used to toggle the parent’s chromosome values. Allow GA to restart if early convergence occurs. And other techniques.

Test Functions 34

Test Functions Sphere function calculates the sum of squares. Optimum at x(i)=0. Sum of absolutes function calculates the sum of absolute values. Optimum at x(i)=0. 35

Test Functions Rosenbrock function 36

Test Functions Ackley function. Optimum at x(i)=0. 2d case: f(x,y)=-20*exp(-0.2* sqrt(0.5*(x^2+y^2))) – exp(0.5*(cos(2πx) + cos(2πy))+ e

Test Functions Ackley function 38

Test Functions Sphere function. Optimum at x(i)=0. 2d case: f(x,y)=x^2+y^2 39

Test Functions Sphere function 40

Test Functions Sum of absolute values function. Optimum at x(i)=0. 2d case: f(x,y)=|x|+|y| 41

Test Functions Sum of absolutes function 42

Difficult Test Functions Tripod function. Optimum is at x(i)=0. Alpine function. Optimum is at x(i)=0. Parabola function. Optimum is at x(i)=0. Griewank function. Optimum is at x(i)=0. Rosenbrock function. Optimum is at x(i)=0. Ackley function. Optimum is at x(i)=0. See Clerc, “Particle Swarm Optimization”, 2005, ISTE USA. 43

Other Test Functions Beale’s function. Optimum points are [3,0.5,3,…,0.5]. Goldstein-Price function. Optimum points at x(i)=3. Booth’s function. Optimum points at [1,3,1,…,3] Bukin function. Optimum points at [-10,1,-10,…,1] Matyas function. Optimum points at x(i)=0. See equations for the above functions and more at 44

Other Test Functions Better yet, see the following article (included with HHC2015 files) which has 175 test functions: Momin Jamil and Xin-She Yang, A literature survey of benchmark functions for global optimization problems, Int. Journal of Mathematical Modelling and Numerical Optimisation, Vol. 4, No. 2, pp. 150–194 (2013). DOI: /IJMMNO

HP Prime Code HP Prime is the first handheld calculator that can implement GA methods. Use function GA or GACont(). They implement the basic GA method WITH enhancements. GA() and GACont() have exported function MyFx() coded to use the Rosenbrock test function. To use different functions you need to edit MyFx(). 46

HP Prime Code GA() has the following parameters: pNumVars – number of variables. pNumBitsPerVar – number of bits per variable. pMaxPop – population size (i.e. number of data points). pMaxGen – number of iterations. pKeep – number of elite members. pMutationRate – mutation rate (between 0 and 1). 47

HP Prime Code pRestartAfter – number of no-improvement iterations that cause a restart. pLitterSize – the number of children of a pair of parents. pMatingMode – the mode for mating. pXLow – the array of lower limits for the variables. pXHi – the array of upper limits for the variable. 48

HP Prime Code Mating mode index has the following values: 1 – Simple sequential pairing of fit parents. 2 – Rank-based selection. 3 – Normally distributed rank selection. 4 – Roulette method selection. 5 – Mixed mating where one parent is selected sequentially from the fittest group and one at random. 6 to 10 – Use masking with the first above methods 11 – Three-parents mating. 49

HP Prime Code 50 ParameterArgument Num Variables4 Num Bits32 Num Chromosomes40 Max Generations1000 Num of Elites5 Mutation rate0.5 Restart After200 Litter size5 Mating Index1 X Low[ ] X Hi[ ]

HP Prime Code 51

HP Prime Code 52 ParameterArgument Num. of Variables4 Num. Chromosomes40 Max Generations1000 Num. of Elites5 Mutation rate0.5 Restart After200 Litter size5 Mating Index1 X Low[ ] X Hi[ ]

HP Prime Code 53

References Clever Algorithms: Nature-Inspired Programming Recipes, Jason Brownlee. See URL 54

Thank You!! 55