- Run the main.py file from directory.
- User can defined path points, links b/w path points, population size, mutation rate in the Config.py file
- python
- numpy
- user can define fixed links b/w nodes
- user can initialize population of chromosomes which are initialized randomly but program insures that two consective nodes should be linked to each other.
- user can calculate chromosome fitness based on total distance of chromosomes and connectivity of nodes.
- user can find best fitness indices
- user can rank the initial population of chromosomes using roulets wheels selection method
- user can do crossover on the population
- user can do mutation on the population
- bug fixed in create population function
- bug related to chromosome population fitness best indices removed
- Bug in generate mating pool function of ranking file fixed
- Bug removed in function check fitness based on connection in fitness file
- chr_population = population()
- chr_pop_fitness, chr_best_fitness_index = fitness(chr_pop=chr_population)
- chr_ranked_population = ranking(chr_pop_fitness=chr_pop_fitness, pop=chr_population)
- chr_crossover_mutated_population = dna(chr_pop_fitness=chr_pop_fitness, ranked_population=chr_ranked_population, chr_best_fitness_index=chr_best_fitness_index, last_pop=chr_population)
- Use Genetic Algorithm for finding a best path for mobile robot in a 2D environment.
- To move from starting point to the endpoint while avoiding collisions with obstacles and minimizing total distance travelled.
Genetic Algorithms: A stochastic evolutionary technique based on human genetics.
The Environment is “created” by defining the workspace i.e. the 2D min and max of the coordinates (x,y); there are 7 obstacles and path points labeled 0-15 i.e. 16 path points; Starting Position is 0 and End-Point is 15 (see figure).
Note that link points in table are 1 through 16 and in adjoining image they are from 0 to 15.
The “fitness” of a path is the inverse of the length of the path from starting point to end-point
Fitness(iPath) = 1.0/DistanceInPath(iPath)
No. of chromosomes: NC=20
For each iteration select 40% of these i.e. 8 chromosomes
No. of Bits NBITS = log NPTS /log 2 = log 16 / log 2 = 4
If there are 1024 points, then NBITS = log 1024/log 2 = 10
CHR_LEN=(NOBS+2)*NBITS = (7+2)*4 = 36 for 7 obstacles and 4 bits
CHR_LEN = (7+2)*10=900 for 7 obstacles and 10 bits
A Path is generated by selected points from a specified start-point to a specified end-point.
An optimal solution is obtained by generating an initial population of chromosomes (paths consisting of path points), computing their “fitness” to select “best” parents for producing the “next generation” of chromosomes by carrying out evolutionary procedures of cross-over and mutation. The procedure is continued until no further improvement is possible; this is called “convergence” which corresponds to an “optimal” solution.