Question: This is sloving the Jump-It problem with a Genetic Alogorithm. I use python, but please do not use any library (numpy, etc). Please help me.

This is sloving the Jump-It problem with a Genetic Alogorithm. 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 numbers are 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 Genetic Algorithm

The optimal path chosen by Genetic Algorithm

Output sample is following:

game board: [0, 3, 80, 6, 57, 10] cost: 19 path showing indices of visited cells: 0 -> 1 -> 3 -> 5 path showing contents of visited cells: 0 -> 3 -> 6 -> 10

Remarks:

You may encode a board with 1s and 0s, where a 1 corresponds to a visited cell and a 0 corresponds to an unvisited cell. These can be used as the genomes in your GA.

In your GA solution, you can strip out the first cell on the board since 0+I=I.

A very common bug that we will be checking for occurs when recombining parents at a crossover point, p1, if one parent has a 0 digit before p1 and the other parent has a 0 digit after p1, then a generated child would have two consecutive 0s. This would result in an invalid genome (corresponding to a board with a move of a jump over two adjacent cells, which is not allowed in the Jump-It game). You need to prevent this from happening in your code. First, you can try different crossover points. However, if no valid crossover point can be found for two parents, then you may either clone one of the two parents or select a different parent and redo recombination.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!