quadprog: can't set options
15 次查看(过去 30 天)
显示 更早的评论
Hi folks, I'm trying to do some quadratic programming while setting the optimality tolerance and getting a few errors. When I try:
opts = optimoptions(@quadprog,'Algorithm','trust-region-reflective','OptimalityTolerance',1e-10);
[x,fval,flag] = quadprog(Q,L,[],[],[],[],zeros(n,1),ones(n,1),[],opts);
I get the error
Undefined function 'sqrt' for input arguments of type 'char'.
Error in sqpbox (line 73)
tolfun2 = sqrt(tolfunvalue);
Error in sqpmin (line 71)
[x,val,gopt,it,npcg,exitflag,lambda,msg] = sqpbox(c,H,mtxmpy,lb,ub,xstart, ...
Error in quadprog (line 426)
[X,fval,output,exitflag,lambda] = sqpmin(f,H,mtxmpy,X0,Aeq,Beq,lb,ub,verbosity, ...
Error in WelfareAnalysis (line 118)
[x,fval,flag] = quadprog(Q,L,[],[],[],[],zeros(n,1),ones(n,1),[],opts);
Running the algorithm without setting this option has it proceeding normally:
opts = optimoptions(@quadprog,'Algorithm','trust-region-reflective');
[x,fval,flag] = quadprog(Q,L,[],[],[],[],zeros(n,1),ones(n,1),[],opts);
Local minimum possible.
quadprog stopped because the relative change in function value is less than the sqrt of the function tolerance, the rate of change in the function value is slow, and no negative curvature was detected.
Solved unconstrained optimal policy for model 3; exit flag = 3
Why is a character / string being passed along when I set this option? How do I fix the error so I can set the tolerance as I please? Thanks!
2 个评论
Walter Roberson
2019-5-18
What is the message just before that, telling you what kind of error it is? For example is it saying undefined variable tolfunvalue ?
(We do not have your data so we cannot test.)
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Least Squares 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!