Using PSO with discrete variables

17 vues (au cours des 30 derniers jours)
Rafael
Rafael le 29 Mai 2023
Réponse apportée : Aman le 26 Juil 2023
I'm trying to use PSO to minimize my objective function. I PSO is trying to find the best solution in a continuous space, but I would like it to look for the solution in a discrete searchspace.
Example:
If my lb = [0 0], and ub=[100 100] (2 vars estimate), PSO looks for any solution in that space, returning values with 5 decimal places, I would like for the algorithm to search in that space, but looking in a discretized space with steps of 0.1, so it could only return values like [5.1 40.8], instead of [5.1413 40.8131].
I want to do this for two reasons, first, I think that discretizing the searchspace would reduce the computing time, and second, I want to associate a weight to each set of values x in my objective function, the weights are stored in a matrix and I have an weight for each value x with steps of 0.1. This does not work if the search space is continuous.
How I call the algorithm:
objectiveFunction = @(x) weightMatrix .* myFunc(x);
optimizedPosition = particleswarm(objectiveFunction, 2, lb, ub, options);
TLDR: I want to discretize the searchspace for PSO optimization.
  1 commentaire
John D'Errico
John D'Errico le 29 Mai 2023
Hammer on it as hard as you want, but a square peg just won't happily fit inside a round hole.
PSO is not an algorithm designed to solve a discrete problem.

Connectez-vous pour commenter.

Réponses (1)

Aman
Aman le 26 Juil 2023
Hi,
I understand that you have an objective function whose minimal value you want to identify and are using PSO for that in a discrete search space instead of a continuous search space.
The PSO is an inappropriate choice to do so, as it is unable to deal with the discrete search space. As you want 0.1 to be your step size, as per your lower bound and upper bound, you have approximately 10^4 possible solutions, which is not a huge number, so it would be better if you did a complete search over the available search space to find the minimal value of your objective function.
Please refer to the following thread to learn more about it.
I hope it helps!

Catégories

En savoir plus sur Get Started with Optimization Toolbox dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by