BUG: optimize: mark constraint violations in cobyla as failed solution

The COBYLA solver can apparently return with status 1 even if the constraints are violated. The constraint violation is reported in the `maxcv` variable, which however was previously undocumented.

This PR checks the violation in the wrapper against a given tolerance, and marks the solution as failed if the tolerance is not satisfied.

This needs some review --- I don't understand exactly why the COBYLA code works like it does (doesn't make much sense for a constrained solver to do this), but it seems like this is just how the old fortran code was intended to behave, and the Python wrappers were just incorrectly written.

Addresses gh-2891