public class LBFGS extends Object implements Optimizer2
BFGS
. It uses a
history of m
items to solve n
dimension problems
with O(m n)
work per iteration.Constructor and Description |
---|
LBFGS()
Creates a new L-BFGS optimization object that uses a maximum of 500
iterations and a
Backtracking line
search. |
LBFGS(int m)
Creates a new L-BFGS optimization object that uses a maximum of 500
iterations and a
Backtracking line
search. |
LBFGS(int m,
int maxIterations,
LineSearch lineSearch)
Creates a new L-BFGS optimization object
|
Modifier and Type | Method and Description |
---|---|
LBFGS |
clone() |
LineSearch |
getLineSearch()
Returns the line search method used at each iteration
|
int |
getM()
Returns the number of history items that will be used
|
int |
getMaximumIterations()
Returns the maximum number of iterations to perform
|
boolean |
isInftNormCriterion()
Returns whether or not the infinity norm (
true ) or 2 norm
(false ) is used to determine convergence. |
void |
optimize(double tolerance,
Vec w,
Vec x0,
Function f,
FunctionVec fp,
FunctionVec fpp)
Attempts to optimize the given function by finding the value of
w
that will minimize the value returned by f(w) , using
w = x0 as an initial starting point. |
void |
optimize(double tolerance,
Vec w,
Vec x0,
Function f,
FunctionVec fp,
FunctionVec fpp,
ExecutorService ex)
Attempts to optimize the given function by finding the value of
w
that will minimize the value returned by f(w) , using
w = x0 as an initial starting point. |
void |
setInftNormCriterion(boolean inftNormCriterion)
By default the infinity norm is used to judge convergence.
|
void |
setLineSearch(LineSearch lineSearch)
Sets the line search method used at each iteration
|
void |
setM(int m)
Sets the number of history items to keep that are used to approximate the
Hessian of the problem
|
void |
setMaximumIterations(int iterations)
Sets the maximum number of iterations allowed for the optimization method
|
static void |
twoLoopHp(Vec x_grad,
List<Double> rho,
List<Vec> s,
List<Vec> y,
Vec q,
double[] alphas)
See Algorithm 7.4 (L-BFGS two-loop recursion).
|
public LBFGS()
Backtracking
line
search. A history
of 10 items will be usedpublic LBFGS(int m)
Backtracking
line
search.m
- the number of history itemspublic LBFGS(int m, int maxIterations, LineSearch lineSearch)
m
- the number of history itemsmaxIterations
- the maximum number of iterations before stoppinglineSearch
- the line search method to use for optimizationpublic static void twoLoopHp(Vec x_grad, List<Double> rho, List<Vec> s, List<Vec> y, Vec q, double[] alphas)
x_grad
- the initial value ∇ fkrho
- s
- y
- q
- the location to store the value of Hk ∇ fkalphas
- temp space to do work, should be as large as the number of history vectorspublic void optimize(double tolerance, Vec w, Vec x0, Function f, FunctionVec fp, FunctionVec fpp)
Optimizer2
w
that will minimize the value returned by f(w)
, using
w = x0 as an initial starting point.optimize
in interface Optimizer2
tolerance
- the value that the gradient norm must be less than to
consider convergedw
- the the location to store the final solutionx0
- the initial guess for the solution. This value will not be
changed, and intermediate matrices will be created as the same type.f
- the objective function to minimizerfp
- the derivative of the objective function, may be null
depending on the optimizerfpp
- the Hessian of the objective function, may be null
depending on the optimizerpublic void optimize(double tolerance, Vec w, Vec x0, Function f, FunctionVec fp, FunctionVec fpp, ExecutorService ex)
Optimizer2
w
that will minimize the value returned by f(w)
, using
w = x0 as an initial starting point.optimize
in interface Optimizer2
tolerance
- the value that the gradient norm must be less than to
consider convergedw
- the the location to store the final solutionx0
- the initial guess for the solution. This value will not be
changed, and intermediate matrices will be created as the same type.f
- the objective function to minimizerfp
- the derivative of the objective function, may be null
depending on the optimizerfpp
- the Hessian of the objective function, may be null
depending on the optimizerex
- the source of threads for parallel computation, may be
null
to perform serial computation.public void setInftNormCriterion(boolean inftNormCriterion)
false
, the 2 norm will be used instead.inftNormCriterion
- public boolean isInftNormCriterion()
true
) or 2 norm
(false
) is used to determine convergence.true
if the infinity norm is in use, false
for
the 2 normpublic void setM(int m)
m
- the number of history items to keeppublic int getM()
public void setLineSearch(LineSearch lineSearch)
lineSearch
- the line search method used at each iterationpublic LineSearch getLineSearch()
public void setMaximumIterations(int iterations)
Optimizer2
setMaximumIterations
in interface Optimizer2
iterations
- the maximum number of iterations to performpublic int getMaximumIterations()
Optimizer2
getMaximumIterations
in interface Optimizer2
public LBFGS clone()
clone
in interface Optimizer2
clone
in class Object
Copyright © 2017. All rights reserved.