Talk:Weather routing: Difference between revisions
Content added Content deleted
(→A solution at last!: Responded to Wherrera.) |
(Much faster algorithm) |
||
Line 20: | Line 20: | ||
Can't help with Swift as it's not a language I use (never been an Apple developer) but it seems to be gaining in popularity so hopefully some one else will have a go.--[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 13:39, 17 May 2020 (UTC) |
Can't help with Swift as it's not a language I use (never been an Apple developer) but it seems to be gaining in popularity so hopefully some one else will have a go.--[[User:PureFox|PureFox]] ([[User talk:PureFox|talk]]) 13:39, 17 May 2020 (UTC) |
||
==Much faster algorithm== |
|||
When translating Go to Phix, the first thing I spotted was that it was adding routes already longer than |
|||
the shortest yet found, fixing that made it five times faster. Then I questioned whether searching |
|||
through many thousands of routes was really necessary. Maybe some quirks of a not-fine-grained-enough |
|||
simulation could cause illogical leap-frogging, but in the real world a ship/route might hit better |
|||
conditions and catch up a bit, but could never overtake a ship ahead of it, if it followed along the |
|||
exact same route - this is not yacht racing with different boats, tighter tacking or better crews. |
|||
Hence the Phix version uses a single 9x9 lowest costs [aka times] grid along with a single 9x9 array |
|||
of backlinks, and pops any new/improved times [back] onto a flat to-do list. Apart from replacing |
|||
surround() with chart[], a personal choice, minimum_time_route() is a drop-in replacement for its |
|||
predecessor. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 11:56, 22 May 2020 (UTC) |