## org.apache.commons.math.optimization.direct
Class PowellOptimizer

    java.lang.Object
      org.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer
          org.apache.commons.math.optimization.direct.PowellOptimizer

All Implemented Interfaces:
  DifferentiableMultivariateRealOptimizer

    public class PowellOptimizer

extends AbstractScalarDifferentiableOptimizer

Powell algorithm. This code is translated and adapted from the Python version of this algorithm (as implemented in module `optimize.py` v0.5 of SciPy).

Since:
  2.2
Version:
  $Revision$ $Date$

Nested Class Summary
`private class` `PowellOptimizer.LineSearch` Class for finding the minimum of the objective function along a given direction.

Field Summary
`static double` `DEFAULT_LS_ABSOLUTE_TOLERANCE` Default absolute tolerance for line search (1.0E-11).
`static double` `DEFAULT_LS_RELATIVE_TOLERANCE` Default relative tolerance for line search (1.0E-7).
`private PowellOptimizer.LineSearch` `line` Line search.

Fields inherited from class org.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer
`checker, DEFAULT_MAX_ITERATIONS, goal, point`

Constructor Summary
`PowellOptimizer()` Constructor with default line search tolerances (see the `other constructor`).
`PowellOptimizer(double lsRelativeTolerance)` Constructor with default absolute line search tolerances (see the `other constructor`).
`PowellOptimizer(double lsRelativeTolerance, double lsAbsoluteTolerance)`

Method Summary
`private double[]` `copyOf(double[] source, int newLen)` Java 1.5 does not support Arrays.copyOf()
`protected RealPointValuePair` `doOptimize()` Perform the bulk of optimization algorithm.
`private double[][]` `newPointAndDirection(double[] p, double[] d, double optimum)` Compute a new point (in the original space) and a new direction vector, resulting from the line search.

Methods inherited from class org.apache.commons.math.optimization.general.AbstractScalarDifferentiableOptimizer
`computeObjectiveGradient, computeObjectiveValue, getConvergenceChecker, getEvaluations, getGradientEvaluations, getIterations, getMaxEvaluations, getMaxIterations, incrementIterationsCounter, optimize, setConvergenceChecker, setMaxEvaluations, setMaxIterations`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_LS_RELATIVE_TOLERANCE

    public static final double DEFAULT_LS_RELATIVE_TOLERANCE

  Default relative tolerance for line search (1.0E-7).

  See Also:
    Constant Field Values

### DEFAULT_LS_ABSOLUTE_TOLERANCE

    public static final double DEFAULT_LS_ABSOLUTE_TOLERANCE

  Default absolute tolerance for line search (1.0E-11).

  See Also:
    Constant Field Values

### line

    private final PowellOptimizer.LineSearch line

  Line search.

Constructor Detail

### PowellOptimizer

    public PowellOptimizer()

  Constructor with default line search tolerances (see the `other constructor`).

### PowellOptimizer

    public PowellOptimizer(double lsRelativeTolerance)

  Constructor with default absolute line search tolerances (see the `other constructor`).

  Parameters:
    `lsRelativeTolerance` - Relative error tolerance for the line search algorithm (`BrentOptimizer`).

### PowellOptimizer

    public PowellOptimizer(double lsRelativeTolerance,
                           double lsAbsoluteTolerance)

Parameters:
  `lsRelativeTolerance` - Relative error tolerance for the line search algorithm (`BrentOptimizer`).
  `lsAbsoluteTolerance` - Relative error tolerance for the line search algorithm (`BrentOptimizer`).

Method Detail

### doOptimize

    protected RealPointValuePair doOptimize()
                                     throws FunctionEvaluationException,
                                            OptimizationException

  Perform the bulk of optimization algorithm.

  Specified by:
    `doOptimize` in class `AbstractScalarDifferentiableOptimizer`
  Returns:
    the point/value pair giving the optimal value for objective function
  Throws:
    `FunctionEvaluationException` - if the objective function throws one during the search
    `OptimizationException` - if the algorithm failed to converge

### newPointAndDirection

    private double[][] newPointAndDirection(double[] p,
                                            double[] d,
                                            double optimum)

  Compute a new point (in the original space) and a new direction vector, resulting from the line search. The parameters `p` and `d` will be changed in-place.

  Parameters:
    `p` - Point used in the line search.
    `d` - Direction used in the line search.
    `optimum` - Optimum found by the line search.
  Returns:
    a 2-element array containing the new point (at index 0) and the new direction (at index 1).

### copyOf

    private double[] copyOf(double[] source,
                            int newLen)

  Java 1.5 does not support Arrays.copyOf()

  Parameters:
    `source` - the array to be copied
    `newLen` - the length of the copy to be returned
  Returns:
    the copied array, truncated or padded as necessary.

Copyright (c) 2003-2013 Apache Software Foundation