Optimized Scheduling Of Electric Vehicle Charging And Discharging In A Vehicle-To-Grid System