Ships actually use very precise algorithms to calculate the relative cost of labor vs. inventory getting delayed, using factors like the depreciation of the cargo, the spot price of fuel, and even changing interest rates in the market.
Oil tankers in the middle of the ocean, for example, will speed up and slow down as spot prices of oil increase or short-term interest rates decrease, since the inventory cost of their cargo has gone up and then down.