About building an if-else function in yalmip #1197
Replies: 2 comments 9 replies
-
For functions with multiple nested loops, can you use the implies function? For example implies(Temp_net(k,1), [Pnet(k,1)>=0,Price(k,1)>Peakprice,Pgrid(k,1)==Pnet(k,1)]) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I have also encountered this problem, may I ask if you have solved this problem? If so, can I ask you how you solved it? |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone
I want to build a loop function on the decision variable, as shown in the figure below, but there is an error using the implies function in the yalimp solver.
here is my model's constraints for your reference.
clc;clear;
T=96;
Pnet=sdpvar(T,1,'full');
Pgrid=sdpvar(T,1,'full');
Temp_net=binvar(T,1,'full');
load case1.mat
Constraints=[];
for k=1:T
Constraints = [Constraints, implies(Temp_net(k,1),
[Pnet(k,1)>=0,Price(k,1)>Peakprice,Pgrid(k,1)==Pnet(k,1)])];%If Pnet>0, and Price>peakprice, Pgrid==Pnet(sell excess power to main grid)
end
Program error
One of the constraints evaluates to a FALSE LOGICAL variable. Your model is infeasible
Constraints = [Constraints, implies(Temp_net(k,1),
[Pnet(k,1)>=0,Price(k,1)>Peakprice,Pgrid(k,1)==Pnet(k,1)])]
Beta Was this translation helpful? Give feedback.
All reactions