| Did you know ... | Search Documentation: |
| Pack lbfgs -- prolog/lbfgs.pl |
Example optimizer_initialize(1,user,evaluate,progress,[],Env)
The evaluate call back predicate has to be of the type evaluate(+Environment,-F,+N,+Step,+ExtraArg). It has to
calculate the current function value F. N is the size of the parameter vector (the value which was used to
initialize LBFGS) and Step is the current state of the line search. The call back predicate can access the
current values of x[i] by calling optimizer_get_x(+Environment,+I,-Xi). Finally, the call back
predicate has to calculate the gradient of F and set its value by calling optimizer_set_g(+Environment,+I,+Gi)
for every 1<=I<=N. Environment needs to be passed to further calls to the library predicates.
ExtraArg can be used to pass data to evaluate/5.
The progress call back predicate has to be of the type
progress(+Environment,+F,+X_Norm,+G_Norm,+Step,+N,+Iteration,+LS,+Continue,+ExtraArg).
It is called after every iteration. The call back predicate can access the current values of X and of
the gradient by calling optimizer_get_x(+Environment,+I,-Xi) and optimizer_get_g(+Environment+I,-Gi) respectively.
Howver, it must not call the setter predicates for X or G. If it tries to do so, the optimizer will
terminate with an error. If Continue is set to 0 (int) the optimization process will continue for
one more iteration, any other value will terminate the optimization process.
optimizer_initialize(+N,user,+Evaluate,+Progress,[],-Environment)The following predicates are exported, but not or incorrectly documented.