Model
BlockOpt.Model
— TypeModel
Specifies the unconstrained program for minimizing a smooth objective function.
A model is constructed with a name
and may be incrementally loaded. Once a model is loaded, the model becomes final, meaning the objective and gradient function may no longer be modified. A model creates a directory storing logged information throughout the model life. The model's directory is found relative to the user's current working directory, identified by the models name used as the relative portion of the directory path.
Interface
BlockOpt.name
— Functionname(m::Model)
Access the name associated with model m
, as assigned during the construction of m
.
BlockOpt.objective
— Functionobjective(m::Model)
The objective function of model m
, having an unassigned default value of missing
.
See objective!
to load a model's objective.
BlockOpt.gradient
— Functiongradient(m::Model)
The gradient function of model m
, having an unassigned default value of missing
.
See gradient!
to load a m
's gradient.
BlockOpt.initial_iterate
— Functioninitial_iterate(m::Model)
The initial iterate of model m
, having an unassigned default value of missing
. Setting the initial iterate of a model assigns the model a dimension.
See initial_iterate!
to load m
's starting location.
BlockOpt.formula
— Functionformula(m::Model)
The formula of model m
, having an unassigned default value of missing
.
See formula!
to set m
's formula.
BlockOpt.dimension
— Functiondimension(m::Model)
The dimension of model m
which is set by specifying an initial iterate.
See: initial_iterate!
BlockOpt.directory
— Functiondirectory(m::Model)
The directory path of model m
holding information related to m
.
BlockOpt.objective!
— Functionobjective!(m::Model, f)
Assign model m
the objective function f
.
If the model is final, the objective!
call simply returns without modifying the model.
BlockOpt.gradient!
— Functiongradient!(m::Model, ∇f!)
Assign model m
the in-place gradient function ∇f!
, of the form
∇f!(out, x) = (out .= ∇f(x))
where ∇f(x)
is the steepest descent direction at x
in stored the place of the inputed buffer out
.
If the model is final, the gradient!
call simply returns without modifying the model.
BlockOpt.initial_iterate!
— Functioninitial_iterate!(m::Model, x0)
Assign model m
an initial iterate.
BlockOpt.formula!
— Functionformula!(m::Model, f)
Assign model m
an escaped $\LaTeX$ string represents m
's objective function. The formula is used to create visual plots showing a simulation trace of m
.
Example
julia> dot_formila = "$ f(x) = x⋅x $";
julia> formula!(m, dot_formila);
Here, the euclidean squared distance formula now represents m
's objective formula.
BlockOpt.obj
— Functionobj(m::Model, x)
Evaluate the objective function of model m
at x
.
BlockOpt.grad!
— Functiongrad!(m::Model, out, x)
Evaluate the in-place gradient function of model m
at x
, storing the steepest descent direction in the place of the passed input buffer out
.
BlockOpt.hessAD
— FunctionhessAD(m::Model, x)
The dense Hessian matrix of model m
's objective function at the point x
. The computation uses the ForwardDiff.jacobian
forward-mode AD routine on the model's gradient function.
BlockOpt.hess_sample
— Functionhess_sample(m::Model, x, dx)
The hessian vector-product of model m
's objective function at the point x
with the vector dx.
The gHS
routine uses a more effiecient scheme to compute the hessian samples with ForwardDiff's Dual
numbers.