Talk:Weather routing

From Rosetta Code

Vote for deletion

This task was created more than 4 years ago and still has no solutions even from the author himself.

When one looks at what's involved, this is hardly surprising. Frankly, as someone who knows nothing about sailing, I wouldn't even know how to start and, when I looked on Github for inspiration, all I could find was a very complex C++ application.

It seems to me that this is very much the province of specialist commercial software and unsuitable as a RC task. What do others think - should the task be deleted or can someone who knows about these matters submit a solution which the rest of us can use as a guide?

--PureFox (talk) 11:35, 14 February 2020 (UTC)

A solution at last!

Well, it seems that we do have a mathematical sailor in our membership and, better still, one who can write clear, well documented and (thankfully for RC) 'graphics free' code which even a landlubber such as me can understand!

So congratulations to the Julia author, Wherrera, for submitting the first solution to this task. Now we have something to guide us, I'm working on a Wren translation and might try and do a Go solution after that. --PureFox (talk) 15:46, 15 May 2020 (UTC)

   Thanks! It would also be interesting to see a Swift version since many modern small craft sailors use smartphones for GPS :) 

--Wherrera (talk) 23:10, 15 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.--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 [Go] 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. --Pete Lomax (talk) 11:56, 22 May 2020 (UTC)