stevengj / nlopt

library for nonlinear optimization, wrapping many algorithms for global and local, constrained or unconstrained, optimization
Other
1.79k stars 553 forks source link

Nonlineay constraints get violated in the result. #476

Open Lbaron980810 opened 1 year ago

Lbaron980810 commented 1 year ago

Hi there: During my optimization, I applied LN_COBYLA since it supports arbitrary nonlinear constraint. My "constraint function" is actually a collision avoidance function. The function returns 10.0 when collision hits, so that the constraint should be view as unsatisfied. However, the result in experiment shows the constraint is not satisfied, and the algorithm can still get finished and converge. Can anyone give me some advice? Thanks sincerely! Screenshot from 2022-10-29 21-14-44

stevengj commented 1 year ago

The function returns 10.0 when collision hits, so that the constraint should be view as unsatisfied.

COBYLA assumes that the function is differentiable, so if you have a discontinuous function that's going to have unpredictable effects on convergence.

Lbaron980810 commented 1 year ago

The function returns 10.0 when collision hits, so that the constraint should be view as unsatisfied.

COBYLA assumes that the function is differentiable, so if you have a discontinuous function that's going to have unpredictable effects on convergence.

Make sense. So is there any method can handle my problem?