Effacer les filtres
Effacer les filtres

can I pass these nonlinear constraints to lsqnonlin?

32 vues (au cours des 30 derniers jours)
SA-W
SA-W le 15 Juin 2023
Commenté : Matt J le 30 Juin 2023
Let denote a function of two variables and the parameters of the optimization problem
which I want to solve with lsqnonlin. To calculate , fmust be convex at all iterations. Otherwise, it is purely a matter of luck that the identification works.
My idea is to enforce the convexity by enforcing the Hessian of fto be positiv definite. The determinant of the Hessian is given by (please correct me if I am wrong)
Given that, I would implement the constraints
c =
in a function
function [c,ceq] = mycon(x)
ceq = [];
c = ... % the above formula
end
I evaluate the above equation at n points in the {x,y} space, i.e., c is a vector with nentries.
Can I implement those constraints as nonlinear constraints or do I make things too complicated?
  1 commentaire
Matt J
Matt J le 15 Juin 2023
To calculate sim , f must be convex at all iterations.
Convex as a function of (x,y), I assume you mean. Is is already a convex function of E.

Connectez-vous pour commenter.

Réponse acceptée

Matt J
Matt J le 15 Juin 2023
Modifié(e) : Matt J le 15 Juin 2023
Can I implement those constraints as nonlinear constraints
You can, but you have a few problems:
(1) Nonlinear constraints cannot be enforced at all iterations. In fact, only simple bounds constraints can be.
(2) det(A)>0 is not a sufficient condition for the positive definiteness of A. By Sylvester's criterion, you need to ensure as well, although that will be a simpler, linear constraint in E.
(3) The constraints need to be satisfied for all (x,y) in whatever domain f(x,y) is defined on. In theory, that gives you an unaccountably infinite number of constraints. To be practical, you could relax the constraint, imposing it on some discrete grid of points (x_j, y_j), but in theory, you could not be sure that f(x,y) is convex everywhere between these points.
or do I make things too complicated?
Maybe. You would need to tell us more about the properties of the N_i(x,y) functions and what g^sim() is doing. If the N_i(x,y) functions are all convex individually, then it would be sufficient (although not necessary) to impose the much simpler constraints E_i>=0.
  44 commentaires
Matt J
Matt J le 20 Juin 2023
Modifié(e) : Matt J le 20 Juin 2023
I also mentioned the possibility of adding an additional parameter on the exponentials.
N=@(x) 10*log( 1 + A*exp(a*(x-5)));
With the right selection of A, it doesn't seem too bad
A=0.1;
avalues=linspace(-0.5,0.5,9);
for a=avalues
N=@(x) 10*log( 1 + A*exp(a*(x-5)));
hold on
fplot(N,[0,10])
hold off
end; legend("a="+avalues,'Location','north')
SA-W
SA-W le 20 Juin 2023
I also mentioned the possibility of adding an additional parameter on the exponentials.
Yes, but the additional parameters require additional constraints and, more important, increase the number of parameters by . So it is probably a trade-off: if I do not situate a basis function at every support point, I have to introduce the additional parameters on the exponentials to make the basis more flexible. If I have a higher density of basis functions, I can probably set them to one. Makes intuitively sense?

Connectez-vous pour commenter.

Plus de réponses (1)

Matt J
Matt J le 20 Juin 2023
Modifié(e) : Matt J le 27 Juin 2023
Most of the f(x,y) that I am working on are indeed of the form f(x,y)=h(x)+g(y).
If this is true, then ensuring the convexity of f(x,y) is the same as ensuring the convexity of h(x) and g(y) as 1D functions, which is much simpler. I you use 1D linear interpolating basis functions,
h=@(x) interp1([E(1),E(2),E(3),...,En] ,x)
then you can ensure the convexity of h just by ensuring that the second order finite differences are increasing, which is a simple linear constraint on the E(i),
E(i+1)-2*E(i) + E(i+1)>=0
No need for nonlinear constraints at all. Moreover, if you make the change of variables
E=cumsum([C2,cumsum([C1,D])]);
where D(j), C1, and C2 are the new set of unknowns, then the constraints on D required for convexity are simple positivity bounds D(j)>=0. As you'll recall, bound constraints can indeed be enforced at all iterations, which you said is what you wanted.
D=rand(1,20);
C1=-5;
C2=0;
E=cumsum([C2,cumsum([C1,D])]);
fplot( @(x) interp1( E,x ) ,[1, numel(E)] ); xlabel x; ylabel h(x)
  89 commentaires