public class WolfeNWLineSearch extends Object implements LineSearch
Modifier and Type | Class and Description |
---|---|
static class |
WolfeNWLineSearch.AlphaInit |
Constructor and Description |
---|
WolfeNWLineSearch()
|
WolfeNWLineSearch(double c1,
double c2)
Creates a new Wolfe line search
|
Modifier and Type | Method and Description |
---|---|
WolfeNWLineSearch |
clone()
Returns a clone of the line search object
|
double |
getC1()
Returns the sufficient decrease condition constant
|
double |
getC2()
Returns the curvature 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)
This value must always be less than setC2(double) |
void |
setC2(double c2)
Sets the constant used for the curvature condition
pT ∇f(x+α p) ≥ c2 pT∇f(x)
|
boolean |
updatesGrad()
When performing the
linear search
step some line searches may or may not use the gradient information. |
public WolfeNWLineSearch()
public WolfeNWLineSearch(double c1, double c2)
c1
- the sufficient decrease condition constantc2
- the curvature condition constantpublic void setC1(double c1)
setC2(double)
c1
- the sufficient decrease conditionpublic double getC1()
public void setC2(double c2)
c2
- the curvature condition constantpublic double getC2()
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 WolfeNWLineSearch clone()
LineSearch
clone
in interface LineSearch
clone
in class Object
Copyright © 2017. All rights reserved.