Presentation is loading. Please wait.

Presentation is loading. Please wait.

Algorithms and their Applications CS2004 (2012-2013) 13.1 Further Evolutionary Computation.

Similar presentations


Presentation on theme: "Algorithms and their Applications CS2004 (2012-2013) 13.1 Further Evolutionary Computation."— Presentation transcript:

1 Algorithms and their Applications CS2004 (2012-2013) 13.1 Further Evolutionary Computation

2 Further Evolutionary ComputationSlide 2 Recap – Genetic Algorithms Genetic Algorithms Genetic Algorithms (GA) are a powerful tool Based on the biological theory of evolution The correct use is down to experience genetic operators The GA involves the iterative application of a number of genetic operators There are a number of parameters that need to be carefully selected

3 Further Evolutionary ComputationSlide 3 Holland’s Algorithm Input: The GA parameters: NG, PS, CP, MP and n The Fitness Function 1) Generate PS random Chromosomes of length n 2) For i = 1 to NG 3) Crossover Population, with chance CP per Chromosome 4)Mutate all the Population, with chance MP per gene 5)Kill off all Invalid Chromosomes 6)Survival of Fittest, e.g. Roulette Wheel 7) End For Output: The best solution to the problem is the Chromosome in the last generation (the NGth population) which has the best fitness value

4 Further Evolutionary ComputationSlide 4 The Parts of Holland’s Algorithm Initial population Create an initial population of random solutions to the problem Crossover Pair up those allowed to breed and recombine genes from the parents to produce new children Mutation Mutate some of the genes of some of the chromosomes Kill off invalid chromosomes Survival of the fittest Select the fittest to survive to the next generation

5 Further Evolutionary ComputationSlide 5 In This Lecture We are going to look at: An application of Genetic Algorithms Evolutionary Programming Genetic Programming Related Areas

6 Further Evolutionary ComputationSlide 6 The Eight Queens (EQ) – Part 1 The problem is to place the eight Queens on a chess board such that none of the Queens are attacking each other

7 Further Evolutionary ComputationSlide 7 The Eight Queens (EQ) – Part 2 Queens can attack in straight lines and diagonal lines In the example below the Queens are attacking each other

8 Further Evolutionary ComputationSlide 8 The Eight Queens (EQ) – Part 3 In order to solve this problem using a Genetic Algorithm we need the following: A representation A fitness function Parameter values

9 Further Evolutionary ComputationSlide 9 EQ Representation – Part 1 Only one queen on each row 8 sets of 3 bits 0-7 for the column number the Queen occupies Total of 24 bits Each set of 3 represents the row and then the position on that row There are no invalid chromosomes

10 Further Evolutionary ComputationSlide 10 EQ Representation – Part 2 Representation Example 011000100110000111000101 Row 0 = 011 = 3 Row 1 = 000 = 0 Row 2 = 100 = 4 Row 3 = 110 = 6 Row 4 = 000 = 0 Row 5 = 111 = 7 Row 6 = 000 = 0 Row 7 = 101 = 5 10357246 1 0 3 5 7 2 4 6

11 Further Evolutionary ComputationSlide 11 EQ Fitness Function The number of clashes This is the total number of attacks Maximum number of attacks is 56 8×7 Therefore the fitness function becomes 56 minus the number of attacks For a maximisation problem

12 Further Evolutionary ComputationSlide 12 EQ Parameters NGNumber of Generations100 PSPopulation Size100 CPCrossover Probability75% MPMutation Probability4% 5 Chromosome Elitism

13 Further Evolutionary ComputationSlide 13 EQ Implementation C++ Not Java – I did this a while ago! STL Genetic algorithm template Run on a above average specification desktop PC Very slow by today's standard Takes a few seconds to run

14 Further Evolutionary ComputationSlide 14 EQ Results – Part 1

15 Further Evolutionary ComputationSlide 15 EQ Results – Part 2

16 Further Evolutionary ComputationSlide 16 EQ Conclusion Not the best method but it works! Other methods such as using a permutation based representation would be better We will cover this later “Knight Like” However, the analysis of the intermediate results shows that “Knight Like” moves are the key

17 Further Evolutionary ComputationSlide 17 EC – Introduction We have looked at the Genetic Algorithms (GA) GAs belong to family of techniques that are inspired from evolution theory These methods come under the field of Evolutionary Computation Evolutionary Programming (covered) Genetic Programming (covered) Evolutionary Strategies (not covered) Classifier Systems (not covered)

