3faiga
TRANSCRIPT
-
8/6/2019 3FAIGA
1/48
Genetic Algorithms
Objectives
To provide a background and understanding of basic genetic
algorithms and some of their applications.
a basic genetic algorithmthe basic discussion
the applications of the algorithm
-
8/6/2019 3FAIGA
2/48
Genetic Algorithms
1859
Origin of the Species
Survival of the Fittest
-
8/6/2019 3FAIGA
3/48
Genetic Algorithms
1975
Genetic Algorithms
Artificial Survival of the Fittest
-
8/6/2019 3FAIGA
4/48
Genetic Algorithms
Terms
Biological GA Terms
Chromosome StringGene Feature, character
Genomes Guesses, solutions, collection of genes
Genetic algorithms are search procedures based onthe mechanics of genetics and natural selection.
-
8/6/2019 3FAIGA
5/48
Genetic Algorithms
Numerous techniques and algorithms have beendeveloped to assist the engineer in the creation ofoptimum development strategies.
These procedures quickly converge to optimal
solutions after examining only a small fraction of thesearch space and have been successfully appliedto complex engineering optimisation problems.
-
8/6/2019 3FAIGA
6/48
Genetic Algorithms
Evolution in the animal world allows developingspecies to thrive in particular environments.
Genetic algorithms are capable of solving othertypes of problems, using genetic operatorsabstracted from nature, they form a mechanismsuitable for a variety of search problems.
-
8/6/2019 3FAIGA
7/48
Genetic Algorithms
Genetic algorithms try to imitate the Darwinianevolution process in computer programs.
Conceivable solutions are represented, the 'fittest'will have the greatest chance of reproducing.
Successful properties will therefore be favourablyrepresented within the population of solutions.The population is the successively 'optimised' after a
number of generations.
-
8/6/2019 3FAIGA
8/48
Genetic Algorithms
In evolutionary systems, populations evolve byselective pressures, mating between individuals, andalterations such as mutations.
In genetic algorithms, operators duplicate,
recombine and change solutions in the currentpopulation to create a new population, simulatingsimilar effects.
-
8/6/2019 3FAIGA
9/48
Genetic Algorithms
A genetic algorithm simulates Darwinian theory ofevolution using highly parallel, mathematicalalgorithms that, transform a set (population) ofmathematical object (typically strings of 1's and 0's)into a new population, using operators such as:
reproduction, mutation and crossover.
-
8/6/2019 3FAIGA
10/48
Genetic Algorithms
The initial population is selected at random, whichcould be the toss of a coin, computer generated orby some other means, and the algorithm willcontinue until a certain time or a certain condition ismet.
-
8/6/2019 3FAIGA
11/48
Genetic Algorithms
Determine the initial population of creaturesDetermine the fitness of the populationReproduce the population using the fittest parentsof the last generationDetermine the crossover point, this can also be
randomDetermine if mutation occurs and if so on whichcreature(s)
Repeat from step 2 with the new population until
condition (X) is true
-
8/6/2019 3FAIGA
12/48
Genetic Algorithms
Such algorithms differ from traditional search andoptimisation methods in that they
use codings of the control parametersadapt solutions themselves
process successive generationsuse randomised operators.
-
8/6/2019 3FAIGA
13/48
Genetic AlgorithmsEncoding the Solutions
The decision variables of a problem arenormally encoded into a finite length string
This could be a binary string or a list of integersFor example :
or0 1 1 0 1 1 0 1 0 2 3 4 11 45
We could also representnumbers as coloured boxes
-
8/6/2019 3FAIGA
14/48
Genetic AlgorithmsEncoding the Solutions
Initial populationEvaluations on the population
Breeding (iteratively)Choose suitable parentsProduce two offspringMutation
Evaluation function - Domain knowledge
-
8/6/2019 3FAIGA
15/48
Generate InitialPopulation
PopulationGeneration 'n'
Reproduce
Population
CrossoverPopulation
MutatePopulation
n = n + 1
n = 1
n < 20
Final
Population
n = 20
Genetic AlgorithmsFlowchart (20 generations)
-
8/6/2019 3FAIGA
16/48
Reproduction
Genetic Algorithms
1
2
3
1
2
3
Solutions are carriedforward to the next
stage based onweighted probability.
Some will survive (1)Some will reproduce (2)
Some will die out (3)
-
8/6/2019 3FAIGA
17/48
Parent selection
Genetic Algorithms
Roulette WheelSelection
Sum the fitnesses of all thepopulation members, TF
Generate a random number, m,between 0 and TFReturn the first population memberwhose fitness added to the preceding
population members is greater than orequal to m
-
8/6/2019 3FAIGA
18/48
Crossover
Genetic Algorithms
A percentage of thepopulation is selected forbreeding and assignedrandom mates.
A random crossoverpoint is selected and apair of new solutionsare produced
1
2
1
2
Crossover
One Point Crossover inOne Point Crossover in
Genetic AlgorithmsGenetic Algorithms
Graham Kendall
http://cs.nott.ac.uk/~gxkAdapted from Dr Graham Kendalls G5BAIM lecture example
-
8/6/2019 3FAIGA
19/48
Mutation
In a small percentage ofthe population random
changes are made.
Genetic Algorithms
-
8/6/2019 3FAIGA
20/48
-
8/6/2019 3FAIGA
21/48
Genetic Algorithms
Each iteration of the loop is called a generation, fitnesscan be gauged in several different ways depending on theapplication of the algorithm.
Reproduction and crossover play the primary role in artificialgenetic search. Reproduction emphasises highly fit strings(or good solutions), and crossover recombines these selected
solutions for new, potentially better solutions.
Mutation plays a secondary role in the search by providingdiversity in the population.
-
8/6/2019 3FAIGA
22/48
Genetic Algorithm Example I
Maximise f(x) = x3 - 60 * x2 + 900 * x +1000
-
8/6/2019 3FAIGA
23/48
Genetic Algorithm Example I
Generating random initial population
chromosome binary string x f(x)
P1 11100 28 212P2 01111 15 3475
P3 10111 23 1227
P4 00100 4 2804Total 7718
Average 1929.50
Maximise f(x) = x3 - 60 * x2 + 900 * x +100 (0
-
8/6/2019 3FAIGA
24/48
Genetic Algorithm Example I
Choose two parents (roulette selection)
Roulette wheel Parents4116 P3
1915 P2
-
8/6/2019 3FAIGA
25/48
Genetic Algorithm Example I
One point crossover (random position 1)
1 0 1 1 10 1 1 1 1
P3P2
1 1 1 1 1
0 0 1 1 1
C1
C2
0 0 1 0 00 1 1 1 1
P4P2
0 0 1 1 1
0 1 1 0 0
C3
C4
-
8/6/2019 3FAIGA
26/48
Genetic Algorithm Example I
New generation
chromosome binary string x f(x)
P1 11111 31 131P2 00111 7 3803
P3 00111 7 3803
P4 01100 12 3889Total 11735
Average 2933.75
Maximise f(x) = x3 - 60 * x2 + 900 * x +100 (0
-
8/6/2019 3FAIGA
27/48
Genetic Algorithm Example I
chromosome binarystring
x f(x)
P1 11100 28 212
P2 01111 15 3475
P3 10111 23 1227
P4 00100 4 2804
Total 7718
Average 1929.50
chromosome binarystring
x f(x)
P1 11111 31 131
P2 00111 7 3803
P3 00111 7 3803
P4 01100 12 3889
Total 11735
Average 2933.75
Two generations
Mutation
Maximise f(x) = x3 - 60 * x2 + 900 * x +100 (0
-
8/6/2019 3FAIGA
28/48
Genetic Algorithm Example II
Traveling Salesman Problema number of citiescosts of traveling between cities
a traveling sales man needs to visit all thesecities exactly once and return to the startingcity
Whats the cheapest route?
-
8/6/2019 3FAIGA
29/48
Genetic Algorithm Example II
Traveling Salesman Problem
-
8/6/2019 3FAIGA
30/48
Genetic Algorithm Example II
Initial generation
5 8 1 84 32 27 54 67P1
78 81 27 9 11 7 44 24P2
8 1 7 9 16 36 24 19P30
6.5
7.8
6.0
-
8/6/2019 3FAIGA
31/48
Genetic Algorithm Example II
Choose pairs of parents
78 81 27 9 11 7 44 24P2
8 1 7 9 16 36 24 19P30 6.0
7.8
Crossover
78 81 27 9 16 36 24 19C2
8 1 7 9 11 7 44 24C1 5.9
6.2
13
-
8/6/2019 3FAIGA
32/48
Genetic Algorithm Example II
Next generation
78 81 27 9 16 36 24 19P2
8 1 7 9 11 7 44 24P1 5.9
6.2
7 8 2 5 10 76 4 79P2 6.0
-
8/6/2019 3FAIGA
33/48
Genetic Algorithm Example II
Traveling Salesman ProblemNo. of cities: 100Population size: 30
Cost: 6.37Generation: 88 Cost: 6.34Generation: 1100
-
8/6/2019 3FAIGA
34/48
Genetic Algorithms
Genetic algorithms by their very nature consider awide range of the search space for a particularproblem.
Unlike other techniques they search from a populationof points not from a single point, they are thereforeless likely to become trapped on false optimisationpeaks.
Using simple operations, genetic algorithms are ableto rapidly optimise design parameters after examining
only a small fraction of the search space.
-
8/6/2019 3FAIGA
35/48
Genetic AlgorithmsThere are many diverse applications of genetic algorithms,but there are proviso's. They are best suited to problemswhere the efficient solutions are not already known. Ifthey are applied to these solvable problems then they will
be easily out-performed by the efficient known, standardcomputing method.
The strength of GA's is their ability to heuristically search
for solutions when all else fails. But before one can usethe algorithm you must be able to represent the solutionsto the problem in a suitable format, such as a series of 1'sand 0's. If you can do this then the GA will do the rest.
-
8/6/2019 3FAIGA
36/48
ApplyingGenetic Algorithms
to Personnel Scheduling
-
8/6/2019 3FAIGA
37/48
Personnel Scheduling
Personnel scheduling in healthcare
is usually a very complex operationwhich has a profound effect upon theefficient usage of expensive resources.
-
8/6/2019 3FAIGA
38/48
A number of nursesA number of shifts each dayA set of constraints
shift coverageone shift per day
resting timeworkload per month
consecutive shiftsworking weekends
Personnel Scheduling
-
8/6/2019 3FAIGA
39/48
Personnel Scheduling
-
8/6/2019 3FAIGA
40/48
Personnel Scheduling
Genetic Algorithm-Initial population
-construct rosters-repair infeasible ones
-
8/6/2019 3FAIGA
41/48
Personnel Scheduling
Genetic Algorithm-Select parents-Recombine rows in the two rosters
-repair infeasible ones
+
-
8/6/2019 3FAIGA
42/48
Personnel Scheduling
Genetic Algorithm-Mutation-Local optimiser
-
8/6/2019 3FAIGA
43/48
Testing Scheme
Population SizeCrossover ProbabilityMutation ProbabilityLocal Optimiser
500.7
0.001ON
-
8/6/2019 3FAIGA
44/48
Future Development
Improving Efficiency Parameter tuning
Crossover operators
Local optimiser
-
8/6/2019 3FAIGA
45/48
Conclusions
GA approach is feasible and practical
Heuristic Can produce better results
Not guaranteed Flexible
Fitness (evaluation) function
Independent of GA engine
-
8/6/2019 3FAIGA
46/48
Conclusions
Predictions have been made that advances inmathematics, fuzzy logic, chaos and fractals willpromote and enhance the work currently being
undertaken by GA's.
The future will bring forth new applications ofgenetic algorithms and new techniques which will
allow GA's to be fully exploited.
-
8/6/2019 3FAIGA
47/48
Conclusions
Survival of the fittest, the most fit of a particulargeneration (the nearest to a correct answer) are usedas parents for the next generation.
The most fit of this new generation are parents for thenext, and so on. This eradicates bad solutions andeliminates bad family lines, bad parents don't have
opportunity to produce bad children.
This facilitates the progression towards an answer tobe onwards and upwards.
-
8/6/2019 3FAIGA
48/48
Conclusions
As we have seen Genetic algorithms are a verypowerful tool, allowing searching for solutions whenthere are no other feasible means to do so.
The algorithm is easy to produce and simple tounderstand and enhancements easily introduced. Thisgives the algorithm much flexibility, which increases
it's value.
But, exploitation of the algorithm has still much morework to be done.