Genetic Algorithms Warehouse
Artificial Intelligence Depot
"As knowledge increases, ignorance unfolds." -Kennedy
KNOWLEDGE MESSAGES SUBMIT SEARCH  
fitness function to calculate the shortest path in a map with walls
find the fitness fucntion to calculate the shortest path in a map
 
• 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.

1 posts.
Friday 22 December, 15:53
Reply
• Failure is a good thing...

Without the chance to fail your algorithm has no chance to succeed. Try limiting the number of step to some large bound (squares on map max) and make fitness the number of steps to reach goal or infinity for those that don't make it. Mutate or delete the ones that don't reach the goal after a couple generations. Minimise fitness to evolve solutions. Maybe, randomise the map, too.

10 posts.
Sunday 08 April, 14:31
Reply