scikit-opt icon indicating copy to clipboard operation
scikit-opt copied to clipboard

Complex constraints in PSO

Open mchirsa5 opened this issue 5 years ago • 1 comments

I have tried running the example in PSO with the constraints (defined in DE example). However,

constraint_eq = [lambda x: 1 - x[1] - x[2]] pso = PSO(func=obj_func, dim=2, pop=40, max_iter=100, lb=new_low_bound, ub=new_up_bound, constraint_eq=constraint_eq, w=0.8, c1=0.5, c2=0.5)

However, the is an error showing that TypeError: init() got an unexpected keyword argument 'constraint_eq'.

Could you please tell me how to add constraints in PSO?

mchirsa5 avatar Jul 13 '20 21:07 mchirsa5

Nonlinear constraint is available now in version 0.6.1. demo: https://github.com/guofei9987/scikit-opt/blob/master/examples/demo_pso_ani.py enjoy!

guofei9987 avatar Nov 20 '20 12:11 guofei9987