In this paper we studied the actuality of the problem of optimal control of the heat supply system as a single complex object on the basis of a generalized mathematical model that takes into account the dynamics of the fuel combustion process, heat generation, its transmission through the heat network and that takes into account the dynamics of heat energy consumption and various external factors.