PSO – how Dimensions are set up?

I am coding a Particle Swarm Optimization in C++. I have been for days trying to understand the theory of how dimensions work in each different problem.

In the many examples I have seen, all of them only shows how can a simple problem (f(x) = pow(x,2)+5*x+20) can have 2 dimensions. Usually the “x” axis is one and the “y” axis the other one. And by combining both in a 2 dimensional search space you get a single position in the search space. Very simple.

I have seen people showing some code examples where they had 20 or 50 dimensions set up. How come is that??

My problem to be solve works like this: I have parameters, each parameter has variations that goes from 1 to 4. Example: Parameters A and B. Each has 3 variations – A0, A1, A2 – B0, B1, B2. Basically there will be 9 combinations of them like this:

A0-B0, A0-B1, A0 - B2
A1-B0, A1-B1, A1 - B2
A2-B0, A2-B1, A2 - B2

3*3 = 9

Note: Each combination will have a fitness based in some tests. There is no big deal about it.

If I had a 3rd parameter with also 3 variations, my total number of combinations would be 27(3*3*3) So lets say I have 5 parameters, A, B, C, D and E. A - 3 variations, B - 4 variations, C - 3 variations, D – 2 variations, E – 4 variations.

3, 4, 3, 2, 4 – number of variations

So 3*4*3*2*4 = 288 – maximum number of possible combination and is my upper boundary.

So each of the 288 position would represent a combination. Each particle, initialized randomly would have a random combination.

So using PSO I hope to do as less tests as possible and still reach the global optimum.

My questions are:

• How many dimensions should I set to my problem?
• Am I missing something?/ Did I understand something wrong?
• How can a problem have more than 20 dimensions?
• Are dimensions optional?

Any answers, advice, documents about dimensions are welcome. Thank you

• The "parameters" you describe are dimensions. However, if you accept only discrete, limited values for those parameters, this is not a continuous problem space, so you may wish to use a different optimization algorithm. Different black box optimization algorithms are suitable for different tasks. I suggest you try an algorithm that does not make use of gradients or any assumptions about the continuity of the parameter space. You could use a simple combinatorial optimization algorithm such as branch and bound. – Frank Hileman Feb 25 '15 at 23:07
• Additionally, think hard about: heuristics to prune the combinatorial tree; how to quickly throw out a branch that is obviously worse that others previously found; how to identify identical points in the combinatorial space, to avoid re-evaluating your cost function, via memoization or some other technique. – Frank Hileman Feb 25 '15 at 23:11
• 288 combinations, and a fast fitness test, could be brute force searched. My comments are for a more complex system, or slow fitness test. – Frank Hileman Feb 26 '15 at 17:22
• I should have said this a couple months ago, but I have been really busy and also left the PSO project for now. But I have to say I really appreciate your answer Frank Hileman, Thank you so much. Also know that I actually saw your answers yet in February and showed them to my colleagues and we had a discussion about it. So once again thank you. – Pandalanche Jun 15 '15 at 15:50