Dear Johan,
I am trying to run a simple MPC problem to control the indoor temperature in buildings with the objective of minimizing electricity cost. This seems to work fine.
I add an additional soft constraint that aims to keep the overall power consumption below zero at the end of the day, so I expect the electricity cost to rise at the expense of satisfying this constraint if possible. The problem is the electricity cost further reduces by adding this constraint which doesn't make sense since the previous problem without this constraint is itself a cost minimization problem.
I have tried different solvers - gurobi, cplex, and intlinprog, get the same results. I am not sure if the problem is caused by the problem formulation since I use the abs operator from Matlab in one of the constraints.
I include a zip file of the code with this, would appreciate any help. The constraint which causes the issue is on line 84 of the MILP_CONTROL file. If I deactivate it the problem becomes a simple cost optimization problem.
Kind regards.