We consider the problem of selection of supply temperatures in a district heating (DH) network. The problem is formulated as a mathematical model which incorporates the consumers, the district heating network and the production plant; the objective is to minimize the operational costs. The dynamics of the DH consumers and the dynamics of the distribution network usually affect the operation of the DH system heavily. This is both due to the time delays in the DH network, which are usually large compared with the time delays in other parts of the DH system, and due to heat storage in and heat loss to the surrounding ground. For operational planning and operational optimization, it is therefore vital to have appropriate simulation models of the consumers and the DH network available. We give a discussion of the two elements and describe the principle of the so-called node method. This method can be applied to simulate the flow and temperature development of a given DH system as a consequence of the consumers' heat loads and supply temperatures from the plant. We present models of the production system under various assumptions of its constitution. We consider one production plant, i.e. one geographical location. Three types of production units are considered: boiler units, back pressure units and extraction units. The objective function, which is to be minimized, consists of a sum of contributions, one for each time period, for each production unit, and for each pump. In each time period, there are fuel costs and also costs for the electrical power consumption of the pumps. If there is a CHP unit, then there is also, in time period t, an income (i.e. negative cost) associated with the sale of the produced electrical power to the electrical network. The strategy for solution of the mathematical model is to establish an interplay between the node method and a standard optimization package. Computational experiences with several real-world cases are extensively discussed. It is demonstrated that it is possible to solve the model and thereby obtain the optimal supply temperatures. The cases demonstrate that minimization of the cost of district heating calls for a very active control of the supply temperatures from the plant, in the case that the heat production costs either depend on the time of day or on the load level. This is explained by the dynamic and complex nature of the district heating system. Our method appears to be easy to use and flexible. It is, for instance, very easy to incorporate models for different heat production principles and to include different restrictions. As implemented, the model is suited for off-line analysis due to its long computation time. However, there are large potentials for substantial reduction of computation time by more careful implementation. This way, it appears that the method could indeed be applied in on-line operational planning at regular time intervals, e.g. every hour.