Genetic_algorithm test case
f(x, y) = cos((x - 1.14)6) - 100 * (y2 - x)4
0 ≤ x ≤ 2
0 ≤ y ≤ 3
x + y ≥ 1
The number of distinct values N = (b - a) / ε
The number of bits n = log2N = log2(b - a) / ε
Precision ε = 10-4 means four places after the decimal point
The domain length for x is 2 (0 ~ 2)
nx = 14.28 ~ 15 bits
The domain length for y is 2 (0 ~ 3)
ny = 14.87 ~ 16 bits
For ny, the number of bits is rounded up to 16 to ensure there are enough binary combinations to represent all possible values. Using the domain length equal to 15 gives us 215=32768 values, which is just above 30000, so from safety reasons the domain length equal to 16 will be used (216= 65536 values).
Total chromosome length is 31 bits – first 15 bits to encode x, last 16 bits to encode y.
Size of the population is 200 chromosomes
Number of generations is 5000 generations
Selection mechanism – roulette wheel
Crossover mechanism – two-point crossover
Mutation mechanism – mutation of one random bit (bit flipping)
The constraint x + y ≥ 1 is used as a penalty method. If the solution violates the constraint, a large negative fitness value is applied to decrease the possibility of survival to the next generation.
Crossover rate – 0.9
Mutation rate – 0.1
Penalty rate – 106