Using PSO with discrete variables

조회 수: 20 (최근 30일)
Rafael
Rafael 2023년 5월 29일
답변: Aman 2023년 7월 26일
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
John D'Errico
John D'Errico 2023년 5월 29일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Aman
Aman 2023년 7월 26일
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!

카테고리

Help CenterFile Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by