Closed jschueller closed 11 months ago
See the :open_file_folder: files view, the :scroll:action log or :angel: SARIF report for details.
calcb callbck CCALLBACK evalcallback fcb
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 valuex
is the most recently evaluated point and f
is its function valueAnother possibility is to change the signature of the callback function to callback(xnew, fnew, xbest, fbest, terminate, ...)
to include both of them.
In addition,
lincona
, we must include cstrv
(constraint violatio) as an input to callback
, cobyla
, we must include both cstrv
and constr
. Insights from SciPy maintainers are greatly needed.
Thanks.
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).
@zaikunzhang I stumbled on a weird compiler bug: https://github.com/flang-compiler/flang/issues/1419 You can add it to your collection :]
@zaikunzhang I stumbled on a weird compiler bug: flang-compiler/flang#1419 You can add it to your collection :]
Done: https://github.com/zequipe/test_compiler/commit/1990a70f52712dc74db97a14ead54dc50c448fc2. Thank you.
@zaikunzhang I added constraint values, what do you think ?
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.
[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)]
.
cstrv
and nlconstr
should be optional in callback
. It is rather strange and confusing to define cstrv
and nlconstr
in subroutines like newuob.f90
.
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.
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