libprima / PRIMA.jl

a Julia interface to PRIMA, a Reference Implementation for Powell's methods with Modernization and Amelioration
MIT License
21 stars 5 forks source link

Wrap the objective & constraint function evaluation and catch exceptions if any #15

Open zaikunzhang opened 1 year ago

zaikunzhang commented 1 year ago

See the discussion at

https://github.com/libprima/prima/issues/90 ,

which is copy-pasted below.

This is related to

#80

In general, we should keep in mind that function evaluations may fail or return exceptional values. A robust and reliable solver must handle such cases properly.

The capability of handling such cases can be tested by the TOUGH test. The following is a MATLAB implementation of such a test. https://github.com/libprima/prima/blob/main/matlab/tests/private/tough.m

The MATLAB interface of PRIMA handles exceptions and exceptional values as follows. https://github.com/libprima/prima/blob/main/matlab/interfaces/private/evalobj.m https://github.com/libprima/prima/blob/main/matlab/interfaces/private/evalcon.m

In this way, the function evaluations are wrapped using a try ... catch ... so that exceptions will be taken care of. The solvers will not crash even if the function evaluation fails.

See also my elaboration at https://github.com/libprima/prima/issues/80#issuecomment-1727134736