Class Minimizer


  • public class Minimizer
    extends java.lang.Object

    This class encapsulates the running of Powell's Method on a given function in order to determine a local minimum.

    The function to be minimized can have a domain of any dimension as it takes an array of doubles and returns the value that needs to be minimized.

    For example, to minimize the function (x - 2)^2 - 3 you would:

     {
         @code
         final Minimizer m = new Minimizer(x -> ((x[0] - 2.0) * (x[0] - 2.0)) - 3.0);
         final double minVal = m.minimize(new double[] {-45.0});
         final double minParam = m.getFinalPostion()[0];
     }
     
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Minimizer.FinalPosition  
      static interface  Minimizer.Func
      Interface representing the function/lambda to be minimized.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double ftol
      Default float tolerance.
    • Constructor Summary

      Constructors 
      Constructor Description
      Minimizer​(Minimizer.Func f)
      Construct the minimizer with the function to be minimized.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[] getFinalPostion()
      Return the final domain value of the minimized solution.
      double minimize​(double[] p)
      Minimize the function that the Minimizer was instantiated with using the identity matrix as the starting position.
      double minimize​(double[] p, double[][] xi)
      Minimize the function that the Minimizer was instantiated with using the supplied starting position.
      static Minimizer.FinalPosition minimize​(Minimizer.Func functionToMinimize, double[] startingPosition)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • ftol

        public static double ftol
        Default float tolerance.
    • Constructor Detail

      • Minimizer

        public Minimizer​(Minimizer.Func f)
        Construct the minimizer with the function to be minimized.
    • Method Detail

      • getFinalPostion

        public double[] getFinalPostion()
        Return the final domain value of the minimized solution.