| To | ||||||||
|---|---|---|---|---|---|---|---|---|
| From | N | NE | E | SE | S | SW | W | NW |
Consider a sailor who wishes to sail from one point (A) to another (B) in the shortest possible time (for example, in a race). To create a simple model of such a situation, suppose that the lake is represented by a 2-dimensional square n-by-n grid of waypoints. Every path from A to B consists of a sequence of legs, the endpoints of which must be waypoints. Suppose further that the only legs that the sailor considers are legs connecting one waypoint to one of its 8 neighbors: N, S, E, W, NE, SE, SW, or NW.
The boat's speed depends on the relative angle between the boat's heading and the wind's direction. The boat cannot sail directly into the wind. Upwind, crosswind, downwind, and away tacks can be assigned different travel times in the app above.
Changing from a port to a starboard tack, or vice versa, takes time. The field called Delay gives the tacking penalty used by the dynamic program.
The wind direction can change from one leg to the next. The transition matrix above gives the probabilities of the new wind direction conditional on the old wind direction.
The data are solved using a dynamic programming model. The value iteration step computes the best expected remaining time for each location, previous tack, and current wind direction.
After calculation, simulations show sample random realizations of the changing wind and the corresponding optimal strategy.
The histogram view summarizes all simulations since the last calculation, including minimum time, maximum time, mean time, and median time.