필터 지우기
필터 지우기

Particle Swarm Optimization to solve matrix inversion

조회 수: 3 (최근 30일)
Nurulhuda Ismail
Nurulhuda Ismail 2019년 1월 7일
댓글: Walter Roberson 2019년 1월 8일
Hi everyone,
I am Huda, and I am working with matrix inversion. I am really new with PSO and I would like to know is it possible to use PSO for a large size matrix inversion (eg., 16x16, or 64x64)? From a linear equation, Ax=b, we can find x by several techniques such as Gauss-Jordan elimination, and we know that AA^(-1) =I. Thus, I wonder if PSO can solve this problem by computing A^(-1) iteratively.
If yes, can you share with me any material that can guide me to start my work. But, If matrix inversion with PSO will give bad result, can you advise any technique that suitable to use?
Thank you for your response.
  댓글 수: 5
Nurulhuda Ismail
Nurulhuda Ismail 2019년 1월 8일
Ok then, thank you for your comment.
Nurulhuda Ismail
Nurulhuda Ismail 2019년 1월 8일
Instead of PSO, is there any other optimizer that suitable for matrix inversion? Your idea is really appreciated.Thank you.

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

채택된 답변

Walter Roberson
Walter Roberson 2019년 1월 8일
N = 8;
rng(12345);
M = randi([-50 50], N, N);
obj = @(v) sum(sum((M * reshape(v,N,N) - eye(N)).^2));
N2 = N.^2;
LB = []; UB = [];
options = optimoptions(@particleswarm, 'Display', 'final', 'MaxIterations', 500*N2, 'PlotFcn', @pswplotbestf );
tic
[bestinv, fval] = particleswarm(obj, N2, LB, UB, options);
time_needed_ps = toc;
Minvps = reshape(bestinv, N, N);
tic
Minv = inv(M);
time_needed_numeric = toc;
residue = sum((Minvps(:) - Minv(:)).^2);
fprintf('\nResidue between particle swarm inverse and numeric inverse is: %.6g\n', residue);
fprintf('\nDifference between particle swarm inverse and numeric inverse is: \n\n')
disp(Minvps - Minv)
fprintf('\ntime required for particle swarm partial inverse: %.6gs\n', time_needed_ps);
fprintf('time required for numeric inverse: %.6gs\n', time_needed_numeric);
Approximate time multiplication for the particle swarm approach: 620000 times more expensive. The calculated inverse will not necessarily be especially close -- it is not bad for 5 x 5, but by 8 x 8 the residue is still about a million.
  댓글 수: 3
Nurulhuda Ismail
Nurulhuda Ismail 2019년 1월 8일
Thank you. I got an error while I run in MATLAB which is because I dont install the Global Optimizaion Toolbox. I will re-run the codes once I install this toolbox.
Regarding to a matrix inversion, instead of PSO, do you know any other optimizer that I can be used to do matrix inversion?
Walter Roberson
Walter Roberson 2019년 1월 8일
On my system inv() of a 64x64 array takes less than 1e-4 seconds. Any optimization routine would have to finish faster than that to be worth bothering with.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by