How to set a fixed step for lower and upper bounds (lb,ub) in particle swarm optimization?

조회 수: 22 (최근 30일)
Dear All:
I am trying to particle swarm to optimize a function. I would ask you how to set a fixed step for lower and upper bounds (lb, ub), let's say: 0:0.5.5 (i.e., a step of 0.5 from lb to up). My script is a follows:
nvars=3;
lb=[0,0,0]; ub=[5,5,5];
options=optimoptions('particleswarm','SwarmSize',100,'HybridFcn',@fmincon);
[x,fval,exitflag,output]=particleswarm(objfun,nvars,lb,ub,options);
Thank you very much for your help.
Best regards,

채택된 답변

Alan Weiss
Alan Weiss 2020년 7월 22일
I am not sure that I understand you. I think that you mean that you have discrete variables, you would like your solution to be from a discrete set, where each component of the solution is an integer multiple of 1/2. If this is true, then both particleswarm and fmincon are inappropriate solvers, as they cannot deal with discrete variables.
It also seems to me as if you have just three variables, and you have about 10 distinct values possible for each variable (0, 0.5, 1, 1.5,..,4.5, 5). In that case I think that you would do best by simply performing a complete search over the 10^3 possible solutions; that is not very many at all.
If I misunderstand, feel free to clarify.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 1
Son
Son 2020년 7월 22일
Thank you very much for your prompt reponse. Yes, because I used particleswarm and fmincon for searching (with contious values). But, it is very time-consuming, when I have more three variables. That's why I would use decrete (integer) values with a fixed step to search from lower to upper bounds. However, I cann't input such a fixed step in the particleswarm. I am very much appreciated if you drop me a solution for that.
Best,

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle Swarm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by