Genetic Algorithm (GA) for binary (bitstring) population type - how will crossover and mutation work on binary vectors?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to run genetic algorithm with binary array as population type by setting 'PopulationType' to 'bitstring' in optimoptions function.
Could someone explain how crossover function ('crossoverarithmetic') and mutation funtion ('mutationuniform') work for this binary case?
Crossover Options - 'crossoverarithmetic'
It says Arithmetic ('crossoverarithmetic') creates children that are the weighted arithmetic mean of two parents.
If two parents selected are, for example,
parent1 = [1 0 0 1 0];
parent2 = [0 0 1 1 1];
Will the children from 'crossoverarithmetic' be parent1 | parent2 ? so children = [1 0 1 1 1]?
Mutation Options - 'mutationuniform'
Documentation says the following: Uniform ('mutationuniform') - uniform mutation is a two-step process. First, the algorithm selects a fraction of the vector entries of an individual for mutation, where each entry has a probability Rate of being mutated. The default value of Rate is 0.01. In the second step, the algorithm replaces each selected entry by a random number selected uniformly from the range for the entry.
Does this mean, if a parent selected is [1 0 0 1 0], each entry has Rate chance of value being flipped?
4 Kommentare
Walter Roberson
am 5 Mai 2020
The code is along the lines of
R = rand(1,N);
for K = 1:N
if R(K) < rate
variable(K) = randi([lb(K), ub(K)]) ;
end
end
for bitstring 0 1, randi 0 1 has a 50% chance of being different than it currently is.
Whereas you are imagining
t = setdiff(lb(K) : ub(K), variable(K)) ;
variable(K) = t(randi(length(t)) ;
which is guaranteed to be different from the current value 100%
Antworten (1)
Walter Roberson
am 5 Mai 2020
crossoverfcn is not to be used with integer problems, and bitstring are integer problems
Siehe auch
Kategorien
Mehr zu Genetic Algorithm finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!