Reporting unimplemented stopping criteria in Cobyla

Hi everyone.

Cobyla inherits setMaximumRelativeError, setMaximumResidualError from OptimizationAlgorithmImplementation.

As far as I know from checking the code (but I could be wrong), neither of those stopping criteria can be used with Cobyla. Setting those fields does nothing.

Only the maximum absolute error is used ( to set rhoEnd, the main stopping criteria used in the original Cobyla). (see lib/src/Base/Optim/Cobyla.cxx#L105)

I think it would be great to report to the user that those stopping criteria are not implemented.

I suggest raising an exception, to stay consistent with the way unavailable stopping criteria for Simulation algorithms are reported in @m-balesdent 's recent pull request (cf add warning for NAIS and adaptive IS by m-balesdent · Pull Request #3219 · openturns/openturns · GitHub).

I know that the current implementation of Cobyla used by OpenTURNS is probably going to be replaced in the future by the PRIMA one. However, as far as I understand, the PRIMA implementation still doesn’t support relative errors and residual errors as stopping criteria.

The full list of parameters for PRIMA’s Cobyla is here if you want to check :

https://github.com/libprima/prima/blob/fortran/cobyla/cobyla.f90#L56-L260

Therefore, I think my suggestion would still be relevant even if the implementation of Cobyla was changed for the PRIMA one.

What do you think ?

maybe raising an exception would prevent from switching easily between solvers (ie for persalys)