Ship voyage optimization for safe and energy-efficient navigation: A dynamic programming approach