3
$\begingroup$

I have been working with a model for the past couple of weeks, but I am not sure what am I doing wrong as every time Pyomo returns that is infeasible or unbounded. I am trying to model an Electric Vehicle scheduling to minimise the electricity bill of a house. The house has a PV generation system connected as well. The EV is able to charge and give energy to the house if required everytime that is plugged, i.e. avail = 1 and and only discharge when is driving, i.e. avail=0. The model is capable to sell energy back to the grid as well which also helps to reduce the electricity bill even more.

I already figured out how to prevent charging when avail=0 (driving) in another question https://stackoverflow.com/questions/62406319/pyomo-struggling-to-get-a-constraint-to-work/62406945#62406945 which is great. But now the problem is that because the model is considering that the energy used when driving is the same as if it was selling it back to the grid, the results are not realistic at all.

Also I am not sure if the optimisation is correct as the model is ignoring the house demand when the EV is not available (avail=0). As I explained in my previous question, I am considering this model as a stationary battery that connects and disconnects, however, at this point I am not sure if it is correct that way.

At the moment, load contains both the house and EV demand.

net_demand = load-PV
posLoad = np.copy(load-PV)
negLoad = np.copy(load-PV)
for j, e in enumerate(net):
    if e >= 0:
        negLoad[j] = 0
    else:
        posLoad[j] = 0

posLoadDict = dict(enumerate(posLoad))
negLoadDict = dict(enumerate(negLoad))

I would like to keep them each in separate dictionaries, which I guess it will help me to keep the house drawing energy from the grid or PV even if the EV is driving (avail=0) but I am not sure how to formulate it.

Here is the rest of the code so far:

As I mentioned, availDict = dict(enumerate(df[avail])) has values avail=1 (plugged) and avail=0 (not plugged and driving).

I hope that I explained my problem properly and hopefully you are able to understand what I meant.

If there is another suggestion or you need more information please let me know so I can provide it as soon as possible.

Thanks

$\endgroup$
1
$\begingroup$

Solvers struggle a lot with unbounded problems. Make sure that the variables in your objective are properly bounded from both sides, with bounds that are not too large. Also check your Lagrange multipliers to make sure that the constraints that are supposed to bound your variables are active at the solution.

Another numerical issue might also arise from your big-M value, which may be a bit too large. Try using a smaller big-M or, ideally, a convex hull formulation.

If, despite those steps, your problem is now, ideally, infeasible rather than unbounded, you can find the culprit by disabling all constraints and enabling them back one at a time, until your problem suddenly becomes infeasible. Since you are using Pyomo you can actually write a small script to do this automatically for you.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, I had a look at my constraints at it seems that I worked this around. Thanks for your help $\endgroup$ – DVRJ Jun 29 at 20:03
  • $\begingroup$ @DVRJ Glad it worked out :) $\endgroup$ – Nikos Kazazakis Jun 30 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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