?? mset.m
字號(hào):
function mset(varargin)
% MSET - GloptiPoly parameters settings
%
% MSET = displays parameters
% MSET CLEAR = delete all existing variables and set default parameters
% MSET CLEARMEAS = delete all existing measures
% MSET DEFAULT = set default parameters
% MSET(PARAMETER,VALUE) = set a given parameter
%% If PARAMETER is a character string, it can take the following values:
%
% - 'VERBOSE': VALUE = FALSE for no screen output (default TRUE)
% - 'YALMIP': VALUE = TRUE for using YALMIP as an interface (default FALSE).% The SDP solver is then the one configured under YALMIP with the% parameter structure PARS, see below. If VALUE = 0 the SDP solver% SeDuMi is used directly without calling YALMIP.% - 'RANKTOL': VALUE = relative gap between singular values for% evaluating ranks of moment matrices when detecting global optimality% and extracting solutions (default 1e-3)
% - 'PIVOTOL': VALUE = relative accuracy for basis computation by Gaussian
% elimination with pivoting when extracting solutions (default 1e-6)
% - 'TESTOL': VALUE = absolute accuracy for checking objective function
% and feasibility of constraints in SDP problem (default 1e-3)% - 'MAXNORM': VALUE = maximum allowed norm of the vector of moments.% Useful to detect unbounded or ill-scaled problems (default 1e6)%% IF PARAMETER is a structure, it is forwarded to SeDuMi or YALMIP.
% D. Henrion, 11 April 2004
% Last modified on 19 December 2006
global MMM
kmax = length(varargin); k = 1;
if isempty(MMM)
MMM.var = {};
MMM.indmeas = [];
MMM.meas = 1;
end
if kmax == 0
if isfield(MMM,'verbose')
disp(['VERBOSE = ' int2str(MMM.verbose)]);
end
if isfield(MMM,'yalmip')
disp(['YALMIP = ' num2str(MMM.yalmip)]);
end if isfield(MMM,'ranktol')
disp(['RANKTOL = ' num2str(MMM.ranktol)]);
end
if isfield(MMM,'pivotol')
disp(['PIVOTOL = ' num2str(MMM.pivotol)]);
end
if isfield(MMM,'testol')
disp(['TESTOL = ' num2str(MMM.testol)]);
end
if isfield(MMM,'maxnorm')
disp(['MAXNORM = ' num2str(MMM.maxnorm)]);
end
end
while k <= kmax
par = varargin{k}; if isstruct(par) % Parameter structure to forward to SeDuMi or YALMIP MMM.pars = par; k = k+1; else % Other parameter par = lower(par);
switch par
case {'reset','clear'}
% Delete all the existing variables and measures
for i = 1:length(MMM.var)
i1 = strfind(MMM.var{i},'(');
if isempty(i1)
i1 = length(MMM.var{i})+1;
end
evalin('caller',['clear ' MMM.var{i}(1:i1-1)]);
end
MMM.var = {};
MMM.indmeas = [];
MMM.meas = 1;
MMM.M = {};
MMM.T = [];
mset default
k = k+1;
case {'clearmeas','resetmeas'}
% Delete all the existing measures
MMM.indmeas = ones(1,length(MMM.var));
MMM.meas = 1;
MMM.M = {};
MMM.T = [];
k = k+1;
case 'default'
% Default parameters
MMM.verbose = true; % display information
MMM.yalmip = false; % do not use YALMIP MMM.ranktol = 1e-3; % rel acc for evaluating ranks of moment matrices
MMM.pivotol = 1e-6; % rel acc for basis computation via Gaussian elim
MMM.testol = 1e-3; % abs acc for testing feas of poly ineq
MMM.maxnorm = 1e6; % maximum norm to detect unbounded problems
k = k+1;
case {'verbose','ranktol','pivotol',...
'testol','maxnorm','yalmip'}
% Set a parameter
if length(varargin) <= k
error('Invalid syntax')
end
par2 = varargin{k+1}; if isa(par2,'char')
par2 = str2num(lower(par2)); elseif ~isa(par2,'double') & ~isa(par2, 'logical') error('Invalid parameter value') end
MMM = setfield(MMM,par,par2); k = k+2;
otherwise
error('Invalid argument')
end
endend
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -