Genetic Algorithm (GA) for binary (bitstring) population type - how will crossover and mutation work on binary vectors?
조회 수: 18 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2020년 5월 5일
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%
답변 (1개)
Walter Roberson
2020년 5월 5일
crossoverfcn is not to be used with integer problems, and bitstring are integer problems
참고 항목
카테고리
Help Center 및 File Exchange에서 Genetic Algorithm에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!