0

I have a question in resolving a traffic problem using the PSO algorithm. Supposing we have n vehicles (limiting it here in just four vehicules) theses vehicles have the same destination. They have different starting cities.(suppose we know their positions (x,y)) D: the distance between the starting city and the destination. d: the max distance it can travel before it runs out of gas. D >> d : each vehicle have to refuel N times with N=D/d The path that every vehicle should follow is undefined. Task: We are searching for the minimal number of gas stations so that every vehicle doesn’t break down (because of gas of course) . what is the number of gas stations and what are their locations.

Geekoo
  • 1
  • 1

1 Answers1

0

I believe you can solve this with your standard Dijkstra search algorithm with just a slight augmentation.

First set your starting point to the hard-coded location. Do the Dijkstra search as you normally would, keeping note of gas stations you encounter but somewhat ignoring them for now. Try to reach the destination without stopping for gas, but cancel the search for all the nodes where you would have run out of gas. Now if you reach the destination without running out of gas, that is the shortest path and it involved no gas stops.

However, if you do run out of gas, then set the starting points (and starting distances) to the gas stations you found in your previous search, so now you have multiple potential starting points. And then it just repeats. If you fail again to reach the destination, search starting from all the gas stations you found in that last search.

Keeping doing this until you've reached the destination from all starting points in your previous query. Tally up the distances and pick the shortest path.

Now if you reach a stage where you ran out of gas stops and failed to reach the final destination, there there is no possible route to the final destination without running out of gas.

  • thank you I appreciate your answer but the goal here is to use PSO. – Geekoo May 19 '15 at 13:47
  • Oh my bad, I didn't realize you had to use PSO. There I'm a bit stumped, I'm afraid, as I'm not sure how to evaluate fitness level with this kind of refueling criteria. –  May 19 '15 at 16:01
  • thanks for response. Yes this is my problem here "fitness" is driving me crazy...anyway....do you know any other forum where i can post this problem? – Geekoo May 20 '15 at 13:46