In the current age, power systems contain many modern elements, one example being Flexible AC Transmission System (FACTS) devices, which play an important role in enhancing the static and dynamic performance of the systems. However, due to the high costs of FACTS devices, the location, type, and value of the reactive power of these devices must be optimized to maximize their resulting benefits. In this paper, the problem of optimal power flow for the minimization of power losses is considered for a power system with or without a FACTS controller, such as a Static Var Compensator (SVC) device The impact of location and SVC reactive power values on power system losses are considered in power systems with and without the presence of wind power. Furthermore, constant and variable load are considered. The mentioned investigation is realized on both IEEE 9 and IEEE 30 test bus systems. Optimal SVC allocation are performed in program GAMS using CONOPT solver. For constant load data, the obtained results of an optimal SVC allocation and the minimal value of power losses are compared with known solutions from the literature. It is shown that the CONOPT solver is useful for finding the optimal location of SVC devices in a power system with or without the presence of wind energy. The comparison of results obtained using CONOPT solver and four metaheuristic method for minimization of power system losses are also investigated and presented.