Dynamic optimization of ship energy efficiency considering time-varying environmental factors