function [sol,m,Q,residuals,everything] = solvesos(F,obj,options,params,candidateMonomials)
%SOLVESOS Sum of squares decomposition
%
% [sol,m,B,residual] = solvesos(F,h,options,params,monomials) is used
% for finding SOS decompositions of polynomials.
%
% The coefficients of the polynomials are assumed linear w.r.t a set of
% decision variables params and polynomial with respect to a variable x.
%
% An extension with a nonlinear parameterization in params is possible.
% Note though that this gives BMIs or PMIs, solvable (locally) only if
% PENBMI is installed, or by specifying 'moment' as solver to try to
% solve the nonconvex semidefinite programming problem using a
% semidefinite relaxation based on moments.
%
% The SOS problem can be formulated as
%
% min h(params)
%
% subject to F(i) >(=) 0 or F(i) is SOS w.r.t x
%
% INPUT
% F : SET object with SOS constrained polynomials and constraints on variables params
% h : scalar SDPVAR object (can be [])
% options : options structure obtained from SDPSETTINGS (can be [])
% params : SDPVAR object defining parametric variables (can be [])
% monomials : SDPVAR object with user-specified monomials for decomposition (can be [])
%
% OUTPUT
% sol : Solution diagnostic from SDP problem
% v : Cell with monomials used in decompositions
% Q : Cell with Gram matrices, p = v{i}'*Q{i}*v{i}, where p is the ith SOS polynomial in your model.
% residuals : Mismatch between p and decompositions. Same values (modulo numerical issue) as checkset(find(is(F,'sos')))
% Warning, these residuals are not computed on matrix sos-of-squares
%
% EXAMPLE
% x = sdpvar(1);solvesos(set(sos(x^4+x^3+1))); % Simple decompositions
% x = sdpvar(1);t = sdpvar(1);solvesos(set(sos(x^4+x^3+1-t)),-t); % Lower bound by maximizing t
%
% NOTES
%
% Variables not part of params, but part of non-SOS constraints in F
% or objective h will automatically be appended to the params list.
%
% To extract SOS decomposition, use the command SOSD (or compute from use v and Q)
%
% If the 5th input argument is used, no additional monomial reduction is
% performed (Newton, inconstency, congruence). It is thus assumed that
% the supplied candidate monomials constitute a sufficient basis.
%
% The field options.sos can be used to tune the SOS-calculations. See HTML help for details
%
% sos.model - Kernel or image representation of SOS problem [0|1|2 (0)]
% sos.newton - Use Newton polytope to reduce size [0|1 (1)]
% sos.congruence - Block-diagonalize using congruence classes [0|1|2 (2)]
% sos.scale - Scale polynomial [0|1 (1)]
% sos.numblkdg - Try to perform a-posteriori block-diagonalization [real (0)]
% sos.inconsistent - Remove diagonal-inconsistent monomials [0|1|2 (0)]
% sos.clean - Remove monomials with coefficients < clean [real > 0 (1e-4)]
% sos.traceobj - Minimize trace of Gram matrix in problems without objective function [0|1 (0)]
% sos.extlp - Extract simple translated LP cones when performing dualization [0|1 (1)]
%
% See also SOS, SOSD, SDPSETTINGS, SOLVEMOMENT, SDPVAR, SDISPLAY
%% Time YALMIP
yalmip_time = clock;
% ************************************************
%% Check #inputs
% ************************************************
if nargin<5
candidateMonomials = [];
if nargin<4
params = [];
if nargin<3
options = sdpsettings;
if nargin<2
obj = [];
if nargin<1
help solvesos
return
end
end
end
end
end
if isequal(obj,0)
obj = [];
end
if isempty(options)
options = sdpsettings;
end
% Lazy syntax (not official...)
if nargin==1 & isa(F,'sdpvar')
F = set(sos(F));
end
if ~isempty(options)
if options.sos.numblkdg
[sol,m,Q,residuals,everything] = solvesos_find_blocks(F,obj,options,params,candidateMonomials);
return
end
end
% *************************************************************************
%% Extract all SOS constraints and candidate monomials
% *************************************************************************
if ~any(is(F,'sos'))
error('At-least one constraint should be an SOS constraints!');
end
p = [];
ranks = [];
for i = 1:length(F)
if is(F(i),'sos')
pi = sdpvar(F(i));
p{end+1} = pi;
ranks(end+1) = getsosrank(pi); % Desired rank : Experimental code
end
end
if isempty(candidateMonomials)
for i = 1:length(F)
candidateMonomials{i}=[];
end
elseif isa(candidateMonomials,'sdpvar')
cM=candidateMonomials;
candidateMonomials={};
for i = 1:length(p)
candidateMonomials{i}=cM;
end
elseif isa(candidateMonomials,'cell')
if length(p)~=length(candidateMonomials)
error('Dimension mismatch between the candidate monomials and the number of SOS constraints');
end
end
% *************************************************************************
%% Get the parametric constraints
% *************************************************************************
F_original = F;
F_parametric = F(find(~is(F,'sos')));
if isempty(F_parametric)
F_parametric = set([]);
end
% *************************************************************************
%% Expand the parametric constraints
% *************************************************************************
if ~isempty(yalmip('extvariables'))
[F_parametric,failure] = expandmodel(F_parametric,obj,options);
F_parametric = expanded(F_parametric,1);
obj = expanded(obj,1);
if failure
Q{1} = [];m{1} = [];residuals = [];everything = [];
sol.yalmiptime = etime(clock,yalmip_time);
sol.solvertime = 0;
sol.info = yalmiperror(14,'YALMIP');
sol.problem = 14;
end
end
if ~isempty(params)
if ~isa(params,'sdpvar')
error('Fourth argment should be a SDPVAR variable or empty')
end
end
% *************************************************************************
% Collect all possible parametric variables
% *************************************************************************
ParametricVariables = uniquestripped([depends(obj) depends(F_parametric) depends(params)]);
if options.verbose>0;
disp('-------------------------------------------------------------------------');
disp('YALMIP SOS module started...');
disp('-------------------------------------------------------------------------');
end
% *************************************************************************
%% INITIALIZE SOS-DECOMPOSITIONS SDP CONSTRAINTS
% *************************************************************************
F_sos = set([]);
% *************************************************************************
%% FIGURE OUT ALL USED PARAMETRIC VARIABLES
% *************************************************************************
AllVariables = uniquestripped([depends(obj) depends(F_original) depends(F_parametric)]);
ParametricVariables = intersect(ParametricVariables,AllVariables);
MonomVariables = setdiff(AllVariables,ParametricVariables);
params = recover(ParametricVariables);
if isempty(MonomVariables)
error('No independent variables? Perhaps you added a constraint set(p(x)) when you meant set(sos(p(x)))');
end
if options.verbose>0;disp(['Detected ' num2str(length(ParametricVariables)) ' parametric variables and ' num2str(length(MonomVariables)) ' independent variables.']);end
% ************************************************
%% ANY BMI STUFF
% ************************************************
NonLinearPara
没有合适的资源?快使用搜索试试~ 我知道了~
yalmip.rar_LMI matlab_LMI with Yalmip_Yalmip l_yalmip lmi_yalmip
共903个文件
m:837个
htm:42个
gif:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 100 浏览量
2022-09-14
15:12:36
上传
评论 2
收藏 904KB RAR 举报
温馨提示
求解线性矩阵不等式简单方便--与LMI工具箱相比
资源详情
资源评论
资源推荐
收起资源包目录
yalmip.rar_LMI matlab_LMI with Yalmip_Yalmip l_yalmip lmi_yalmip (903个子文件)
ncvar.asv 22KB
mtimes.asv 5KB
findhash.c 1KB
yalmip.css 4KB
dualform.gif 5KB
gemoetric.gif 4KB
primalform.gif 4KB
ellips5.gif 2KB
dual.h1.gif 2KB
gevp.h4.gif 1KB
dual.h2.gif 1KB
iimg_1.gif 922B
iimg_8.gif 911B
icon_del.GIF 903B
warning.gif 903B
lyapun6.gif 817B
icon_fix.gif 348B
icon_ifix.gif 340B
icon_add.gif 240B
demoicon.gif 214B
reference.htm 232KB
oldnews.htm 75KB
solvers.htm 68KB
faq.htm 60KB
extoperators.htm 34KB
mp.htm 30KB
sos.htm 26KB
globalbmi.htm 23KB
logic.htm 20KB
dual.htm 20KB
news.htm 16KB
moment.htm 14KB
geometric.htm 10KB
mnl_cnt_reference.htm 10KB
readmore.htm 8KB
ranksdp.htm 8KB
integer.htm 7KB
impexp.htm 6KB
linearregression.htm 6KB
basics.htm 6KB
advanced.htm 6KB
bmi.htm 6KB
form.htm 6KB
ellipsoidal.htm 5KB
mnl_cnt_solvers.htm 5KB
lyapunov.htm 5KB
mnl_cnt_examples.htm 4KB
complex.htm 4KB
gevp.htm 4KB
polynomials.htm 4KB
backwards.htm 3KB
kyp.htm 3KB
licens.htm 3KB
installation.htm 2KB
mnl_cnt.htm 2KB
acknow.htm 2KB
top_frm.htm 2KB
mnl_cnt_clear.htm 2KB
intro.htm 1KB
yalmip.htm 1013B
tochead.htm 712B
btm_frm.htm 667B
polytopes.jpg 45KB
exclamationmark.jpg 766B
solvesos.m 54KB
compilesos.m 40KB
callmpcvx.m 40KB
compileinterfacedata.m 40KB
yalmip.m 33KB
bnb.m 33KB
branch_and_bound.m 33KB
sdpsettings.m 31KB
definesolvers.m 28KB
globalex.m 26KB
sdpvar.m 22KB
ncvar.m 22KB
dualize.m 21KB
mtimes.m 19KB
yalmiptest.m 17KB
selectsolver.m 16KB
cutsdp.m 15KB
categorizeproblem.m 14KB
lmi2sedumistruct.m 14KB
findapplicablesolvers.m 13KB
solvesdp.m 13KB
mpcvx.m 12KB
norm.m 12KB
bmibnb.m 12KB
norm.m 12KB
double.m 12KB
pwa_yalmip.m 11KB
expandmodel.m 11KB
sdisplay.m 11KB
mpt_appendmodel.m 10KB
sosex.m 10KB
export.m 9KB
double.m 9KB
expandrecursive.m 9KB
bilinearize.m 9KB
callpenbmim.m 9KB
共 903 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
JaniceLu
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- python 数据分析示例
- tensorflow-gpu-2.5.3-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-gpu-2.2.1-cp35-cp35m-win-amd64.whl
- tensorflow-gpu-2.5.3-cp38-cp38-manylinux2010-x86-64.whl
- 2023-04-06-项目笔记 - 第一百三十五阶段 - 4.4.2.133全局变量的作用域-133 -2024.05.16
- Screenshot_20240516_224007.jpg
- IEEE802.3dj-800G DR4 & 1.6T DR8-welch-3dj-01a-230206 .pdf
- Matlab三维图绘制基础了解
- IEEE802.3dj-800GBASE FR4-welch-3dj-01a-2401 .pdf
- 实验3-拆弹专家-3023244203-刘宇翔
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0