Question: Jump-It problem with a Genetic Alogorithm (GA). I use python, but please do not use any library (numpy, etc). Please help me. I will need
Jump-It problem with a Genetic Alogorithm (GA). I use python, but please do not use any library (numpy, etc). Please help me.
I will need to implement a genetic algorithm solution for the Jump-It game problem. the algorithm where you must use only one iteration, where the next generation is generated from the current generation by replacing the two least fit individuals of the current population with the newly generated children.
Following is input text file:
0 3 80 6 57 10 0 98 7 44 25 3 5 85 46 4 0 57 59 83 9 42 70 0 20 49 96 53 7 43 77 0 24 17 15 61 49 61 8 65 43 26 99 7 57 97 50 93 6 82 52
The output from your program must display the following items for each game solution:
The game board
The minimum cost if the board was solved with GA
The optimal path chosen by GA
Output sample is following:
game board: [0, 3, 80, 6, 57, 10] GA Solution minimun cost: 19 path showing indices of visited cells: 0 -> 1 -> 3 -> 5 path showing contents of visited cells: 0 -> 3 -> 6 -> 10
Genetic Algorithm (speps)
Step 0. Algorithm Initialization. Assume data are encoded in bit strings (1s and 0s). Specify a crossover probability/rate pc and a mutation probability/rate pm. Usually pc is chosen to be fairly high and pm is chosen to be very low.
Step 1. The population is chosen consisting of n chromosomes each of length l.
Step 2. The fitness function f(x) for each chromosome in the population is calculated.
Iterate through the following steps until n offspring generated:
Step 3a. Selection. Using the values from f(x), assign probability of selection to each chromosome xi.
Step 3a. Selection (cont.). Select a pair of chromosomes to be a parent, allowing chromosomes to potentially pair with itself
Step 3b. Crossover. Select randomly chosen locust (crossover point). With probability pc , perform crossover with the parents forming two new offspring or clone two exact copies of the parents.
Step 3c. Mutation. With probability pm , perform mutation on each of the two offspring.
Step 4. The new population of chromosomes replaces the current population.
Step 5. Check termination criteria. If convergence is achieved then stop and report results, otherwise go back to Step 2.
Except, for Step 3 of the algorithm where you must use only one iteration, where the next generation is generated from the current generation by replacing the two least fit individuals of the current population with the newly generated children.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
