yalmipmatlab非线性约束优化条件怎么写

This article was downloaded by: [Tianjin University]
On: 13 April 2013, At: 20:03
Publisher: Taylor & Francis
Informa Ltd Registered in England and Wales Registered Number: 1072954 Registered
office: Mortimer House, 37-41 Mortimer Street, London W1T 3JH, UK
Optimization Methods and Software
Publication details, including instructions for authors and
subscription information:Automatic robust convex programming
Johan L?fberg
aa Division of Automatic Control, Department of Electrical
Engineering, Link?ping University, SE-581 83, Link?ping, Sweden
Version of record first published: 15 Sep 2010.
PLEASE SCROLL DOWN FOR ARTICLE
OptimizationMethods&Software
Vol.27,No.1,February2012,
Automaticrobustconvexprogramming
JohanL?fberg*
DivisionofAutomaticControl,DepartmentofElectricalEngineering,Link?pingUniversity,
SE-58183Link?ping,Sweden
Downloaded by [Tianjin University] at 20:03 13 April 2013 (Received23February2010;finalversionreceived18August2010)ThispaperpresentstherobustoptimizationframeworkinthemodellinglanguageYALMIP,whichcarriesoutrobustmodellinganduncertaintyeliminationautomaticallyandallowstheusertoconcentrateonthehigh-levelmodel.Whileintroducingthesoftwarepackage,abriefsummaryofrobustoptimizationisgiven,aswellassomecommentsonmodellingandtractabilityofcomplexconvexuncertainoptimizationproblems.Keywords:modellingsoftware1.IntroductionAlmostalloptimizationmodelsarewrong,andweknowit.Inmostcases,theperformancedegradationduetomodellingerrorsistoosmalltobeofpracticalinterest,ortheapplicationmightbeinherentlyrobustagainstsmallerrors(e.g.controlsystemswherethewholeideaistoreducetheimpactofuncertaintyviafeedback).Ontheotherhand,therearecaseswheresmallmodelerrorscanhavedisastrouseffectsoratleastleadtounnecessarilypoorperformancecomparedwithwhatcouldhavebeenobtainedifuncertaintyexplicitlyhadbeentakenintoaccount.
Acommonreasonforpractitionerstoavoiduncertaintyistheaddedcomplexityofbuildingtherobustoptimizationmodel,andthelackofknowledgeofhowandwhenthiscanbedoneefficiently.Thepurposeofthispaperisthereforetwo-fold.Tobeginwith,wecollectsomeofthemostcommonapproachestostructuredrobustoptimizationandtrytopin-pointtypicalclassesofproblemsthatcanbehandledefficiently.However,itisourbeliefthatknowinghowtodevelopandmanipulateuncertainmodelsdoesnotnecessarilyleadtoactualimplementationsofrobustoptimizationmodels,strongsoftwaresupportisrequiredifwewantrobustoptimizationtobecomecommoninpractice.Thus,weintroduceanddiscussthesoftwaresupportthatisavailableinmodellinglanguageYALMIPtoimplementtheseuncertainscenarios.Additionally,wediscusstheeasilyoverseenfactthatmodels,wherethenominalhigh-levelproblemcanbereformulatedtoalinearprograminpolynomialtimeandwehavemethodstoderiverobustcounterpartsof*Email:johanl@isy.liu.se
ISSNprint/ISSNonline(C)2012Taylor&Francishttp://dx.doi.org/10.8.
116J.L?fberg
uncertainlinearprogramsinpolynomialtime,donotnecessarilyhaverobustcounterpartsthatcanbesolvedinpolynomialtime.Inotherwords,thecombinationofthetworeformulationsisnottrivial.
2.Robustoptimization
Thebasicproblemaddressedinthispaperistheuncertainoptimizationproblem
minmaxf(x,w)xw
s.tg(x,w)?0?w∈W.
Tokeepnotationataminimum,wewriteg(x,w)?0here,butkeepinmindthattheseconstraintsmayincludeelement-wiseinequalities,equality,second-orderandsemidefiniteconeconstraints.Infact,aswewillseelater,itcanalsoincludemoreadvancedconstraints,suchassum-of-squaresconstraints.Sincetheobjectivecanbemovedtotheconstraintsbyanepigraphreformulation,wecanw.l.o.g.assumecertainobjectivefunctionsandthusconcentrateonuncertainconstraints.Inshort,therearetwowaystoaddressthisclassofproblems.Historically,probabilisticapproacheswithchanceconstraints,riskmeasuresandexpectedoutcomeshavebeencommon,beingthefoundationforthewholestochasticprogrammingfield[19].Thesolutionmethodsare,duetotheintractabilityofmostproblems,typicallybasedonsometypeofsamplingfromanuncertaintyset.Thedisadvantagewiththisapproachisofcoursethatitonlygivesan(optimistic)approximation,andthusnoguaranteedsolutions.Itis,however,possibletoobtainstatisticalconfidenceresultsonthesolution,inparticularintheconvexcase[6].
Recently,amorestrictapproachhasbecomepopular.Theparadigmhereistoexactlyorconservativelyconverttheproblemtoacertainproblem(aso-calledrobustcounterpart),byinsomewayremovingtheuncertainty,usingmethodssuchasexplicitmaximization,dualitypropertiesorrelaxationmethods.Theseapproacheshavetoalargeextentgainedpopularityduetodevelopmentsinthefieldofconvexandconicoptimization[1–3,7]withsignificantimpetusfromtherobustcontrolfield[5,25].Itshould,however,bemadeclearthatthisapproachinexactapproachestouncertainlinearprogrammingcanbefoundalreadyin
[8,23,24].Thisparadigm,commonlyreferredtoasaworst-caseapproach,iswhatweconcentrateoninthispaper(sometimesalsoreferredtoasunknown-but-boundedorminimax).
Manyrobustoptimizationproblemsfallintostandardcases,whichcanbeconvertedtocertaincounterpartsbystandardbuterror-proneandcumbersomereformulations.OurgoalistodescribeanextensiontothemodellinglanguageYALMIP[14]formodellingrobustoptimizationproblemsinanintuitiveformatandletthesoftwarepackagetakecareofthereformulations.Inotherwords,itistherobustoptimizationcorrespondenceoftheconvexprogrammingreformulationsinthe‘nonlinearoperator’frameworkinYALMIPandthesimilar‘disciplinedconvexprogramming’frameworkinCVX[10].Theoutcomeofthefeaturespresentedinthispaperisanewoptimizationproblemwhichsolvestheworst-casescenario.
minf^(x,y)x,yDownloaded by [Tianjin University] at 20:03 13 April 2013
s.t.g(x,^y)≤0.
Typically,theproblemischangedconsiderablyfromtheoriginalproblem,indicatedbythenewobjectivef^,constraintsg^andadditionalvariablesy,introducedinordertoeliminatetheuncertainty.Whiletheoriginaluncertainproblem,forinstance,isalinearprogram,therobustcounterpartcanbecomeasemidefiniteprogram.Evenworse,therobustcounterpartmaynoteven
看过本文章的还看过。。。
用yalmip求解鲁棒凸规划_数学_自然科学_专业资料 暂无评价|0人阅读|0次下载|举报文档用yalmip求解鲁棒凸规划_数学_自然科学_专业资料。this article was downloaded .........
excel 规划求解功能操作说明以 microsoft excel2003 为例,说明使用 excel 的求解线性规划问题功能的使 用方法。 一、加载规划求解功能 点击【工具】按钮,在下拉.........
5、 设置变量: 单击“规划求解窗口”中“可变单元格”文本框,然后在 excel......
excel规划求解使用说明_初三英语_英语_初中教育_教育专区。excel帮你轻松搞定规划...问题:约束条件很多怎么办?可以利用 excel 的自动填充功能完成. 可惜,直接对 c........
怎样 安排两种产品的生产量,所获 得的利润最大?规划求解的第二步也是将数学...第二节 线性规划求解方法 ? 线性规划是在一定的限制条件下,利用数学方法进行.........
四、用规划求解加载宏求解数学规划举例下 面我们通过一个例子来解释怎样用 “规划求......
“规划求解”各参数设置 规划求解” 规划求解
“规划求解”步骤 规划求解” 规划求解
利用“规划求解”解线性规划问题 利用“规划求解”
关于“规划.........
利用excel进行规划求解_数学_自然科学_专业资料。利用 excel 进行规划求解 excel 具有规划求解的基本功能,包括线性规划和非线性规划。对于常规的线性规划问 题,excel .........
利用“规划求解”解其他运筹学问题 1、 关于“规划求解” “规划求解”是 excel 中的一个加载宏,借助“规划求解” ,可求 得工作表上某个单元格(被称为目标.........
利用excel进行规划求解_专业资料。关于办公软件的运用利用excel 进行规划求解 excel 具有规划求解的基本功能,包括线性规划和非线性规划。对于常规的线性规划问 题,excel.........
可以在屏幕上观看到这一过程, excel 很快就会告知已经找到了一个解,如图所示的“规划求解结果”对话框。 此时,有如下选择: ●用规划求解值替换原始可变量单元格.........
2 利用 excel对模型求解对线性规划的运输模型求解 , 常用表上作业法 : ......
其实是对应线性规划问题中约束条件的左端项 (在 excel 中用单元格表示) 。(7)单击希望在引用单元格和约束条件(约束条件: “规划求解”中设置的 限制条件。 可以.........
2、目标的数学描述 这类问题有一个共同点,即需要解决: 3、应用excel的规划 如何合理利用各种存在约束的资源,而获得 求解工具对问题求解 最佳的经济效益,也就是.........
怎么利用excel求解线性规划_调查报告_表格模板_实用文档。怎么利用excel求解线性规划的详细步骤 利用线性回归方法求解生产计划方法一: 1、建立数学模型: ?设变量:.........
应用excel规划求解实例_商业计划_计划解决方案_实用文档。应用excel工具对实际...以前用 office 不怎么用 excel,以为 excel 对我 们来说没有什么用,直到今天.........
用excel软件 求解优化问题 ? microsoft excel软件是当今十分流行的功能 强大操作方便的软件。在microsoft excel软 件中,具有规划求解功能。如图1,在工具 菜单下,一般.........
用excel软件求解规划的方法_经济学_高等教育_教育专区。用excel软件求解规划的方法 用excel软件 excel软件 求解优化问题 microsoft excel软件是当今十分流行的功能 .........
excel规划求解工具在多目标规划中的应用_电力水利_工程科技_专业资料。规划......
加载规划求解规划求解加载宏是一个 excel 加载项 (加载项:为 micros......
excel 用规划求解来算多元方程解
12:56:46 事......
■ 热门推荐查看: 678|回复: 0|关注: 0
求问:yalmip求非线性优化约束的对偶变量
<h1 style="color:# 麦片财富积分
新手, 积分 5, 距离下一级还需 45 积分
优化问题如下:
Gneed=[3;3;3;3];
B=sdpvar(13,1);
f=[0 0 0 0 0 0 5 0 0 0 0 0 0]*B;
F=[B(7)-B(8)-B(9)-B(12)-B(13)-Gneed(1)==0];
F=F+[B(8)-B(10)-Gneed(2)==0];
F=F+[B(9)-B(11)-Gneed(3)==0];
F=F+[B(10)+B(11)-Gneed(4)==0];
F=F+[20.25*B(5)^2-20.25*B(2)^2-B(8)^2==0];
F=F+[20.25*B(6)^2-20.25*B(3)^2-B(9)^2==0];
F=F+[9*B(2)^2-9*B(4)^2-B(10)^2==0];
F=F+[9*B(3)^2-9*B(4)^2-B(11)^2==0];
F=F+[0.5*B(8)*B(5)-0.5*B(8)*B(1)-B(12)==0];
F=F+[0.5*B(9)*B(6)-0.5*B(9)*B(1)-B(13)==0];
F=F+[1&=B(1)&=1];
F=F+[0.8&=B(2)&=1.2];
F=F+[0.8&=B(3)&=1.2];
F=F+[0.8&=B(4)&=1.2];
F=F+[1.2&=B(5)&=1.8];
F=F+[1.2&=B(6)&=1.8];
sol=optimize(F,f);
optf=value(f);
Gprice=zeros(4,1);
Gprice(1)= dual(F(1));
Gprice(2)= dual(F(2));
Gprice(3)= dual(F(3));
Gprice(4)= dual(F(4));
求得的对偶变量为空,问题在哪里?新手求高手指点!
站长推荐 /2
利用MATLAB进行传感器数据分析
MATLAB中文论坛是全球最大的 MATLAB & Simulink 中文社区。用户免费注册会员后,即可下载代码,讨论问题,请教资深用户及结识书籍作者。立即注册加入我们吧!
MATLAB官方社交平台
MATLAB中文论坛微社区查看: 3953|回复: 1|关注: 0
yalmip非线性约束条件怎么写
<h1 style="color:# 麦片财富积分
新手, 积分 7, 距离下一级还需 43 积分
我需要求解一个全局最优化问题,为了方便,一直用matlab调用lingo求解,感觉lingo求解的有问题,故想寻找matlab可以求解MINLP的工具箱,搜索了一番,网上提到bnb20工具箱和yalmip工具箱,发现bnb20工具箱很老,说yalmip可以求解混合整形规划,故想使用这个工具箱试试,但是问题是,我的约束条件不是简单的求和等计算,涉及到比较复杂的判断和计算,也就是需要包含一个自定义函数,比如应该是confun(x)&=0;里面需要对x进行判断和处理,但是x=sdpvar(m,n)不是普通矩阵,总提示错误,比如: if(x(k) == 0)
& & & & & & & & z(k) = 0;
& & & & & & & &
& & & & end复制代码提示x(k)==0是约束条件,不能转换为逻辑值。
我想知道,这种情况怎么办?怎么在约束条件中使用复杂的函数?如果yalmip做不了,有没有其他的工具箱或办法?
<h1 style="color:# 麦片财富积分
在matlab平台上编写函数,用经典优化算法求解应该比较准确,毕竟matlab比较稳定
站长推荐 /2
利用MATLAB进行传感器数据分析
MATLAB中文论坛是全球最大的 MATLAB & Simulink 中文社区。用户免费注册会员后,即可下载代码,讨论问题,请教资深用户及结识书籍作者。立即注册加入我们吧!
MATLAB官方社交平台
MATLAB中文论坛微社区YALMIP学习总结4
and Convex Hull
在建模中,经常要用到big-M和small-m来表示一个充分大和充分小的数,但是如果按类似10^6,10^(-6)等方式来取容易导致两个问题:(i)求解
器容易产生numerical issues(numerical challenge,numerical
difficulty);(ii)在MIP问题中relaxation后的可行域比真的可行域大很多,
也即relaxation很弱,从而会导致excessive
branching,计算时间也会增加。有了YALMIP的帮助,我们从如下两个步骤上改善这一点:
(1)根据所研究的问题和数据,选择合适的big-M和small-m
(2)对参与含big-M约束中的变量,要给出尽可能紧的界(很多时候不必要)
(2)利用hull()命令来生成原可行域的凸包
F = set(sum(d) == 1);
F = F + set(A1*x - b1 &= M1*d(1));
F = F + set(A2*x - b2 &= M2*d(2));
F = F + set(A3*x - b3 &= M3*d(3));
F = F + set(A4*x - b4 &= M4*d(4));
F = F + hull(set(A1*x & b1),set(A2*x
& b2),set(A3*x & b3),set(A4*x
22.画图(涉及多参数规划时需要安装MPT)
F = hull(set(A1*x & b1),set(A2*x &
b2),set(A3*x & b3),set(A4*x &
plot(polytope(A1,b1),polytope(A2,b2),polytope(A3,b3),polytope(A4,b4))
22.SDP with rank constraints
有时候在SDP问题中有rank()&=r或rank()=r等关于rank的约束,这通常是非凸的。但是external
slover LMIRank精于处理rank constraints。
要求两点:(i) 给定一个initial guess (可以通过用户猜想或用sdpsolve求解不带rank
constraints的问题得到)& (ii)要另外提供一个SDP
solver(如sedumi),因为LMIRank只处理rank
constraints约束带来的额外的问题,SDP的求解本身需要另外的求解器去做。
F = [F, [X eye(4);eye(4) Y] &=
0];&& % not needed, see
F = [F, rank([X eye(4);eye(4) Y]) &= 4+2];
solvesdp(F,[],sdpsettings('lmirank.solver','sedumi','sedumi.eps',0))
23.双层二次规划(两组变量x,z在内外两层问题中耦合在一起)&
详见YALMIP Wiki
(1)方法1:混合整数规划
&& ---对inner
problem,用KKT条件描述最优解条件组,其中必有lamda*constraint=0的complementary
constraint。对此,可以用0-1变量描 &
&& ---把这些条件放入outer
problem,就形成一个混合整数规划问题。
(2)方法2:带complementary constraints的非线性优化(需要安装bmibnb)
&& ---对inner
problem,用KKT条件描述最优解条件组,其中必有lamda*constraint=0的complementary
constraint。为了能使求解器bmibnb发
现complementary
constraint的结构,把“lamda*constraint=0”中constraint用辅助变量代替
&& ---把这些条件放入outer
problem,就形成一个普通的非线性优化问题(变量的bound要给清楚)
(3)方法3:多参数规划(需要安装MPT)
&& ---对inner
problem,把x看作参数,z看作变量,当作一个参数规划问题来解(solvemp)。这样会保存(x,z)之间的一一最优组合关系
&& ---前面结果代入outer
problem,直接优化(slovesdp)
参考文献:Practical Bilevel Optimization: algorithms and Applications by
J. F. Bard&
已投稿到:
以上网友发言只代表其个人观点,不代表新浪网的观点或立场。查看: 14510|回复: 24|关注: 0
yalmip工具箱及其教程。凸规划问题如何用yalmip工具箱优化?
<h1 style="color:# 麦片财富积分
新手, 积分 15, 距离下一级还需 35 积分
本帖最后由 yuyolanda 于
10:14 编辑
用fmincon函数求解的凸规划问题,如何转化为用yalmip工具箱优化?附件yalmip工具箱、yalmip教程、yalmip算例的程序与我的程序文件。我需要求解一个非线性规划问题,之前是用fmincon函数编程的,但画出来的图形有问题,是锯齿形的。
QQ图片13.jpg (20.88 KB, 下载次数: 10)
16:54 上传
实际上,第三个蓝点应该是在红色点的位置。不知道是不是算法的问题呢还是其他问题。因此,我想转化为用yalmip工具箱进行优化,应该怎么改编程序语句呢?谢谢!!!
fmincon的主程序语句为:
%目标函数为风险的
k=1.2:0.1:1.8;& && && &&&%收益的取值范围&&V型
u0=[0,0,0,0,0,0,1,-1,0,1,-1,0,1,-1,0]';& && && && &%有反馈的初值
aeq=[1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
& & 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0
& & 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0
& & 0 0 0 0 0 0&&0 1 0 0&&1 0 0 1 0
& & 0 0 0 0 0 0&&0 0 1 0&&0 1 0 0 1];
beq=[0;0;0;0;0];
for i=1:size(k,2);
& & d=k(i);
& & save kk 'd'
& & [u(i,:),fval(i,:),exit(i,:)]=fmincon('myfunv',u0,[],[],aeq,beq,[],[],'myconv');& & %V型
plot(fval/100,k,'r-');
目标函数myfunv.m 的语句为:
function y=myfunv(u)& &%目标函数为风险的
g=[1.162 1.246 1.228]';
Sigma=[0.7 0.0145
& & 0.4 0.0104
& & 0.4 0.0289];
G=[g(1) 0 0
& & 0 g(2) 0
& & 0 0 g(3)];
thita0=zeros(3,3);
Gamma0=zeros(3,3);
Sigma0=zeros(3,3);
x0=[1/3,1/3,1/3]';
thita1=[u(7) u(8) u(9)& & %有反馈 close-loop
& & u(10) u(11) u(12)
& & u(13) u(14) u(15)];
x1=phi2*x0+[phi2]*[u(1) u(2) u(3)]';
M1=Sigma+g*g';
M2=Sigma+g*g';
Gamma1=(x0+[u(1) u(2) u(3)]')*(x0+[u(1) u(2) u(3)]')'.*S
Gamma2=Gamma1.*M2+thita1*Sigma*thita1'.*M2+diag(x0+[u(1) u(2) u(3)]')*Sigma*thita1'.*M2+thita1*Sigma*diag(x0+[u(1) u(2) u(3)]').*M2+(x1+[u(4) u(5) u(6)]')*(x1+[u(4) u(5) u(6)]')'.*S
y=abs([u(1),u(2),u(3)])*c*ones(3,1)+abs([u(4),u(5),u(6)])*c*ones(3,1)+trace(Gamma1*M2)+trace(Sigma*thita1'*M2*thita1)+2*trace(diag(x0+[u(1) u(2) u(3)]')*Sigma*thita1'*M2)+(x1+[u(4) u(5) u(6)]')'*Sigma*(x1+[u(4) u(5) u(6)]')
约束条件myconv.m的语句为:
function [h1,h2]=myconv(u)
g=[1.162 1.246 1.228]';
Sigma=[0.7 0.0145
& & 0.4 0.0104
& & 0.4 0.0289];
x0=[1/3,1/3,1/3]';
G=[g(1) 0 0
& & 0 g(2) 0
& & 0 0 g(3)];
h1=-(ones(1,3)*phi1)*x0-(ones(1,3)*phi1)*[u(1) u(2) u(3)]'-(ones(1,3)*phi2)*[u(4) u(5) u(6)]'+d;
我安装了yalmip工具箱之后,将程序改编了一下。但是运行不了。运用yalmip工具箱编写的程序语句如下:
a=1.5:0.01:1.65;
u=sdpvar(15,1);
Y=[];U=[];
for i=1:length(a)
& & d=a(i);
aeq=[1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
& & 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0
& & 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0
& & 0 0 0 0 0 0&&0 1 0 0&&1 0 0 1 0
& & 0 0 0 0 0 0&&0 0 1 0&&0 1 0 0 1];
beq=[0;0;0;0;0];
g=[1.162 1.246 1.228]';
Sigma=[0.7 0.0145
& & 0.4 0.0104
& & 0.4 0.0289];
G=[g(1) 0 0
& & 0 g(2) 0
& & 0 0 g(3)];
thita0=zeros(3,3);
Gamma0=zeros(3,3);
Sigma0=zeros(3,3);
x0=[1/3,1/3,1/3]';
thita1=[u(7) u(8) u(9)& & %有反馈 close-loop
& & u(10) u(11) u(12)
& & u(13) u(14) u(15)];
x1=phi2*x0+[phi2]*[u(1) u(2) u(3)]';
M1=Sigma+g*g';
M2=Sigma+g*g';
Gamma1=(x0+[u(1) u(2) u(3)]')*(x0+[u(1) u(2) u(3)]')'.*S
Gamma2=Gamma1.*M2+thita1*Sigma*thita1'.*M2+diag(x0+[u(1) u(2) u(3)]')*Sigma*thita1'.*M2+thita1*Sigma*diag(x0+[u(1) u(2) u(3)]').*M2+(x1+[u(4) u(5) u(6)]')*(x1+[u(4) u(5) u(6)]')'.*S
y=abs([u(1),u(2),u(3)])*c*ones(3,1)+abs([u(4),u(5),u(6)])*c*ones(3,1)+trace(Gamma1*M2)+trace(Sigma*thita1'*M2*thita1)+2*trace(diag(x0+[u(1) u(2) u(3)]')*Sigma*thita1'*M2)+(x1+[u(4) u(5) u(6)]')'*Sigma*(x1+[u(4) u(5) u(6)]');
h1=-(ones(1,3)*phi1)*x0-(ones(1,3)*phi1)*[u(1) u(2) u(3)]'-(ones(1,3)*phi2)*[u(4) u(5) u(6)]'+d;
F=set(aeq*u==beq)+set(h1&=0);
% F=set(aeq*repmat(u,1,5)==beq)+set(h1&=0);
sol=solvesdp(F,y);
u=double(u);
% plot(y,d,'r*');
运行有问题,显示为:
Optimization terminated.
??? Error using ==& logical.set at 29
Error using ==& set
Vector of handles not permitted for set(h)
Error in ==& yh at 38
F=set(aeq*u==beq)+set(h1&=0);
请问各位应该怎么弄呢?万分谢谢!
15:26 上传
点击文件名下载附件
1.55 KB, 下载次数: 42095
改为用yalmip优化编写的程序
15:26 上传
点击文件名下载附件
1.17 KB, 下载次数: 9079
fmincon优化的主程序
15:26 上传
点击文件名下载附件
361 Bytes, 下载次数: 9394
fmincon优化的约束条件子程序
15:26 上传
点击文件名下载附件
945 Bytes, 下载次数: 59668
fmincon优化的目标函数子程序
15:27 上传
点击文件名下载附件
199 Bytes, 下载次数: 19666
yalmip教程中的一个算例
10:09 上传
点击文件名下载附件
193.55 KB, 下载次数: 83879
工具箱教程
10:11 上传
点击文件名下载附件
918.65 KB, 下载次数: 55783
yalmip工具箱
论坛优秀回答者
<h1 style="color:#2 麦片财富积分
关注者: 36
第一个不知道,你第二个出错,不要用set命名变量,set是matlab内置的function, 而且就算你用set命名了,你set这个变量呢?
<h1 style="color:# 麦片财富积分
本帖最后由 yuyolanda 于
13:34 编辑
第一个不知道,你第二个出错,不要用set命名变量,set是matlab内置的function, 而且就算你用set命名了,你se ...
我找了下yalmip工具箱的资料,好像set是用来定义约束条件的吧。我把资料粘贴过来:
约束条件—set
o set(集合)是YALMIP的另外一种关键对象,用
它来囊括优化问题的所有约束条件。
o 最常用的集合构造方法为采用set函数
P = sdpvar(3,3);
F = set(P & 0);%唯一的不等式约束
对于存在上、下界的情况,也可以有如下的写法:
F = set(0 & diag(P) & 5);
资料中还给了一个求解非线性规划的一个算例:f=-[2 1 4 3 1]'; A=[0 2 1 4 2; 3 4 5 -1 -1];
B=[54; 62]; Ae=[]; Be=[];
xm=[0,0,3.32,0.678,2.57]';
P=sdpvar(5,1);
F=set(A*P&=B)+set(xm&=P);
sol=solvesdp(F,g);
P=double(P)
论坛优秀回答者
<h1 style="color:#2 麦片财富积分
关注者: 36
which -all set复制代码看看你用的是不是toolbox里面的set
<h1 style="color:# 麦片财富积分
看看你用的是不是toolbox里面的set
应该是的吧,输入你给的代码之后,出来一大长串:
built-in (C:\Program Files\MATLAB\R2008a\toolbox\matlab\graphics\set)
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@char\set.m& && && && && && && && && && && && &% char method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@double\set.m& && && && && && && && && && && & % double method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@logical\set.m& && && && && && && && && && && &% logical method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % hg.figure method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % hg.GObject method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % schema.class method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % handle.handle method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % schema.package method
set is a built-in method& && && && && && && && && && && && && && && && && && && && && && && && && & % schema.method method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\@sdpvar\set.m& && && && && && && && && && && && && &&&% sdpvar method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@constraint\set.m& && && && && && && && && && &% constraint method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@lmi\set.m& && && && && && && && && && && && & % lmi method
C:\Program Files\MATLAB\R2008a\toolbox\yalmip\extras\@ncvar\set.m
这是粘贴的前面部分。。。
论坛优秀回答者
<h1 style="color:#2 麦片财富积分
关注者: 36
你需要用的是yalmip toolbox里面的set,但是现在调用的是matlab内置的set,你可以去设置里面把toolbox的path放到最前面,但是我不建议你这么做,set是很基本的matlab function, 你这样说不定会让很多内置的东西都出问题。
你要么在他的toolbox\yalmip下面进行操作, 这样保证你调用的是他的set
<h1 style="color:# 麦片财富积分
你需要用的是yalmip toolbox里面的set,但是现在调用的是matlab内置的set,你可以去设置里面把toolbox的path ...
在他的toolbox\yalmip下面进行操作, 这样保证你调用的是他的set??
我不太明白应该怎么弄。
我将我的程序放到toolbox\yalmip下的包含set.m文件的文件夹中运行,运行不了。显示:
??? Error using ==& logical.set at 29
Error using ==& set
Vector of handles not permitted for set(h)
Error in ==& yh at 44
F=set(aeq*u==beq)+set(h1&=0);
??? Undefined function or variable 'yh'.
我将yalmip中的set.m文件复制到我程序的文件夹中也运行不了。。。。显示:
??? Error using ==& logical.set at 29
Error using ==& set
Vector of handles not permitted for set(h)
Error in ==& yh at 44
F=set(aeq*u==beq)+set(h1&=0);
论坛优秀回答者
<h1 style="color:#2 麦片财富积分
关注者: 36
这toolbox有自带的可以运行的例子么?如果有试试运行下看看能不能运行,如果不能运行,说明是你安装这个toolbox时候有问题
<h1 style="color:# 麦片财富积分
这toolbox有自带的可以运行的例子么?如果有试试运行下看看能不能运行,如果不能运行,说明是你安装这个too ...
我学这工具箱的时候下载了一份教程,它里面有一个算例:
f=-[2 1 4 3 1]'; A=[0 2 1 4 2; 3 4 5 -1 -1];
B=[54; 62]; Ae=[]; Be=[];
xm=[0,0,3.32,0.678,2.57]';
P=sdpvar(5,1);
F=set(A*P&=B)+set(xm&=P);
sol=solvesdp(F,g);
P=double(P)
我运行了这个算例 是可以运行的。所以,我安装的工具箱应该没问题吧。:)
<h1 style="color:# 麦片财富积分
本帖最后由 yuyolanda 于
13:11 编辑
第一个不知道,你第二个出错,不要用set命名变量,set是matlab内置的function, 而且就算你用set命名了,你se ...
其实,我是研究投资组合的优化,需要把优化模型的前沿面画出来。真实前沿面应该是凸的,光滑的,不应该是这样的锯齿形的。
我之前做的确定型策略下中,用fmincon函数求解没问题。
QQ图片02.jpg (34.67 KB, 下载次数: 0)
13:10 上传
而现在用fmincon优化 ,画出来的是锯齿形的,所以想换yalmip工具箱优化,看问题是否能解决。
站长推荐 /2
利用MATLAB进行传感器数据分析
MATLAB中文论坛是全球最大的 MATLAB & Simulink 中文社区。用户免费注册会员后,即可下载代码,讨论问题,请教资深用户及结识书籍作者。立即注册加入我们吧!
MATLAB官方社交平台
MATLAB中文论坛微社区

我要回帖

更多关于 非线性约束条件 的文章

 

随机推荐