Just for fun, I thought I’d see if I could find the inverse of a matrix using swarm optimization. Finding the inverse of a matrix is a very common task in many algorithms and there are many proven techniques, so finding an inverse using swarm optimization isn’t really useful. But I wanted to see if it could be done.
The answer is yes, it is possible. Swarm optimization algorithms loosely mimic the coordinated behavior of groups of simple individuals such as flocks of birds. Each particle represents a possible solution to the problem at hand. There are multiple possible solutions and they move, virtually, towards better solutions.
I wrote a demo program. The demo sets up a 5×5 matrix with random values between -10 and +10. I computed the true 5×5 inverse of the random matrix using standard techniques. Then I applied a particle swarm technique I wrote. The inverse calculated by the particle swart technique was quite close to the true inverse.
There’s only one scenario where I can imagine the swarm matrix inverse technique might be useful. As it turns out, some matrices have no inverse, and for some matrices standard techniques just don’t work. In these situations swarm optimization could be used to estimate the inverse. Anyway, it was an interesting exploration.