Particle Swarm Optimization restricting the search space to integer values

101 views Asked by At

I have a cost function in Python to minimize and I'm trying to use the Particle Swarm Optimization (PSO) to do so.

I've tried the Pyswarm library and it works, but it's taking too much time to solve the problem, once the search space is not restricted to integer values (natural numbers), which is what I'm looking for.

Does anyone know another library that allows me to restrict the search space to integer values or know how to adapt the Pyswarm library to do so?

In other words, let's say my search space is from 1 to 5 and I have to find the value that gives me the lowest value for my cost function. I need the code the try only the values 1, 2, 3, 4 and 5 and returns the best value. What my code is doing now is trying decimal values, which, in this case, doesn't make any sense.

Thanks in advance!

0

There are 0 answers