Find constraints on polynomial coefficients optimization
이전 댓글 표시
I am trying to find the optimal coefficients of the polynomial of the form:
theta=a1*t^2 +a2*t+a3 (i.e., to find a1,a2,a3) for some cost function.
I'm using patternsearch and I need to formulate the nonlinear/linear constraints on a1,a2,a3.
The problem is that I have constraints on theta (say [lb,ub]) and the range of t (say [0,T]), but not on the coefficients themselves.
So far, I've managed to formulate these constraints:
lb<a3<ub;
lb<a1*T^2+a2*T+a3<ub;
I can't figure out the 3rd constraint on the extrimum on t=-a2/(2*a1). I care only if is in the rectancle [0,T],[lb,ub].
Any idea?
댓글 수: 6
Walter Roberson
2019년 7월 11일
How would you know if a set of coefficients were optimal?
Matt J
2019년 7월 11일
AdarG's comment relocated here:
Hi Walter,
patternsearch creates the a1,a2,a3 coefficients and use the polynomial to obtain a value of the cost function and minimize it. I only need to construct the constraints on the coefficients for the optimizator.
Walter Roberson
2019년 7월 11일
Is it correct that you are trying to find a1 a2 a3 t values that minimize theta under constraints on theta, t, and a3, but no constraints on a1 or a2?
If so then you can always choose theta as the minimum permitted: you have enough freedom to choose a1 and a2 to give any output you want.
AdarG
2019년 7월 11일
Walter Roberson
2019년 7월 11일
Those are not real constraints on the variables, only on theta.
AdarG
2019년 7월 11일
채택된 답변
추가 답변 (2개)
What's to figure out? You've already articulated that the (nonlinear) constraints on the extremum are,
0<=-a2/(2*a1)<=T
The only thing I might recommend is that converting them to linear constraints,
0<=-a2<=2*T*a1
a1>=0
might make things easier for patternsearch.
댓글 수: 6
AdarG
2019년 7월 11일
I see. Well, then you might divide the optimization into 3 sub-problems, corresponding to the 3 different regions where the critical t can lie. For each sub-problem, you apply a different set of constraints:
Case I constraints:
lb<=a3<=ub;
lb<= a1*T^2+a2*T+a3 <=ub;
-a2/(2*a1)<=0
Case II constraints:
lb<=a3<=ub;
lb<= a1*T^2+a2*T+a3 <=ub;
-a2/(2*a1)>=T
Case III constraints:
lb<=a3<=ub;
lb<= a1*T^2+a2*T+a3 <=ub;
0<=-a2/(2*a1)<=T
lb<=polyval(a,-a2/(2*a1))<=ub
AdarG
2019년 7월 12일
Matt J
2019년 7월 12일
Thanks Matt, but how do I implement it practically? Should I call the optimization routine 3 times?
Yes, you solve each sub-case and take the case with the best optimal value.
If I call only one time, how do I construct the A matrix and b vector?
Each row of the matrix corresponds to one of the linear constraints.
AdarG
2019년 7월 12일
Matt J
2019년 7월 12일
You should just set out of bound values to Inf.
x = fseminf(fun,[a1,a2,a3], 2, @(a,s) seminfcon(a,s,T,lb,ub));
function [c,ceq,K_ub,K_lb,s]= seminfcon(a,s,T,lb,ub)
% No finite nonlinear inequality and equality constraints
c = [];
ceq = [];
% Sample set
if isnan(s(1))
% Initial sampling interval
s = [0.01 0; 0.01 0];
end
t1 = 0:s(1):T;
t2 = 0:s(2):T;
% Evaluate the semi-infinite constraint
K_ub = polyval(a,t1)-ub;
K_lb = lb - polyval(a,t2);
end
카테고리
도움말 센터 및 File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!