The cost of electricity generation depends on different parameters and characteristics. These parameters and characteristics are regional characteristics, fuel costs of fossil fuel power plants, government policies, and technological capabilities, which lead to fluctuations in the cost of electricity generation. The production cost has gradually decreased with the rapid progress of technology and gaining more experience in using wind and solar energy. Therefore, the cost of electricity generation per kilowatthour has declined significantly in recent years. On the other hand, the cost of fuel for gas and thermal power plants is increasing with the reduction of oil and gas reserves and the elimination of subsidies for petroleum products. Therefore, it is necessary to replace gas and thermal power plants with wind and photovoltaic power plants in the future. Moreover, using charging stations for electric vehicles as a source of energy exchange in the form of V2G and G2V greatly helps to manage the costs involved. Using electric vehicles reduces fuel costs, maintenance costs, and air pollution allows protecting the environment and reducing respiratory, heart, and lung diseases. In this paper, the optimal planning in the location of the photovoltaic power plant, wind, and charging station in the presence of load uncertainty and electricity price uncertainty are examined using the crowding-based distance index in the edited Not-Dominated Sorting Backtracking Search Algorithm. Examining the results in MATLAB software on the 33-bus IEEE network indicated the high accuracy, speed, and control of the algorithm.