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

Callback #69

Closed
wants to merge 3 commits into from
Closed

Callback #69

wants to merge 3 commits into from

Conversation

jschueller
Copy link
Collaborator

@jschueller jschueller commented Sep 15, 2023

Called after each iteration (Cobyla only for now).
Reports the current best x & f values.
Allows to request termination via a boolean argument.

comments welcome

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check-spelling found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-actions

This comment has been minimized.

@zaikunzhang
Copy link
Member

zaikunzhang commented Sep 16, 2023

Thank you Julien @jschueller . This is very nice.

The first question that we have to discuss is as follows. In callback(x, f, terminate, [, other inputs]), what do we want x and f to be? There are two possibilities.

  • x is the current best point and f is its function value
  • x is the most recently evaluated point and f is its function value

Another possibility is to change the signature of the callback function to callback(xnew, fnew, xbest, fbest, terminate, ...) to include both of them.

In addition,

  • for lincona, we must include cstrv (constraint violatio) as an input to callback,
  • for cobyla, we must include both cstrv and constr.

Insights from SciPy maintainers are greatly needed.

Thanks.

@jschueller
Copy link
Collaborator Author

jschueller commented Sep 16, 2023

we want the best point only; we can already know the last point evaluated via the objective function

This is a useful observation. The objective function is also a callback. However, there is a small difference: the objective function does not give us terminate.

are you sure we need constr too ?

Yes. This is related to a previous discussion (see point 2 there). In the applications that PRIMA target, constr can be quite expensive to evaluate. Thus it is essential to provide this information to the user via the callback function (then the user will choose how to use it).

@jschueller
Copy link
Collaborator Author

jschueller commented Sep 16, 2023

@zaikunzhang I stumbled on a weird compiler bug:
flang-compiler/flang#1419
You can add it to your collection :]

@zaikunzhang
Copy link
Member

@zaikunzhang I stumbled on a weird compiler bug: flang-compiler/flang#1419 You can add it to your collection :]

Done: zequipe/test_compiler@1990a70. Thank you.

Called after each iteration (Cobyla only for now).
Reports the current best x,f values.
Allows to request termination.
@jschueller jschueller marked this pull request as ready for review September 21, 2023 12:04
@jschueller
Copy link
Collaborator Author

@zaikunzhang I added constraint values, what do you think ?

@zaikunzhang
Copy link
Member

zaikunzhang commented Oct 17, 2023

Hello @jschueller Julien,

Sorry for the delayed reply. The work and life on my side have been complicated recently, and they will continue to be so for a while.

Note the following.

  1. [x, f, cstrv, nlconstr] is not the latest best [decision variable, function value, constraint violation, nonlinear constraint value]. It is the latest evaluated one. The latest best one is [xbase + xpt(:, kopt), fval(kopt), cval(kopt), conmat(:, kopt)].

  2. cstrv and nlconstr should be optional in callback. It is rather strange and confusing to define cstrv and nlconstr in subroutines like newuob.f90.

  3. Since the callback changes the Fortran API, the MATLAB interface will be broken. I can take care of that, but do not have time for the moment.

Thanks.

@jschueller jschueller closed this by deleting the head repository Oct 19, 2023
@nbelakovski nbelakovski mentioned this pull request Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants