The growing diffusion of the distributed generation systems, due to the European and national legislations which impose the fossil fuel and greenhouse gas emissions reduction and the renewable sources exploitation, have led to an increase in the complexity of the existing energy networks. The main issue of the complex energy grids is their management, which consists in the resolution and optimization of the load allocation problem by minimizing the primary energy consumption and, thus, improving the overall efficiency. In this context, the aim of this paper is to develop and validate a nonlinear algorithm suitable for the resolution of the load allocation problem. In detail, the software combo, which has been developed by the University of Bologna, is based on a nonheuristic algorithm and allows to optimize a complex energy network—characterized by electrical, thermal, cooling and fuel fluxes—by evaluating all the possible combinations of solutions. The objective function of the software consists in the minimization of the total cost of energy production, including not only the variable costs, but also the costs related to the environmental impact of the energy systems. In this paper the mathematical model of the algorithm at the basis of the software combo is presented and described in detail. Furthermore, the software has been validated by its application to a case study and comparing the results with the ones obtained with a previously developed software based on a genetic algorithm (heuristic nonlinear method).