jsat.math.optimization
Class BacktrackingArmijoLineSearch
- java.lang.Object
-
- jsat.math.optimization.BacktrackingArmijoLineSearch
-
- All Implemented Interfaces:
- LineSearch
public class BacktrackingArmijoLineSearch extends java.lang.Object implements LineSearch
An implementation of Backtraking line search using the Armijo rule. The search for alpha is done by quadratic and cubic interpolation without using any derivative evaluations.
-
-
Constructor Summary
Constructors Constructor and Description BacktrackingArmijoLineSearch()Creates a new Backtracking line searchBacktrackingArmijoLineSearch(double rho, double c1)Creates a new Backtracking line search object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description BacktrackingArmijoLineSearchclone()Returns a clone of the line search objectdoublegetC1()Returns the sufficient decrease condition constantdoublelineSearch(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, boolean parallel)Attempts to find the value of α that minimizes f(x+α p)voidsetC1(double c1)Sets the constant used for the sufficient decrease condition f(x+α p) ≤ f(x) + c1 α pT∇f(x)booleanupdatesGrad()When performing thelinear searchstep some line searches may or may not use the gradient information.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jsat.math.optimization.LineSearch
lineSearch
-
-
-
-
Constructor Detail
-
BacktrackingArmijoLineSearch
public BacktrackingArmijoLineSearch()
Creates a new Backtracking line search
-
BacktrackingArmijoLineSearch
public BacktrackingArmijoLineSearch(double rho, double c1)Creates a new Backtracking line search object- Parameters:
rho- constant to decrease alpha by in (0, 1) when interpolation is not possiblec1- the sufficient decrease condition condition constant in (0, 1/2)
-
-
Method Detail
-
setC1
public void setC1(double c1)
Sets the constant used for the sufficient decrease condition f(x+α p) ≤ f(x) + c1 α pT∇f(x)- Parameters:
c1- the sufficient decrease condition
-
getC1
public double getC1()
Returns the sufficient decrease condition constant- Returns:
- the sufficient decrease condition constant
-
lineSearch
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, boolean parallel)Description copied from interface:LineSearchAttempts to find the value of α that minimizes f(x+α p)- Specified by:
lineSearchin interfaceLineSearch- Parameters:
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 benulldepending upon the line search methodf_x- the value of f(xk), orDouble.NaNif it needs to be computedgradP- the value of ∇f(xk)Tpk, orDouble.NaNif 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 benulland the value will not be returnedgrad_x_alpha_pk- location to store the value of ∇ f(xkα+pk). May benull, local storage will be allocated if neededparallel-trueif this line search should be done using multiple cores, orfalseto be single threaded.- Returns:
- the value of α that satisfies the line search in minimizing f(xk + α pk)
-
updatesGrad
public boolean updatesGrad()
Description copied from interface:LineSearchWhen performing thelinear searchstep some line searches may or may not use the gradient information. If the gradient information is used and updated, this method will returntrue. If not the given vector will be unused and not updated, and this method will returnfalse- Specified by:
updatesGradin interfaceLineSearch- Returns:
trueif thegrad_x_alpha_pkparameter of lineSearch will be up-to-date after the call, orfalseif the gradient value will need to be computed after.
-
clone
public BacktrackingArmijoLineSearch clone()
Description copied from interface:LineSearchReturns a clone of the line search object- Specified by:
clonein interfaceLineSearch- Overrides:
clonein classjava.lang.Object- Returns:
- a clone of the line search object
-
-
DataMelt 3.0 © DataMelt by jWork.ORG