-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/yalmip/YALMIP into develop
- Loading branch information
Showing
17 changed files
with
251 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
function varargout=std(varargin) | ||
%STD (overloaded) | ||
% | ||
% V = std(x) | ||
|
||
switch class(varargin{1}) | ||
|
||
case 'sdpvar' % Overloaded operator for SDPVAR objects. Pass on args and save them. | ||
X = varargin{1}; | ||
if nargin > 1 || min(size(X))>1 | ||
error('SDPVAR/STD only supports simple 1-D variance'), | ||
end | ||
varargout{1} = yalmip('define',mfilename,varargin{1}); | ||
case 'char' | ||
switch varargin{1} | ||
case 'graph' | ||
t = varargin{2}; | ||
X = varargin{3}; | ||
F = cone([t;X]) | ||
varargout{1} = F; | ||
varargout{2} = struct('convexity','convex','monotonicity','none','definiteness','positive','model','graph'); | ||
varargout{3} = X; | ||
|
||
case 'exact' | ||
t = varargin{2}; | ||
X = varargin{3}; | ||
e = sdpvar(length(X),1); | ||
F = [e'*e == t^2, e == X, t>=0]; | ||
varargout{1} = F; | ||
varargout{2} = struct('convexity','convex','definiteness','positive','model','exact'); | ||
varargout{3} = X; | ||
otherwise | ||
error('SDPVAR/NORM called with weird argument?'); | ||
end | ||
otherwise | ||
error('Weird first argument in SDPVAR/STD') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
function model = presolve_boundargument_periodic(model) | ||
|
||
if ~isempty(model.evalMap) | ||
% Find arguments only used in periodic functions, and find largest | ||
% period | ||
Q = -inf(1,length(model.c)); | ||
for i = 1:length(model.evalMap) | ||
if ~isempty(model.evalMap{i}.properties.periodic) | ||
k = model.evalMap{i}.variableIndex; | ||
Q(k) = max(Q(k), model.evalMap{i}.properties.periodic); | ||
else | ||
k = model.evalMap{i}.variableIndex; | ||
Q(k) = inf; | ||
end | ||
end | ||
for i = 1:length(model.evalMap) | ||
if ~isempty(model.evalMap{i}.properties.periodic) | ||
k = model.evalMap{i}.variableIndex; | ||
P = Q(k); | ||
if ~isinf(Q(k)) | ||
if nnz(model.monomtable(:,k)) == 1 | ||
% It is ot used in any monomial | ||
if isempty(model.F_struc) || nnz(model.F_struc(:,k+1))==0 | ||
% and not used in any constraint | ||
% Hence, since variable is used nowhere except as | ||
% argument in this periodic function, we can bound | ||
if isinf(model.lb(k)) && isinf(model.ub(k)) | ||
model.lb(k) = 0; | ||
model.ub(k) = P; | ||
elseif ~isinf(model.lb(k)) | ||
model.ub(k) = min(model.ub(k),model.lb(k)+P); | ||
elseif ~isinf(model.ub(k)) | ||
model.lb(k) = max(model.lb(k),model.ub(k)-P); | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.