Use Particle Swarm Optimization with inequality linear constraints.
22 views (last 30 days)
Show older comments
I would like to know how can I use Particle Swarm Optimization with inequality linear constraints.
I get to run my code just with bounds limits, but I need run my code with linear constraints also, I need the sintax of function PSO.
0 Comments
Accepted Answer
Stephan
on 20 Mar 2019
Hi,
there is not such a syntax, since PSO does not support constraints. If you need constraints i suggest to use ga, which is able to handle this.
Best regards
Stephan
0 Comments
More Answers (4)
Maisa Melo
on 20 Mar 2019
1 Comment
Alan Weiss
on 20 Mar 2019
We cannot answer why ga finds those points until we see your A and a matrices, and maybe (if it is not too long) your objective function funcaoObjetivo and the associated data U0 and n.
Alan Weiss
MATLAB mathematical toolbox documentation
Maisa Melo
on 20 Mar 2019
1 Comment
Alan Weiss
on 20 Mar 2019
Edited: Alan Weiss
on 20 Mar 2019
Thank you for the detail. I do not understand why you are trying to solve this problem using Global Optimization Toolbox solvers. The objective function looks smooth (perhaps a ratio of quadratics), and the constraints are linear. Therefore, you should not attempt to solve the problem using particleswarm or ga, but instead should use fmincon or perhaps quadprog if I misunderstand the constraints.
It is possible that you are computing an expectation using a simulation, and I did not understand that part of your explanation. If so, then perhaps read Optimizing a Simulation or ODE to see how you might need to set finite differences appropriately.
I did not test your linear constraints to see what kind of region they allow. Perhaps you should look at your feasible region by using linprog with your A and a matrices, and give varying f arguments to see what kinds of solutions you can get (I mean choose differing signs of the components of f). Also, and this is important, you should set finite bounds on all variables, botth upper and lower bounds.
One reason that your ga optimization is working poorly is that your options seem suited for a problem with just a few variables and dimensions, perhaps three or four variables u(i). I suspect that you have a great number of variables in reality. Therefore, a population size of 50 means that ga has no chance of providing you with reasonable answers. But in any case, you should not use ga for this kind of problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Abderrahmane DADA
on 15 Sep 2019
Hello Meisa.
Check the following link: It's a partcile swarm toolbox that is able to handle constrained problem.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!