public class BacktrackingArmijoLineSearch extends Object implements LineSearch
Constructor and Description |
---|
BacktrackingArmijoLineSearch()
Creates a new Backtracking line search
|
BacktrackingArmijoLineSearch(double rho,
double c1)
Creates a new Backtracking line search object
|
Modifier and Type | Method and Description |
---|---|
BacktrackingArmijoLineSearch |
clone()
Returns a clone of the line search object
|
double |
getC1()
Returns the sufficient decrease condition constant
|
double |
lineSearch(double alpha_max,
Vec x_k,
Vec x_grad,
Vec p_k,
Function f,
FunctionVec fp,
double f_x,
double gradP,
Vec x_alpha_pk,
double[] fxApRet,
Vec grad_x_alpha_pk)
Attempts to find the value of α that minimizes
f(x+α p)
|
double |
lineSearch(double alpha_max,
Vec x_k,
Vec x_grad,
Vec p_k,
Function f,
FunctionVec fp,
double f_x,
double gradP,
Vec x_alpha_pk,
double[] fxApRet,
Vec grad_x_alpha_pk,
ExecutorService ex)
Attempts to find the value of α that minimizes
f(x+α p)
|
void |
setC1(double c1)
Sets the constant used for the sufficient decrease condition
f(x+α p) ≤ f(x) + c1 α pT∇f(x)
|
boolean |
updatesGrad()
When performing the
linear search
step some line searches may or may not use the gradient information. |
public BacktrackingArmijoLineSearch()
public BacktrackingArmijoLineSearch(double rho, double c1)
rho
- constant to decrease alpha by in (0, 1) when interpolation is
not possiblec1
- the sufficient decrease condition condition constant in
(0, 1/2)public void setC1(double c1)
c1
- the sufficient decrease conditionpublic double getC1()
public double lineSearch(double alpha_max, Vec x_k, Vec x_grad, Vec p_k, Function f, FunctionVec fp, double f_x, double gradP, Vec x_alpha_pk, double[] fxApRet, Vec grad_x_alpha_pk)
LineSearch
lineSearch
in interface LineSearch
alpha_max
- the maximum value for α to search forx_k
- the initial value to search fromx_grad
- the gradient of ∇ f(xk)p_k
- the direction updatef
- the function to minimize the value of
f(xk + α pk)fp
- the gradient of f, ∇f(x), may be null
depending
upon the linesearch methodf_x
- the value of f(xk), or Double.NaN
if it needs to be computedgradP
- the value of ∇f(xk)Tpk,
or Double.NaN
if it needs to be computedx_alpha_pk
- the location to store the value of
xk + α pkfxApRet
- an array to store the computed result of
f(xk + α pk) in the first index
contain. May be null
and the value will not be returnedgrad_x_alpha_pk
- location to store the value of ∇ f(xkα+pk). May be null
, local storage will be allocated if neededpublic double lineSearch(double alpha_max, Vec x_k, Vec x_grad, Vec p_k, Function f, FunctionVec fp, double f_x, double gradP, Vec x_alpha_pk, double[] fxApRet, Vec grad_x_alpha_pk, ExecutorService ex)
LineSearch
lineSearch
in interface LineSearch
alpha_max
- the maximum value for α to search forx_k
- the initial value to search fromx_grad
- the gradient of ∇ f(xk)p_k
- the direction updatef
- the function to minimize the value of
f(xk + α pk)fp
- the gradient of f, ∇f(x), may be null
depending
upon the linesearch methodf_x
- the value of f(xk), or Double.NaN
if it needs to be computedgradP
- the value of ∇f(xk)Tpk,
or Double.NaN
if it needs to be computedx_alpha_pk
- the location to store the value of
xk + α pkfxApRet
- an array to store the computed result of
f(xk + α pk) in the first index
contain. May be null
and the value will not be returnedgrad_x_alpha_pk
- location to store the value of ∇ f(xkα+pk). May be null
, local storage will be allocated if neededex
- the source of threads for parallel computation, or null
to perform serial computationpublic boolean updatesGrad()
LineSearch
linear search
step some line searches may or may not use the gradient information. If
the gradient information is used and updated, this method will return
true
. If not the given vector will be unused and not updated, and
this method will return false
updatesGrad
in interface LineSearch
true
if the grad_x_alpha_pk
parameter of
lineSearch will be up-to-date after the call, or false
if the
gradient value will need to be computed after.public BacktrackingArmijoLineSearch clone()
LineSearch
clone
in interface LineSearch
clone
in class Object
Copyright © 2017. All rights reserved.