© 2021 Chamber of Turkish Electrical Engineers.Transmission system operators (TSOs) need to control voltages along the grid to have an economic and reliable system operation. Due to fixed and operational costs of switching equipment of shunt elements, TSOs are expected to minimize the number of switching operations of these devices. The purpose of this study is to optimize reactive power flows so as to have minimum transmission losses and number of switching operations of controllable shunt elements within a specified period. The optimization problem is defined as a two-stage problem, where the switch statuses of shunt elements are determined in the first stage and reactive power dispatch of generators are optimized in the second stage. Power balance and transmission loss equations have been linearized to obtain a Linear Programming (LP) problem. The developed algorithm has been tested on a sample network and satisfactory results have been obtained in terms of convergence performance and execution time.