Clearly, the task is not a trivial one, but the worst possible solution would be to simply have the computer mimic the way a human navigates. Ships don't swim like fish, and airplanes don't fly like birds, even though both follow the same physical laws. In the same way, computers don't solve problems the way humans do.
At the core of our safe route generation algorithm is the concept of constructing NO GO ZONES on the ENC (Electronic Navigational Chart)—areas where a vessel cannot sail due to draft limitations and safe under-keel clearance. To achieve this, we extract all the bathymetric information available on the chart, including spot depths, depth contours, shorelines, depth areas, point dangers, swept areas, shore facilities, and so on. Using this data, we build a triangulated model of the seabed, which then allows us to generate a NO GO AREA for any vessel's draft value.
Based on the ship's current location and speed vector, we can calculate the distance to the boundary of the NO GO ZONE, allowing us to determine whether the current sailing parameters are safe. If not, we can suggest an alternative, safer route. This same approach is applied when automatically calculating a route from point A to point B.
An example where you can experiment with vessel parameters yourself is available at the following link:
https://win1hetz.bgeo.fi/web_demo/mkart.html. Below are several screenshots from that site.