fitness for Shortest path using a genetic algorithm

Hi.

I have this problem:

I'm doing a program that has a map and two points. the map has wall that are not valid positions.

I have used a A* algorithm to calculate the shortest path and is working fine.

now i'm implementing a genetic algorithm to solve the problem but i'm not having sucess.

My genetic operator are directions (left, right, up and down).

I'm not being able to find a goodfitness function to solve the problem.

can someone tell me a god function or here I can found information about that?

I have been searching on google and I have not yet had sucess.

I have tryed two diferent fitness tecniques:

- add 1 for each step and if it finds a wall or gets out of the map add the maximum value (mapsize*mapsize).

- the other one is add the valid steps and if it finds a wall or gets out of the map add the number of necessary steps to gets to destination. the valid steps has a weight of 30% and the necessary steps has a weight of 70% (i have tryed to use diferent weight).

Can someone help me?

thanks

[1101 byte] By [Ricardo_EI_ESTGa] at [2007-11-26 13:23:35]
# 1
> now i'm implementing a genetic algorithm to solve the problemWhy? This sounds to me like a case of having a hammer and seeing everything as a nail.
YAT_Archivista at 2007-7-7 17:56:12 > top of Java-index,Other Topics,Algorithms...
# 2

this is just for academic use. thats why i'm doing it.

I used genetic algorithm to solve TSP problem and watch how it works and that it is very good to solve the problem instead of A* and now I'm doing the oposite with this example.

can you help?

Message was edited by:

Ricardo_EI_ESTG

Ricardo_EI_ESTGa at 2007-7-7 17:56:12 > top of Java-index,Other Topics,Algorithms...
# 3

How about adapting your TSP code as follows. Your graph G(V, E) has two special vertices: v_s and v_d (start and destination). Let a candidate solution consist of a permutation of V\{v_s, v_d}u{v_m} where v_m is a new marker vertex whose purpose is to allow you to treat part of the candidate solution as irrelevant. Given candidate solution v_0 v_1 v_2 ... v_n v_m v_n+1 ... the weight is c(v_s, v_0) + c(v_0, v_1) + ... + c(v_n-1, v_n) where c(v_a, v_b) is the cost of the edge ab.

YAT_Archivista at 2007-7-7 17:56:12 > top of Java-index,Other Topics,Algorithms...