2

I have been reading a lot of literature on Simulated Annealing(SA) and its effectiveness in solving the TSP. This leads me to think if SA could be used to optimize just a source to destination path finding.

Basic SA pseudocode (from wiki)

s ← s0; e ← E(s)                                  // Initial state, energy.
sbest ← s; ebest ← e                              // Initial "best" solution
k ← 0                                             // Energy evaluation count.
while k < kmax and e > emax                       // While time left & not good enough:
  T ← temperature(k/kmax)                         // Temperature calculation.
  snew ← neighbour(s)                             // Pick some neighbour.
  enew ← E(snew)                                  // Compute its energy.
  if P(e, enew, T) > random() then                // Should we move to it?
    s ← snew; e ← enew                            // Yes, change state.
  if enew < ebest then                            // Is this a new best?
    sbest ← snew; ebest ← enew                    // Save 'new neighbour' to 'best found'.
  k ← k + 1                                       // One more evaluation done
return sbest                                      // Return the best solution found.

Here s0 represents a solution (so in my case it already means a source-destination path), my question is how do I generate these "solutions" other than using Maximum flow algorithm or dijikstra's.

Ashwin Krishnamurthy
  • 3,750
  • 3
  • 27
  • 49
  • Depends on what kind of paths you talking about. Do you think about a pathfinding algorithm for a game or a robot or something more abstract (e.g. a graph like structure). – MikeMB Jun 05 '14 at 21:56
  • @MikeMB Graph like structure. – Ashwin Krishnamurthy Jun 05 '14 at 22:00
  • @MikeMB Consider a 4x4 matrix. Let the agent start at 0,0 and needs to go to 3,3 some indices yield positive cost and some yield negative cost. Could I directly apply SA for this or should I use some path finding algorithm first, get several paths and optimize the list of paths using SA? – Ashwin Krishnamurthy Jun 05 '14 at 22:05
  • To be honest, I probably wouldn't use SA at all. But If you want to use SA and assuming neighbouring fields in the matrix have similar costs, I would start with a compartively straight path, then add additional "waypoints", which you move randomly around. The lower the Energy level, the more waypoints I would use and the smaller the changes I would make to these waypoints when creating a new solution. If I can come up with an actual algorithm I'll give you a proper answer. – MikeMB Jun 05 '14 at 22:59
  • 1
    You can use SA to find approximate solutions for basically any problem, but it really only makes sense to apply it if there's nothing better available for that problem. TSP is an NP-complete problem so it makes sense to use SA for it, but Dijstra's algorithm, and especially A*, are fast and give provably shortest paths, so why not use one of them? – j_random_hacker Jun 06 '14 at 00:44
  • @MikeMB I understand. Let me know how the algorithm works out. Thanks. – Ashwin Krishnamurthy Jun 06 '14 at 01:36
  • @j_random_hacker yeah I know a* and dijikstra algorithms are there. I was just curious because SA has been used in a lot of areas especially areas like robot path planning and vehicular area networks so I wanted to implement it myself and see how it works. So I started with a graph data structure. – Ashwin Krishnamurthy Jun 06 '14 at 01:38

0 Answers0