A generalized approach to the optimum management of a cogenerating plant