Module Owl_opt_lbfgs__.Bindings
type work
Represent the memory space needed to solve a minimization problem. It is usually allocated automatically but it is possible to do it manually to, say, allocate it once only before a loop.
exception
Abnormal of float * string
Abnormal(f, msg)
is raised if the routine terminated abnormally without being able to satisfy the termination conditions. In such an event, the variablex
(seeF
.min) will contain the current best approximation found andf
is the value of the target function atx
.msg
is a message containing additional information (returned by the original FORTRAN code).If the error message is not precise enough, it is recommended to turn printing on to understand what is the problem.
type state
Holds informations on the current state of the computation that can help to decide whether to stop.
type vec
= (float, Stdlib.Bigarray.float64_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
Vectors.
val min : ?factr:float -> ?pgtol:float -> work:work -> (vec -> vec -> float) -> vec -> vec -> lbfgs_status
min f_df x df
minimises the functionf
given byf_df
.x
is an initial estimate of the solution vector. On termination,x
will contain the next approximation found anddf
will contain the latest gradient.min f_df x df
should be called iteratively to find the minimum off
.f_df x df
is a function that computes f(x) and its gradiant f'(x), returns f(x) and stores f'(x) indf
. Thex
passed tof_df x df
is physically equal to thex
given inmin f_df x
. Can raiseAbnormal
.- parameter factr
tolerance in the termination test for the algorithm. The iteration will stop when
(f^k - f^{k+1})/max{ |f^k|, |f^{k+1}|, 1} <= factr*epsilon_float
. Set e.g.factr
to1e12
for low accuracy,1e7
for moderate accuracy and1e1
for extremely high accuracy. Settingfactr
to0.
suppresses this termination test. Default:1e7
.
- parameter pgtol
The iteration will stop when
max{ |proj g_i| : i = 0,..., n-1} <= pgtol
whereproj g_i
is the ith component of the projected gradient. Settingpgtol
to0.
suppresses this termination test. Default:1e-5
.
val max : ?factr:float -> ?pgtol:float -> work:work -> (vec -> vec -> float) -> vec -> vec -> lbfgs_status
max f_df x
maximises the functionf
given byf_df
.x
is an initial estimate of the solution vector. This function is provided for convenience and callsF
.min to which the reader is referred for further explanations.
val start : ?corrections:int -> ?l:vec -> ?u:vec -> int -> work
start n
allocate the work space for a problem of size at mostn
.- parameter l
lower bound for each component of the vector
x
. Setl.(i)
toneg_infinity
to indicate that no lower bound is desired. Default: no lower bounds.
- parameter u
upper bound for each component of the vector
x
. Setu.(i)
toinfinity
to indicate that no upper bound is desired. Default: no upper bounds.
- parameter corrections
maximum number of variable metric corrections used to define the limited memory matrix. Values < 3 are not recommended, and large values of
corrections
can result in excessive computing time. The range 3 <=corrections
<= 20 is recommended. Default:10
. This value in calledM
in L-BFGS-B debugging output.
val restart : work -> unit
restart state
restarts the L-BFGS-B optimization.