In this paper, an optimization algorithm based on a Mixed-Integer Linear Programming (MILP) solver is developed to determine the best energy generation solutions for marine applications. Environmentally sustainable systems (e.g., fuel cells and batteries), heat recovery devices (e.g., HRSG and Organic Rankine Cycles) and traditional power technologies (e.g., diesel generators and fired boilers) are modelled as linear systems to simulate their off-design performance. The tool considers thermal, electrical and propulsion power demands, space constraints, fuel type and availability for up to three main-vertical zones of the ship. From this information, the optimizer identifies the energy system configuration which minimizes a cost optimization function. The objective function considers the actualized capital costs of each technology (based on real market data and updated literature review), fuel costs and CO2 emissions taxes. In this article, the case study of a cruise ship is considered. The optimization is performed referring to real historical load demands of the cruise ship and several typical mission profiles are considered to simulate a whole operational year. Then, the same optimization is performed after a reduction of the price of H2, which is expected in the near future according to the latest market forecasts. Thanks to this analysis, it is possible to determine the influence of this economic parameter on the optimal on-board power generation configuration. It is worth noting that the approach presented here has a general validity and can be applied for the optimization of various typologies of maritime vessels. Moreover, the MILP algorithm could be easily expanded to consider additional demands (e.g. cooling power), constraints (e.g., weight), and power systems.