Open mchirsa5 opened 4 years ago
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?
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!
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?