1. A method of converting a resource into a product, wherein the resource and the product are each represented by a time-dependent property (P IN , C fuel ; P OUT , P Price ) equivalent to an objective quantity per unit of measure, wherein a performance of a system converting the resource into the product is represented by an efficiency measure (η), and wherein the performance is degrading continuously and can be increased by a maintenance action applied to the system, wherein the method comprises: a) introducing a state variable (δ 1 ) representing a maintenance action performed on an engine at a first time step (t 1 ) and estimating a maintenance expenditure (C 1 ) for said maintenance action, b) providing an initial value for the efficiency measure (η(t 1 )) of the engine as well as a model of the system for predicting, for N j >1 discrete time steps (t j ), the efficiency measure (η(t j )) both with and without said maintenance action, c) providing, for N j >1 discrete time steps (t j ), a forecast of the time-dependent property (P IN (t j ), C fuel (t j )) representing the resource and a forecast of the time-dependent property (P OUT (t j ), P Price (t j )) representing the product, d) setting up an objective function F including a change in accumulation of the objective quantity at the system related to the degradation in performance of the engine, and based on the maintenance expenditure (C 1 ), the efficiency measure (η), the property forecasts (P IN (t j ), C fuel (t); P OUT (t j ), P Price (t j )), and the state variable (δ 1 ), and e) minimizing the objective function F with respect to the state variable (δ 1 ), and scheduling a maintenance action for the engine at the first time step (t 1 ), wherein steps a) through e) are performed in a computer.