Skip to content

alisali0398/Genetic_algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 

Repository files navigation

Genetic_algorithm

Genetic_algorithm test case

Optimization problem - maximize

f(x, y) = cos((x - 1.14)6) - 100 * (y2 - x)4

0 ≤ x ≤ 2

0 ≤ y ≤ 3

x + y ≥ 1

The composition of chromosomes:

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.

Number of chromosomes and number of generations:

Size of the population is 200 chromosomes

Number of generations is 5000 generations

Mechanisms of selection, crossover and mutation:

Selection mechanism – roulette wheel

Crossover mechanism – two-point crossover

Mutation mechanism – mutation of one random bit (bit flipping)

Constraint handling:

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.

Setting of tuning parameters:

Crossover rate – 0.9

Mutation rate – 0.1

Penalty rate – 106

About

Genetic_algorithm test case

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages