After having found this functionality on the command "implies" (
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Commands.Implies), I tried to model the cycle counter like this as a constraint:
cycleornot = binvar(Ns,timestep);
for b=1:Ns
for t=1:timestep
CycleCONDITION = [socdv(b,t+1) - socdv(b,t) <= -10^(-4)];
F = implies(CycleCONDITION, cycleornot(b,t));
Constraints = [Constraints, F];
end
end
I expected this code to give me, after optimization, true value for battery "b" at time "t" when a cycle begins.
As the binary variable "cycleornot" does not affect the cost in any way (and nor the other constraints than "F"), I thought I would get the same optimal cost and "socdv" values as the initial code without the few lines above.
Now my results are wrong and the optimizer fails.
I used these settings to solve my problem:
options = sdpsettings('solver','gurobi','gurobi.QCPDual',1);
sol = solvesdp(Constraints,Objective,options);
Where have I done something wrong?
Thank you in advance for helping me.