The development of conceptual models of a digital city poses numerous challenges for developers. The public sector concept model has become one of the most difficult models to use. When developing algorithms to find a solution, the multidirectional interests of businesses and public institutions are combined. This type of model reflects the most acute and urgent problems faced by megapolises with regard to combining numerous localized services provided to the community in a limited territory. The administrations of both cities and regions (the scale of the smart territories) must make decisions concerning overcoming the barriers existing between the profits of commercial structures, the negative externalities generated by their activities, and the social benefits to the population in the territory under their control. It is necessary to solve this problem to achieve the effective management of enterprises belonging to the segment of long-term participants in various business activities, interacting with the surrounding social and business environment in a complex. This study takes into account the complex structures of the economic processes characteristic of megacities. The periodicity of economic processes is also taken into account. When choosing an optimization criterion, functions reflecting the level of internalization of responsibility for external effects were considered. The authors propose a mathematical model that can be used as part of the management decision support systems software, aiming at taking into account the externalities of a wide range of national, institutional, business, and social activities.