Class Line

Implementation of a line minimizer algorithm

The Line class optimizes a set of parameters for a function such that the gradient projected onto a gradient-direction will be minimized. I.e. it finds the minimum of a function on a gradient line such that the true gradient is orthogonal to the direction.

A simple implementation of a line minimizer. This line-minimization algorithm may use any (default to LBFGS) optimizer and will optimize a given direction by projecting the gradient onto an initial gradient direction.

Usage:

    line0 = Line()
    -- The default direction will be the gradient passed for in the
    -- first `optimize` call.
    line0:optimize(F, G)
    
    line1 = Line{optimizer = flos.LBFGS{}}
    -- This is equivalent to the above case, but we explicitly define
    -- the minimization direction, and the optimizer.
    line1:set_direction(F, G)
    line1:optimize(F, G)
    

Methods

Line:new ([direction[, optimizer=`LBFGS`]]) Instantiating a new Line object

The parameters must be specified with a table of fields and values.

Line:set_direction (F, G) Define the gradient direction we should minimize, with the accompanying initial parameters.
Line:reset () Reset the Line algorithm by resetting the direction
Line:optimized ([G]) Query whether the line minimization method has been optimized The input gradient will be projected onto the direction before the optimization will be checked.
Line:optimize (F, G) Calculates the next parameter set such that the gradient is minimized along the direction.
Line:projection (G) Return a gradient projected onto the internal specified direction
Line:SIESTA (siesta) SIESTA function for performing a complete SIESTA line optimization.
Line:info () Print information regarding the Line algorithm


Methods

Line:new ([direction[, optimizer=`LBFGS`]])
Instantiating a new Line object

The parameters must be specified with a table of fields and values. In addition to the parameters indicated.

Parameters:

  • direction Array the line direction (defaults to the first optimization gradient that Line gets called with) (optional)
  • optimizer Optimizer the optimization method used to minimize along the direction (defaults to the LBFGS optimizer) (default `LBFGS`)

See also:

Usage:

    Line{<field1 = value>, <field2 = value>}
Line:set_direction (F, G)
Define the gradient direction we should minimize, with the accompanying initial parameters.

Parameters:

  • F Array the initial parameters
  • G Array the direction to be sampled
Line:reset ()
Reset the Line algorithm by resetting the direction
Line:optimized ([G])
Query whether the line minimization method has been optimized The input gradient will be projected onto the direction before the optimization will be checked.

Parameters:

  • G Array input gradient (optional)

Returns:

    whether the line minimization has been minimized
Line:optimize (F, G)
Calculates the next parameter set such that the gradient is minimized along the direction.

If the internal gradient direction has not been initialized the first gradient will be chosen as the direction, @see set_direction.

Parameters:

  • F Array input parameters for the function
  • G Array gradient for the function with the parameters F

Returns:

    a new set of optimized coordinates
Line:projection (G)
Return a gradient projected onto the internal specified direction

Parameters:

  • G Array the input gradient

Returns:

    G projected onto the internal gradient direction
Line:SIESTA (siesta)
SIESTA function for performing a complete SIESTA line optimization.

This function will query these fdf-flags from SIESTA:

  • MD.MaxForceTol
  • MD.MaxCGDispl

and use those as the tolerance for convergence as well as the maximum displacement for each optimization step.

Everything else is controlled by the Line object.

Note that all internal operations in this function relies on units being in - Ang - eV - eV/Ang

Parameters:

  • siesta table the SIESTA global table.
Line:info ()
Print information regarding the Line algorithm
generated by LDoc 1.4.6 Last updated 2019-05-23 08:36:38