I am given a n x n matrix where n ranges from 3 to 5. The matrix is then assigned random values from 1-n^2. Given the matrix I am to optimize the board such that I arrive to a solution of magic square.
Random board example: n = 3
3 5 6
1 7 8
2 4 9
I have a little knowledge about PSO but I atleast know this:
1. Randomly initialize a set of particles at random positions in the search space;
2. Evaluate all positions and update the global best position and the personal best positions;
3. Update each velocity based on the relative position of the global best position, the current velocity of the particle, the personal best position of the particle and some random vector;
4. goto 2.
I have also been told that the problem is not suited for algorithms such as PSO, but I have no choice but use it for this problem since it is the algorithm required.
I am thinking the the particles are the numbers assigned in the array, but how do I evaluate its position and update the particles position?
Thank you!