## 1 Introduction
The exact mixed-integer nonlinear programming (MINLP) models that represent the studied problems were solved with the nonlinear solvers available in the GAMS software; even if numerical results demonstrate the advantage of including reactive power capabilities in the final objective function value with respect to the unitary power factor case, the authors did not consider economical aspects in the objective function, which in some cases, caused large renewable generation sizes that were not economically viable to the grid operator only considering the costs of the energy losses as the recovering investment factor. The authors in [16] presented a heuristic-based optimization approach based on the hybridization of the mixed-integer linear programming model with the classical simulated annealing method to solve the problem of the optimal selection and location of battery energy storage systems and PV sources in medium- and low-voltage distribution networks. The simulated annealing algorithm was used to define the type and location of the distributed energy resources along with the distribution network; while the exact mixed-integer programming was used to define their optimal daily operation. The main contribution of this research corresponds to the inclusion in the objective function of the investment and operating costs in the network presented using annualized costs. However, the main weakness of this approach is that the sizes of the PV sources and the batteries were previously set which implies that the problem becomes the optimal sizing of these devices into a selection problem, which makes their optimal solutions be highly conditioned by the initial setting of the studied devices. The authors of [8] applied the classical particle swarm optimization method to simultaneously locate battery energy storage systems and renewable energy in electrical distribution networks. The main contribution of the authors is the economic analysis introduced considering installation, operation, and maintenance costs; however, the authors oversimplified the distribution grid, which reduces the complexity of the MINLP model to a mixed-integer linear programming model. Even if it guarantees optimal solutions for the unique nodal representation; it do not represent to the optimal solution when the grid topology is included since the problem of the optimal location (nodes' selection) is neglected. The authors in [8] proposed a new multiobjective algorithm to determine the optimal sizing and allocation of PV systems in radial distribution systems. The Java algorithm was modified to find the optimal PV capacities for limited bus locations in the network. The proposed algorithm showed better performance against known techniques, and the results were presented. However, the main problem with this research corresponds to the feasibility of the final solution regarding investment and operating costs since these were not considered in the optimization model. Unlike in previously reported works, this research studies the problem of the optimal sizing and locating of PV sources in AC distribution networks operating at medium-voltage levels, considering the annualized investment and operating costs of the PV sources summed with the total energy purchasing costs at the substation bus. The main contributions of our research were the following: (i) the application of a recently developed metaheuristic optimization algorithm named the Newton metaheuristic algorithm (NMA) with a mixed discrete-continuous codification that allows defining the set of nodes where the PV sources will be located as well as their optimal sizes [17]. The proposed optimization scheme is based on the master-slave approach, where the master stage is the NMA and the slave approach corresponds to a classical power flow method for AC distribution grids.