0

I have to be able to, with this 'dataset' (its a graph): ...

{
 0 : [3,2,1],
 1 : [4],
 2 : [6,5],
 3 : [7],
 4 : [8],
 5 : [9]
}

... input a initial and a final value with a goal to show the best path possible through Genetic Algorithm ( my problem is to run through the dataset and find the best path ). I Found this fitness function in another project :

fitness = numpy.sum(pop*equation_inputs, axis=1)
    return fitness

How can I create an ideal fitness function which 'fit' in my problem?

HelloWorldd
  • 172
  • 2
  • 14
  • You haven't mentioned what your problem is, what this dataset means and what you have tried already. Please see [how to ask](https://stackoverflow.com/help/how-to-ask) for more details. – Yevhen Kuzmovych Mar 16 '21 at 14:17
  • I get this code from one example, and I dont how how to do. Updated the answer with more details – HelloWorldd Mar 16 '21 at 14:20
  • Do you know what fitness function is? – Yevhen Kuzmovych Mar 16 '21 at 14:23
  • The concept yes, but I dont know how to tell that '0,2,5,9' is better than another path (in a example that 0 is my initial and 9 is the final) – HelloWorldd Mar 16 '21 at 14:28
  • It depends on your task. Commonly, the search problem prefers the shorter path. So I guess you need to check its length. But again, it depends on your problem. – Yevhen Kuzmovych Mar 16 '21 at 14:31

0 Answers0