I want to find a charging schedule that minimize cost of charging an EV.

The main objective is to have a fully charged car for the next morning, but the sub objective is to minimize cost based these two things combined:

  1. Charge when electricity is cheapest - I know the hourly electricity price for the next 24 hours
  2. Minimize hourly peak demand charges for the household - I pay a small additional fee each month if my hourly demand exceed different steps.

I know the power size of the charger (W), the capacity of the car battery (Wh), how many hours I have to charge (h), I know what my household peak is right now (W), and all prices for both consumption (Money/Wh) and peak demands (xx Money, if hourly demand > xxxx Wh).

  • What would one call this type of problem?
  • How would one go forward to solve this?
  • Is there a python package that can help me solve this? (I have seen similar problems been solved with Gurobi)

1 Answer 1


This is an optimization problem: you're trying to find which combination of parameter values gives the smallest value for a cost function, taking into account some constraints on the parameters.

The first step is to formalize the problem: the fixed parameters (electricity rate, charge duration, ...), the variable parameters (when to charge), the constraints (e.g. when you need the car to be charged).

From the description the problem is simple enough: not that many parameters, the cost can be directly calculated for particular parameter values. So I think you could simply use a grid search to solve it. A more advanced option would be genetic learning, but that's probably an overkill.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.