Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zaikunzhang opened this issue Sep 20, 2023 · 1 comment
Labels
c Issues related to the C interface or implementation enhancement New feature or request

Comments

@zaikunzhang
Copy link
Member

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.

Is it possible to do similar things in C? I understand that C does not have a native try ... catch ....

@zaikunzhang zaikunzhang added c Issues related to the C interface or implementation enhancement New feature or request labels Sep 20, 2023
@zaikunzhang zaikunzhang changed the title Wrapping the objective & constraint function evaluation and catch exceptions if any Wrap the objective & constraint function evaluation and catch exceptions if any Sep 20, 2023
@jschueller
Copy link
Collaborator

jschueller commented Sep 21, 2023

no, but it can be done when using prima is used with a c++ objective function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c Issues related to the C interface or implementation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants