Optimal Charge Scheduling of Electric Vehicles in Smart Homes