필터 지우기
필터 지우기

Quasi-Newton method for optimization

조회 수: 11 (최근 30일)
hinami
hinami 2020년 8월 25일
편집: Bruno Luong 2020년 8월 25일
Given the set of 4 linear equations above, I'd like to optimize unknown parameters A, B, and C using a quasi-newton method. For example, coefficients r and given values R are as below:
Could you somebody help me with this?
  댓글 수: 8
Sam Chak
Sam Chak 2020년 8월 25일
Hi Hinami,
I think your field belongs to Remote Sensing, and I'm no expert on this.
The authors stated on page 5 that they used the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm (which belongs to the quasi-Newton family) to solve the constrained system of linear equations {Eq. (2)}, but the set of Eq. (2) is ill-conditioned. Thus, the authors added another constraint on the interval of the solution between 0 and 1. See Eq. (3).
The 'fminunc' function is an unconstrained nonlinear optimization algorithm that uses the 'quasi-newton' algorithm by default. The 'fmincon' function deals with constrained nonlinear optimization problem and it uses a sequential quadratic programming (SQP) method.
hinami
hinami 2020년 8월 25일
Hi Sam,
Thanks for you suggestion. This is very helpfull. I'll try 'fmincon' function for the equations.

댓글을 달려면 로그인하십시오.

채택된 답변

Bruno Luong
Bruno Luong 2020년 8월 25일
편집: Bruno Luong 2020년 8월 25일
Use FMINCON to minimize
norm(r*x-R)^2
with constraints
sum(x)=1
x>=0
r=[0.22 9.94 0.08;
0.16 0.95 0.08;
0.07 0.87 0.08];
R = [0.49; 0.42; 0.19]
x = fmincon(@(x) norm(r*x-R)^2, ones(3,1)/3, [], [], ones(1,3), 1, zeros(3,1), []);
A = x(1)
B = x(2)
C = x(3)

추가 답변 (2개)

John D'Errico
John D'Errico 2020년 8월 25일
편집: John D'Errico 2020년 8월 25일
If all you need to do is solve the linear system of equations, subject to the EQUALITY constraint, use LSQLIN. That is the tool designed to solve the problem, (not a quasi-Newton algorithm or fmincon, both of which are overkill.)
r=[0.22 9.94 0.08;
0.16 0.95 0.08;
0.07 0.87 0.08];
R = [0.49; 0.42; 0.19];
Aeq = [1 1 1]; % the equality constraint
beq = 1;
lb = [0 0 0]; % bound constraints
ub = [1 1 1];
ABC = lsqlin(r,R,[],[],Aeq,beq,lb,ub);
ABC
ABC =
0.969440866890935
0.0305590528348618
8.02742320184426e-08
A = ABC(1);
B = ABC(2);
C = ABC(3);
So A, B, and C are those 3 numbers. Best to leave them in the vector ABC, thouh you can extract tham as I did. They sum to 1. They lie in the interval [0,1].
You do NOT want to use a quasi-newton method to solve this, as it would be inappropriate, because quasi-newton methids are not designed to solve bound constrained problems with equality constraints. At least they are not so designed without considerable effort on your part, where you would need to learn a lot about optimization methods.
Anyway, just because they used the wrong tool to solve the problem in a paper, does not mean you should follow their lead. If they jumped off a bridge, and survived, does this mean it was a good idea?
You do not want to use fmincon to solve it, as that would be overkill to use an iterative method that requires starting values to solve a simple linear least squares problem that is subject to linear constraints.
Use lsqlin to solve that class of problem. It is designed to directly solve the problem where it will minimize the norm of the residuals norm(r*ABC - R), subject to the indicated constraints.
  댓글 수: 2
Bruno Luong
Bruno Luong 2020년 8월 25일
Another method is QUADPROG, which could be under lsqlin hood
x = quadprog(r'*r,-r'*R,[], [], ones(1,3), 1, zeros(3,1), [])
Bruno Luong
Bruno Luong 2020년 8월 25일
Another way less obvious is lsqnonneg (the main advantage is no need for optimization lbx)
M = [r'*r, ones(3,1); ones(1,3), 0];
y = [r'*R; 1];
x = lsqnonneg(M, y);
x = x(1:3)

댓글을 달려면 로그인하십시오.


hinami
hinami 2020년 8월 25일
편집: hinami 2020년 8월 25일
These work fine.
Thank you all. Much appreciated.

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by