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 (1) or image (2) representation of SOS problem [0|1|2 (0, YALMIP decides)]
% 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 isa(obj,'double')
obj = [];
end
if isa(F,'constraint')
F = set(F);
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 removes so called marker variables generated in ismember
ParametricBefore = getvariables(F_parametric);
% *************************************************************************
%% 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) ParametricBefore]);
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(Pa
没有合适的资源?快使用搜索试试~ 我知道了~
yalmipR20120309.zip_MATLAB/yalmip_yalmip
共1096个文件
m:1091个
asv:2个
c:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 148 浏览量
2022-07-14
02:39:44
上传
评论
收藏 1.02MB ZIP 举报
温馨提示
yalmip的toolbox,用于求解优化问题,需要的下
资源推荐
资源详情
资源评论
收起资源包目录
yalmipR20120309.zip_MATLAB/yalmip_yalmip (1096个子文件)
ncvar.asv 22KB
mtimes.asv 5KB
findhashsorted.c 2KB
findhash.c 1KB
solvesos.m 54KB
compileinterfacedata.m 50KB
bnb.m 46KB
yalmip.m 43KB
compilesos.m 40KB
callmpcvx.m 40KB
sdpsettings.m 40KB
definesolvers.m 36KB
robustify_backup.m 33KB
solvebilevel.m 28KB
mtimes.m 27KB
globalex.m 26KB
sdpvar.m 26KB
branch_and_bound.m 25KB
decomposeUncertain.m 24KB
ncvar.m 22KB
dualize.m 22KB
lmi2sedumistruct.m 20KB
selectsolver.m 19KB
bmibnb.m 18KB
categorizeproblem.m 17KB
yalmiptest.m 17KB
cutsdp.m 16KB
solvesdp.m 15KB
norm.m 14KB
gams2yalmip.m 14KB
robustify.m 14KB
expandmodel.m 13KB
findapplicablesolvers.m 13KB
pwa_yalmip.m 12KB
mpcvx.m 12KB
expandrecursive.m 12KB
norm.m 12KB
export.m 12KB
sdisplay.m 11KB
subsasgn.m 11KB
plot.m 11KB
double.m 10KB
mpt_appendmodel.m 10KB
coefficients.m 10KB
sosex.m 10KB
convert_sigmonial_to_sdpfun.m 9KB
callsdpt34.m 9KB
apply_recursive_differentiation.m 9KB
setup_fmincon_params.m 9KB
solvemoment.m 9KB
callmosek.m 9KB
callpenbmim.m 9KB
solvelower.m 9KB
pwq_yalmip.m 8KB
filter_duality.m 8KB
call_cplexibm_miqp.m 8KB
presolve_bounds_from_equalities.m 8KB
minus.m 8KB
calllindo_nlp.m 8KB
plus.m 8KB
subsref.m 8KB
lmi.m 8KB
call_cplexibm_milp.m 8KB
derivedualBounds.m 8KB
calllindo_geo.m 8KB
yalmip2geometric.m 8KB
callmpt.m 8KB
sdisplay2.m 8KB
subsasgn.m 7KB
matrixcoefficients.m 7KB
pwf.m 7KB
saveampl.m 7KB
call_cplexibm_qcmiqp.m 7KB
filter_enumeration.m 7KB
times.m 7KB
callmaxdet.m 7KB
yalmip2nonlinearsolver.m 7KB
calllindo.m 7KB
monolist.m 7KB
callfminsearch.m 7KB
momentex.m 7KB
checkset.m 7KB
display.m 7KB
minus.m 7KB
Contents.m 7KB
Contents.m 7KB
bnb_solvelower.m 6KB
callpenbmi.m 6KB
binmodel.m 6KB
times.m 6KB
double.m 6KB
display.m 6KB
convert_polynomial_to_quadratic.m 6KB
convert_perspective_log.m 6KB
callsnoptgp.m 6KB
callfmincongp.m 6KB
callsqplab.m 6KB
callgurobimex.m 6KB
solvemp.m 6KB
callipoptgp.m 6KB
共 1096 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
APei
- 粉丝: 63
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 论文(最终)_20240430235101.pdf
- 基于python编写的Keras深度学习框架开发,利用卷积神经网络CNN,快速识别图片并进行分类
- 最全空间计量实证方法(空间杜宾模型和检验以及结果解释文档).txt
- 5uonly.apk
- 蓝桥杯Python组的历年真题
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 2023-04-06-项目笔记 - 第一百十九阶段 - 4.4.2.117全局变量的作用域-117 -2024.04.30
- 前端开发技术实验报告:内含4四实验&实验报告
- Highlight Plus v20.0.1
- 林周瑜-论文.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功