Skip to content

Commit

Permalink
Fixes #413
Browse files Browse the repository at this point in the history
  • Loading branch information
johanlofberg committed Jun 22, 2017
1 parent 8a6eef3 commit c39a51b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
14 changes: 12 additions & 2 deletions extras/@constraint/ge.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
% Try to evaluate
if isa(X,'constraint')
% (z > w) > y
Z = X.List{end} - Y;
try
Z = X.List{end} - Y;
catch
Y = reshape(Y,[],1);
Z = X.List{end} - Y;
end
F = X;
F.List{end+1} = '>=';
F.List{end+1} = Y;
Expand All @@ -14,7 +19,12 @@
F.strict(end+1) = 0;
else
% z > (w > y)
Z = X - Y.List{1};
try
Z = X - Y.List{1};
catch
X = reshape(X,[],1);
Z = X - Y.List{1};
end
F = Y;
F.List = {X,'>=',F.List{:}};
F.Evaluated = {Z,F.Evaluated{:}};
Expand Down
14 changes: 12 additions & 2 deletions extras/@constraint/le.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
try
if isa(X,'constraint')
% (z > w) < y
Z = Y - X.List{end};
try
Z = Y - X.List{end};
catch
Y = reshape(Y,[],1);
Z = Y - X.List{end};
end
F = X;
F.List{end+1} = '<=';
F.List{end+1} = Y;
Expand All @@ -14,7 +19,12 @@
F.strict(end+1) = 0;
else
% x < (w > y)
Z = Y.List{1} - X;
try
Z = Y.List{1} - X;
catch
X = reshape(X,[],1);
Z = Y.List{1} - X;
end
F = Y;
F.List = {X,'<=',F.List{:}};
F.Evaluated = {Z,F.Evaluated{:}};
Expand Down

0 comments on commit c39a51b

Please sign in to comment.