Class LineMultiOptimizer

Direct Known Subclasses:
ConjugateGradientMultiOptimizer, PowellMultiOptimizer

public abstract class LineMultiOptimizer extends MultiOptimizer
Abstract class to search for a local minimum on a multidimensional function along a given line of input parameters. Line minimization implementations exist such as Powell's method or conjugate gradients. Among those, usually conjugate gradients provide faster convergence because search directions during the estimation don't need to be perpendicular.
  • Field Details

    • p

      protected double[] p
      n-dimensional point containing a minimum in a given line.
    • xi

      protected double[] xi
      Direction to make the search.
    • n

      private int n
      Number of dimensions on function being evaluated.
    • evaluator

      private DirectionalEvaluator evaluator
      Class in charge of evaluating a function through a given line.
    • brent

      private BrentSingleOptimizer brent
      Internal optimizer to find a minimum of a function along a line of input values. Hence, input is converted to a single dimension using a DirectionalEvaluator.
  • Constructor Details

    • LineMultiOptimizer

      protected LineMultiOptimizer()
      Empty constructor.
    • LineMultiOptimizer

      protected LineMultiOptimizer(MultiDimensionFunctionEvaluatorListener listener)
      Constructor.
      Parameters:
      listener - Listener to evaluate a multi-dimension function.
    • LineMultiOptimizer

      protected LineMultiOptimizer(MultiDimensionFunctionEvaluatorListener listener, double[] point, double[] direction)
      Constructor.
      Parameters:
      listener - Listener to evaluate a multi-dimension function.
      point - Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.
      direction - Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.
      Throws:
      IllegalArgumentException - Raised if provided point and direction don't have the same length.
  • Method Details

    • isStartPointAvailable

      public boolean isStartPointAvailable()
      Returns boolean indicating whether start point has already been provided and is ready for retrieval.
      Returns:
      True if available, false otherwise.
    • getStartPoint

      public double[] getStartPoint() throws NotAvailableException
      Returns start point where algorithm will be started. Start point should be close to the local minimum to be found.
      Returns:
      Start point where algorithm will be started.
      Throws:
      NotAvailableException - Raised if start point has not yet been provided and is not available.
    • isDirectionAvailable

      public boolean isDirectionAvailable()
      Returns boolean indicating whether direction has already been provided and is ready for retrieval.
      Returns:
      True if available, false otherwise.
    • getDirection

      public double[] getDirection() throws NotAvailableException
      Returns direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.
      Returns:
      Direction to start looking for a minimum.
      Throws:
      NotAvailableException - Raised if direction has not yet been provided and is not available.
    • setStartPointAndDirection

      public void setStartPointAndDirection(double[] point, double[] direction) throws LockedException
      Internal method to set start point and direction to start the search for a local minimum.
      Parameters:
      point - Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.
      direction - Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.
      Throws:
      LockedException - Raised if this instance is locked.
      IllegalArgumentException - Raised if provided point and direction don't have the same length.
    • isReady

      public boolean isReady()
      Returns boolean indicating whether this instance is considered to be ready to start the estimation of a minimum. This instance is considered to be ready once a listener, start point and direction are provided.
      Overrides:
      isReady in class MultiOptimizer
      Returns:
      True if this instance is ready, false otherwise.
    • linmin

      protected double linmin()
      Searches for a minimum along a given line of input values. The line being searched is obtained by using a start point and direction.
      Returns:
      Returns function evaluation at minimum that has been found.
    • internalSetStartPointAndDirection

      private void internalSetStartPointAndDirection(double[] point, double[] direction)
      Internal method to set start point and direction to start the search for a local minimum. This method does not check whether this instance is locked.
      Parameters:
      point - Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.
      direction - Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.
      Throws:
      IllegalArgumentException - Raised if provided point and direction don't have the same length.