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,
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Particle Swarm에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!