Python implementation for a Genetic Algorithm to solve linear equations.
The equation a+2b+3c+4d = 30 , this implementation will find the value of a,b,c and d using an evolutionary algorithm.
randomly initialize the population
for each vector compute the value of a+2b+3c+4d-30 = 0
choose the 3 best chromosomes.
preform crossover between the best 3 chromosomes to generate the new population.
preform mutation according to the following probability: threshold = (1/population size /chromosome length)
- the algorithm will run until finding the optimal solution.
- to solve other equations: change line 84
Equation((1,2,3,4),30)
to whatever coefficients or result you want.