|
• fitness function to calculate the shortest path in a map with walls
hi.
I have this problem:
I used A* to calculate the shortest path between two points in a limited map that may contain walls in random positions.
Now i started implementing a genetic problem to find the shortest path and to compare both algorithm.
I think that in my case genetic algorithm are worst but I have to prove it.
my genetic operators are directions. the basic directions (left, right, up and down).
to calculate fitness i'm testing the values in the chromosome .
For each position that it allows me to go on the map I add 1 to the the fitness. if the direction makes me going agains a wall it get a penalty for that and the same happens if it tries to send me out of the map dimensions.
After i get against the wall or getting out of the map I stop testing the chromosome .
My problem is that this fitnss function only works if I have no wall. If I had some walls to the map my genetic algorithm is no longer able to get a valid individual.
Can someone tell me what fitness function I should use or where I can find information about this problem?
i'm only able to find information about more complex problem.
thanks.
|