The problem of optimal energy allocation planning in the cogeneration systems is a complex one particularly when energy purchase problem are introduced. So it needs to be solved by an efficient technique. In this paper, a mixed-integer linear optimization model is developed to aid management in the analysis of the distribution problem in the cogeneration systems. The primary objective of the optimization scheme is to share both electric and thermal demands among the in-plant generating units and the energy purchase facilities to minimize the total energy cost. To illustrate the applicability of the model, a complex cogeneration system in an integrated steel mill is chosen as a representative case study.