How to set a fixed step for lower and upper bounds (lb,ub) in particle swarm optimization?
23 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Son
el 22 de Jul. de 2020
Comentada: Son
el 22 de Jul. de 2020
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 comentarios
Respuesta aceptada
Alan Weiss
el 22 de Jul. de 2020
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
Más respuestas (0)
Ver también
Categorías
Más información sobre Particle Swarm en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!