The power generation system in Denmark is extensively based on small combined heat and power plants (CHP plants), which produce both electricity and district heating. This work deals with smaller plants spread throughout the country. Often a heat accumulator is used to enable electricity production, even when the heat demand is low. This system forms a very complex problem, both for dimensioning, designing and operation of CHP plants. The objective of the work is the development of a tool for the optimization of the operation of CHP plants. The optimization problem is a MINLP-problem of a very large scale. Therefore, a set of heuristic rules is formulated in order to reduce the size of the problem. Different cases are being tested, involving CHP producing units to cover the demand. The results show that it is of major importance to consider the operation of the plant in detail already in the design phase. It is of major importance to consider the optimization of the operation of a plant, even at the design stage, as it may cause the contribution margin to rise significantly, if the plant is designed on the basis of a detailed knowledge of the expected operation.