18 Further Evolutionary ComputationSlide 18 Evolutionary Programming – Part 1 Evolutionary Programming (EP) is a similar approach to that of Genetic Algorithms mutation crossover The emphasis is on mutation and there is no crossover Every individual mutates, doubling the population Tournament Selection The selection/survival operator tends to be Tournament Selection The mutation operators tend to be complex and/or adaptive

19 Further Evolutionary ComputationSlide 19 Evolutionary Programming – Part 2 The EP algorithm is as follows: Input: Population size, number of generations and Fitness Function 1) Create the initial population 2) For i = 1 to number of generations 3) Mutate the population 4)Apply Tournament Selection 5) End For Output: Return the best individual

20 Further Evolutionary ComputationSlide 20 Evolutionary Programming – Part 3 Tournament selection With Tournament selection, each member of the population is compared with a fixed number of other individuals For each comparison, the individual is awarded a point if it’s fitness is better than the opponent The population is reduced back to its original size by retaining those with the highest score

21 Further Evolutionary ComputationSlide 21 Evolutionary Programming – Part 4 Self-adapting parameters are a type of mutation Each individual consists of a number of real genes, x 1,…,x n Each gene has an associated mutation parameter, σ i Note: e = 2.718 and that N(0,…) is the normal distribution

22 Further Evolutionary ComputationSlide 22 Genetic Programming – Part 1 Genetic Programs Genetic Programs are used to solve a problem that can be modelled as a grammar For example: BNF Symbolic Regression Genetic Programming In this lecture, the technique that is of interest is Symbolic Regression, which is a type of Genetic Programming With symbolic regression, a mathematical expression is represented as a tree structure

23 Further Evolutionary ComputationSlide 23 Genetic Programming – Part 2 Terminal nodes within this tree are usually variables Non terminals are operators (for example +,-,/,×) or functions (for example: logarithm) The fitness of such a tree is a function of the observed data versus the calculated data resulting from evaluating the expression the tree represents Crossover and mutation are redesigned to handle tree structures The genetic programming algorithm is virtually the same as the genetic algorithm

24 Further Evolutionary ComputationSlide 24 Genetic Programming – Part 3 Consider the expression: x 2 +ln(10) -7.3x, then the tree representing this is: +- ln 10  7.3 x  xx

25 Further Evolutionary ComputationSlide 25 Genetic Programming – Part 4

26 Further Evolutionary ComputationSlide 26 Related Techniques Particle Swarm and Ant Colony Optimisation This will be covered in a later lecture Natural Computation Artificial Life Chaos Theory Complexity Theory

27 Further Evolutionary ComputationSlide 27 Particle Swarm and Ant Colony Optimisation Particle Swarm Optimisation Multiple particles (solutions) form a swarm in the solution space (usually a Euclidean space) The particles cooperate by sharing information regarding good previous positions Ant Colony Optimisation This is where artificial ants are used to explore graph problems where they leave a pheromone trial along good paths for other ants to follow

28 Further Evolutionary ComputationSlide 28 Natural Computation Natural Computing Natural Computing refers to computation occurring in nature and computational techniques that are inspired by nature This can aid in the understanding of natural processes By studying computation in nature, these techniques can be applied to every day computational problems

29 Further Evolutionary ComputationSlide 29 Artificial Life- Part 1 Artificial Life is the simulation of life on a computer “Creatures” Agents The “Creatures” are often referred to as Agents These agents typically behave like biological creatures Evolutionary computation can be used Cellular Automata Boids Examples are Cellular Automata (game of life) and Boids

30 Further Evolutionary ComputationSlide 30 Artificial Life- Part 2 Game of Life Let’s look at a Game of Life demo. Which probably won’t work…

31 Further Evolutionary ComputationSlide 31 Chaos Theory – Part 1 A chaotic system is a system whose long term behaviour is unpredictable Weather forecasting Tiny changes in the starting state values rapidly lead to anywhere in the possible state space There can however be a finite number of available states Mandlebrot Set Often associated with non-linear equations such as the Mandlebrot Set

32 Further Evolutionary ComputationSlide 32 Chaos Theory – Part 2

33 Further Evolutionary ComputationSlide 33 Complexity The interaction of many simple parts creating complex behaviour The net effect is greater than the sum of the individuals, e.g. ant colonies Emergent behaviour as a side effect of the system Often incorporates elements of Chaos Theory, Artificial Life and Artificial Intelligence

34 Next Lecture We will be talking about: Ant Colony Optimisation Particle Swarm Optimisation The laboratory will involve applying a GA to another problem... Slide 34Further Evolutionary Computation


Download ppt "Algorithms and their Applications CS2004 (2012-2013) 13.1 Further Evolutionary Computation."

Similar presentations


Ads by Google