simple question concerning "implies"

16 views
Skip to first unread message

Sarah

unread,
Sep 11, 2019, 11:12:44 AM9/11/19
to YALMIP
Hello everyone,
I have a probably rather simple question concerning "implies" and I am not quite sure why I get the error message.

So I wanted two of my constraints in the MATLAB code to be

Constraints = [Constraints, [implies o, P_th_grid==zeros(N,1)]:'binary district heating'];
Constraints = [Constraints, [implies v, P_gas_th==zeros(N,1)]:'binary gas heating'];

meaning that if o=true, P_th_grid should be zero (and P_gas_th should be zero, if v is true).

MATLAB now gives me the error message
"Index exceeds matrix dimensions.

Error in implies (line 49)
X = varargin{1};

Error in model20190911 (line 356)
Constraints = [Constraints, [implies o, P_th_grid==zeros(N,1)]:'binary district heating'];"


What could be the problem? I'm not really familiar with implies, just tried following
https://yalmip.github.io/command/implies/ (and did it badly, I suppose).
Thanks a lot in advance!!

Johan Löfberg

unread,
Sep 11, 2019, 11:15:36 AM9/11/19
to YALMIP
you are missing parenthesis in the call to implies

Sarah

unread,
Sep 11, 2019, 12:01:42 PM9/11/19
to YALMIP
Thank you so much for the fast reply!!! It was really parenthesis^^
(I've already tried them but did not realize that a space between "implies" and the parenthesis was a syntax error).
Reply all
Reply to author
Forward
0 new messages