Hello raft,
Thanks for responding my question.
I am still having some minor problems with my TimeAStar.
What I see in your application, is that the depth does rise steadily on every occasion.
But in my case, the depth sometimes drops back to a lower level.
So 2 things could happen, I am calculating the wrong g cost from getActualTimelessCost
BTW, as my map may have negative coordinates, I am just using ids for identifying cells
But I separate 2 ids, one for time dependent, one for time independent,
time indepenent ones won't change as they are designated to which cell I am after.
The time dependent one is for sorting. So the second problem may lie in which node
I close into the closed list. I choose to close the time dependent one, so the closed list nodes
are the ones which was previously generated from the TimeAStar constructor.
So If I calculate realtime g costs, and the depth drop back, it will be too time consuming
Even with 1024 depths in your application, it just took a fraction of time to complete
in millisecond range, mine however takes seconds to complete which worries me.
Update:
Not a problem, yours exhibits the same behavior, sometimes the depth would drop.
But ha ha, the execution time does worry me, milliseconds compared to secs
Try to lower it down, report back later
Update2:
(Close Destination)
I have changed the container of reserved table from default tree maps to hash map that improve a little
~28 secs down to ~5 secs, still slow though
Update3:
I would now try to cache the real time paths....
Update4:
Profiled the getActualTimelessCost function again, finding out that it averaging takes about 0.04 secs to complete one astar computation.
If I allow 8 directional movements, including stationary, that's 9 tiles in an open space area, then it accumulates to about 0.4 secs,
If I have to iterate until a far destination is reached, it actually takes a while to complete. Therefore, the precomputation of path cost is inevitable.
Update5:
(Far destination)
After using linear maps and arrays, the astar turn over time is reduced from 0.04 secs to 0.02 secs
Cannot believe my eyes.
1163 iterations * 0.02 secs = 23 secs <<<<< C++ with no precomputations (The multiplier is the turn over time to compute the AStar cost on demand, already using arrays and linear maps)
1163 iterations * 0.000001 secs = 0.001 secs <<<<< Java with precomputations (The multiplier is the access time for the actualCosts table)
Update6:
I have changed to use a fast square root method,
http://www.codeproject.com/Articles/69941/Best-Square-Root-Method-Algorithm-Function-Precisi
Now the AStar turnover time is 0.001 sec, with 1000 iterations, it takes around 1 sec.
Thanks for your time
Happy working day
Thanks
Jack