Presentation is loading. Please wait.

Presentation is loading. Please wait.

Genetic Algorithms.

Similar presentations


Presentation on theme: "Genetic Algorithms."— Presentation transcript:

1 Genetic Algorithms

2 The Traditional Approach
Ask an expert Adapt existing designs Trial and error What has been traditionally done in the heat exchanger world is to take a best “guess” at a design with the help of an expert. Traditional heat exchanger designs are usually fully mathematically described. This initial guess can then be used as a basis, and various parameters are “tweaked”. The performance of the heat exchanger can be recalculated to see if the modified design is an improvement on the original one. Surely there must be a better way? There is - we don’t need to look very far to find examples of optimisation in Nature. CS 561, Session 26

3 Nature’s Starting Point
Approximately 50,000 years ago, this would be the typical human being we’d come across in Cambridge. Given a long time, a few hormones, and a little bit of lust, we end up with... Alison Everitt’s “A User’s Guide to Men” CS 561, Session 26

4 Optimised Man! CS 561, Session 26
…this delightful specimen you see before you. It can’t be denied that Mother Nature has solved the optimisation problem. [Note - using this photo is a small act of revenge - for years Harry has been using a slide of me, acting as a scale bar for a steam turbine!] CS 561, Session 26

5 Example: Pursuit and Evasion
Using NNs and Genetic algorithm 0 learning 200 tries 999 tries CS 561, Session 26

6 Traditional Nature Comparisons best guess population of guesses
may lead to local, not global optimum Nature population of guesses more likely to find a better solution So, why is Nature better at optimisation than our traditionally used heat exchanger technique? With the heat exchanger, we begin with a single “best guess” design which we iteratively modify. Nature has an entire population of designs, which interact, passing on the best properties of each other. As Darwin put it, this is “survival of the fittest”. CS 561, Session 26

7 Nature Genetic algorithm More Comparisons not very efficient
at least a 20 year wait between generations not all mating combinations possible Genetic algorithm efficient and fast optimization complete in a matter of minutes mating combinations governed only by “fitness” However, we don’t have 50,000 years to optimise a recuperator. Although Nature does an excellent job, she does it slowly. There are long waits between generations of people, and before transport was so readily available, there wasn’t good “mixing” of the population. Additionally, if the two ideal parents were both of the same gender, there is no naturally genetic way to pass both sets of genes onto offspring. Genetic algorithms take a lesson from Nature, but they overcome these disadvantages. The process is efficient and fast, and there are no restrictions on mating combinations - they are only governed by the suitability of the parents. CS 561, Session 26

8 The Genetic Algorithm Approach
Define limits of variable parameters Generate a random population of designs Assess “fitness” of designs Mate selection Crossover Mutation Reassess fitness of new population The genetic algorithm mimics genetic reproduction, with data representing the parameters of a particular design taking the form of a binary string, which behaves similarly to a chromosome within the DNA of a cell. Upper and lower limits are set on these data - although the genetic algorithm may know what is a good design, it doesn’t know what is practicable to manufacture. Once the chromosomes have been formed, a series of processes is carried out. These are listed above, and described in turn on the following slides. CS 561, Session 26

9 A “Population” CS 561, Session 26
As has been described, binary strings can be used to describe fully the heat exchanger design. In line with Nature, a population of designs is used. The initial population is simply generated randomly. The schematic above shows a small population of strings, with solid circles representing “ones” and open circles representing “zeros”. The model we used had strings with 70 characters in them, and a population size of 50 members. New generation populations were programmed to remain at 50 members. CS 561, Session 26

10 Ranking by Fitness: CS 561, Session 26
One the population has been formed, (either randomly in the initial generation, or by mating in subsequent generations), each population member needs to be assessed against the desired properties - such a rating is called a “fitness”. The design parameters represented by the zeros and ones in the binary code of each chromosome are fed into the mathematical model describing the heat exchanger. The output parameters for each design are used to give the fitness rating. A good design has a high fitness value, and a poor design a lower value. CS 561, Session 26

11 Mate Selection: Fittest are copied and replaced less-fit
One the fitness has been assigned, pairs of chromosomes representing heat exchanger designs can be chosen for mating. The higher the fitness, the greater the probability of the design being selected. Consequently, some of the weaker population members do not mate at all, whilst superior ones are chosen many times. It is even statistically possible for a member to be chosen to mate with itself. This has no advantage, as the offspring will be identical to the parent. CS 561, Session 26

12 Mate Selection Roulette: Increasing the likelihood but not guaranteeing the fittest reproduction
Mating pairs are selected in a biased random manner. It can be likened to an irregularly segmented roulette wheel. A segment of wheel is assigned to each population member, and the size of the segment is proportional to the fitness of the design. A simplified version is shown above for a small population. Two successive “gambles” are taken, and the population members selected by this process form a mating pair. Once mates are chosen, mating can be carried out. CS 561, Session 26

13 Crossover: Exchanging information through some part of information (representation)
The mating process is analogous to crossover carried out in living cells. A pair of binary strings are used. A site along the length of the string is chosen randomly. In this example it is shown between the 6th and 7th bits, but it could be anywhere. Both members of the pair are severed at that site, and their latter portions are exchanged. Two parents form two children, and these two “daughter” designs become members of the population for the next generation. This process takes place for each pair selected, so the new population has the same number of members as the previous generation. CS 561, Session 26

14 Mutation: Random change of binary digits from 0 to 1 and vice versa (to avoid local minima)
Mutation is set to occur randomly, with a low probability, in order to widen the regions of solution space being searched. This ensures that local maxima are not found as the optimum in preference to the global maximum. The mutation is a random change of a binary digit from 0 to 1 or vice versa. The diagram shows a solid circle, representing a 1 (highlighted in blue) changing to an open circle representing a zero. If the mutation makes the design worse, then there are no disadvantages, as it will have a lower fitness, and will die out quickly. Alternatively, if it makes the design better, then this will enhance the population. CS 561, Session 26

15 Best Design After a number of generations, designs can be examined for fitness, and the best design can be chosen. The genetic algorithm is extremely good at finding the region of solution space where the optimum lies, but it may be slow to converge to the precise peak of the maximum. It may be necessary to use other optimisation methods if a high degree of precision is needed in identification of the optimum design. CS 561, Session 26

16 The GA Cycle Summary of the previous steps to the model. Populations are continuously produced, going round the outer loop of this diagram, until the desired amount of optimisation has been achieved. CS 561, Session 26

17 Genetic Algorithms Adv:
Good to find a region of solution including the optimal solution. But slow in giving the optimal solution Summary of the previous steps to the model. Populations are continuously produced, going round the outer loop of this diagram, until the desired amount of optimisation has been achieved. CS 561, Session 26

18 GP operates at a higher level of abstraction than GA
Genetic Approach When applied to strings of genes, the approaches are classified as genetic algorithms (GA) When applied to pieces of executable programs, the approaches are classified as genetic programming (GP) GP operates at a higher level of abstraction than GA Summary of the previous steps to the model. Populations are continuously produced, going round the outer loop of this diagram, until the desired amount of optimisation has been achieved. CS 561, Session 26

19 Example: Karl Sim’s creatures
Sea Horse Snake CS 561, Session 26

20 Typical “Chromosome” CS 561, Session 26
Here is a schematic showing how the chromosome is formed. The bits for each of the 7 variables are simply concatenated. CS 561, Session 26


Download ppt "Genetic Algorithms."

Similar presentations


Ads by Google