Week 7: Genetic Algorithms #2 Flashcards
Many problems have real-valued parameters. If they were mapped to a ______ space in order to use GA, then high precision solutions would require very long _______
binary
chromosomes
In Real Valued Genetic Algorithm (GA), can we use the crossover operators to combine two individuals, as we did from Simple GA?
What are they?
Yes, we can use any of these two:
- Discrete. Convert the real value to binary, and then apply binary crossover
- Intermediate. Use arithmetic to apply crossover. Can be:
- Single arithmetic crossover
- Simple arithmetic crossover
- Whole arithmetic crossover
When applying crossover on Real Valued Genetic Algorithm, we often use “Single” Arithmetic Crossover.
How does it work?
Assume that the parents are a vector of genes:
[ gene1, gene2, gene3, …. ]
What about the other child?
- From the set of parents, we pick a gene “k” at random. Let “x” and “y” be the values of the parents at this gene
- The child will take on the value αy + (1-α)x at the gene “k”, where α is between 0 and 1
- All other genes for the child will be the same as the “x” parent
- The other child will be the opposite ( αx + (1-α)y at “k”, and takes “y”’s values otherwise)
When applying crossover on Real Valued Genetic Algorithm, we often use “Simple” Arithmetic Crossover.
How does it work?
Assume that the parents are a vector of genes:
[ gene1, gene2, gene3, …. ]
What about the other child?
- From the set of parents, we pick a gene “k” at random
- Apply Simple arithmetic crossover to all the points after “k” in the vector of genes for the parents
- For each pair of genes “x”, “y” after “k”, the child will take the value αy + (1-α)x, where α is between 0 and 1
- All other genes for the child (before “k”) will be the same as the “x” parent
- The other child will be the opposite ( αx + (1-α)y after “k”, and takes “y”’s values otherwise)
When applying crossover on Real Valued Genetic Algorithm, we often use “Whole” Arithmetic Crossover.
How does it work?
Assume that the parents are a vector of genes:
[ gene1, gene2, gene3, …. ]
What about the other child?
- For all genes x_i from parent 1 and y_i from parent 2, the child’s i gene will be αy_i+ + (1-α)x_i, where α is between 0 and 1
- The other child will be the opposite ( αx_i + (1-α)y_i for all i)
In Real Valued Genetic Algorithm, there are two types of mutations, what are their names?
- Uniform mutation
2. Random noise mutation
How does “uniform” mutation work for Real Valued GAs?
Assume the individual takes the form:
[ gene1, gene2, gene3, …. ]
turns into
[ new1, new2, new3, … ]
These “new” values are uniformly randomly generated with an upper and lower bound
This is analogous to bit-flipping in binary GA
How does “Random noise” mutation work for Real Valued GAs?
Assume the individual takes the form:
[ gene1, gene2, gene3, …. ]
turns into
[ new1, new2, new3, … ]
For each gene, we add a random amount of noise:
new_i = gene_i + N(0,σ)
Where N(0,σ) is a random gaussian number with mean zero and standard deviation σ
Permutation GA is made for what type of problems?
What does a sample solution look like?
Problems that take the form of deciding on the order in which a sequence of events shall occur - for example TSP (traveling salesman problem)
Sample solution is an ordered set of “n” variables, with each variable occurring exactly once
In permutation GAs, there are 3 types of crossovers.
What are they?
Adjacency Based:
- Partially Mapped Crossover (PMX)
Order Based:
- Order 1 crossover
- Cycle crossover
In Permutation GAs, how does the adjacency based Partially Mapped Crossover (PMX) work?
Assume that individuals/chromosomes take the form of “n” ordered variables/genes, with each variable occurring exactly once:
[a1, a2, a3, a4, … ]
PMX (Partially Mapped Crossover) for parents P1 & P2:
- Choose random segment (subarray) from P1, and copy it into the offspring
- Starting from the index of the first point in the chosen subarray, look for elements in that segment of P2 that have not been copied
- For each of these “i”, look in the offspring to see what element “j” has been copied in its place from P1
- Place “i” into the position occupied by “j” in P2, since we know that we will not be putting “j” there (its already in the offspring)
- If the slot occupied by “j” in P2 has already been filled in the offspring “k”, then put “i” in the position occupied by “k” in P2
- Having dealt with elements from the crossover segment, the rest of the offspring can be filled from P2. Second child is created analogously
In Permutation GAs, how does the order 1 crossover work?
Assume that individuals take the form of “n” ordered variables, with each variable occurring exactly once:
[a1, a2, a3, a4, … ]
The idea is to preserve relative order that elements occur
- Choose an arbitrary subarray from the first parent
- Copy this part to the child
- Copy the numbers that are not yet in the child:
- Start from the element which is to the right of the right most element in the copied part (wrap around)
- Use the relative order of the un-added elements of the second parent
- Wrap around the end - Repeat for second child but swapping the roles of parent 1 and parent 2
In Permutation GAs, how does the cycle crossover?
Assume that individuals take the form of “n” ordered variables (genes), with each variable occurring exactly once:
[a1, a2, a3, a4, … ]
- Identify cycles in the number orders between parent 1 and parent 2 by using the a parent’s gene’s value as an index lookup for the other parent
- Create a group for each cycle found - the groups should have equal number of elements in parent 1 and parent 2
- Take the second of these groups (ordered by starting index), and swap the values at these elements between parent 1 and parent 2
In Permutation GAs, there are four types of mutation operators. What are they?
- insert mutation
- swap mutation
- inversion mutation
- scramble mutation
In Permutation GAs, how does insert mutation work?
Assume that individuals take the form of “n” ordered variables (genes), with each variable occurring exactly once:
[a1, a2, a3, a4, … ]
Insert mutation:
1. Pick two gene values at random
- Move the second to follow the first, shifting the rest up by 1 to accommodate
- Preserves most of the order and the adjacency information