hep.aida.ref.optimizer.fminuit
Class MinuitCommands

java.lang.Object
  extended by org.freehep.math.fminuit.FMinuitCommands
      extended by hep.aida.ref.optimizer.fminuit.MinuitCommands

public class MinuitCommands
extends org.freehep.math.fminuit.FMinuitCommands

Minuit commands.

Author:
Tony Johnson, Victor Serbo, Max Turri, Mark Donszelmann

Field Summary
protected static int DETAILED_OUTPUT
           
protected static int MATRIX_DIAGONAL_APPROX
           
protected static int MATRIX_FULL_ACCURATE
           
protected static int MATRIX_FULL_FORCED_POS
           
protected static int MATRIX_NOT_CALCULATED
          The possible status of the covariance matrix
protected static int MAXIMAL_OUTPUT
           
protected static int MIGRAD_MIN
           
protected static int MINIMAL_OUTPUT
           
protected static int MINIMIZE_MIN
           
protected static int NO_OUTPUT
          The printout levels for the minimizer output are the following:
protected static int NORMAL_OUTPUT
           
protected static int SIMPLEX_MIN
          The different types of minimization.
 
Constructor Summary
protected MinuitCommands(MinuitOptimizer theOptimizer)
          Default constructor.
 
Method Summary
protected  double[][] calculateContour(String parName1, String parName2)
          Calculate the Error Matrix in the current configuration.
protected  double[][] calculateContour(String parName1, String parName2, int nPoints)
           
protected  double[][] calculateContour(String parName1, String parName2, int nPoints, double nSigmas)
           
protected  void fixVariable(String varName)
           
protected  double[][] getCovarianceMatrix()
           
protected  double getErrorDef()
          Get the value of UP, the errorDefinition.
protected  int getNVariables()
          Get the number of (released) variables in the minimization.
protected  int getStatus()
          Get the status of the fit.
protected  void loadAndInitialize()
           
protected  void minos()
          Perform the Minos error analysis on the specified variables.
protected  void optimize(String method, int maxIterations, double tolerance)
          Minimize the function.
protected  void resetMinuit()
          Reset Minuit.
protected  void setErrorDef(int errDef)
          Set the Error Definition, the Minuit UP value.
protected  void setErrorDefinition(double errDef)
           
protected  void setFunction(hep.aida.IFunction function, MinuitOptimizer optimizer)
          Set the function to be minimized.
protected  void setPrecision(double precision)
          Informs Minuit on the machin precision.
 void setPrintLevel(int printLevel)
           
protected  void setStrategy(int strategy)
          Set the strategy to be used in calculating the first and second derivative and in certain optimization methods.
protected  void setUseFunctionGradient(boolean useFunctionGradient)
          Tell Minuit if the derivatives provided by the function are to be used.
protected  void updateFunction(MinuitOptimizer optimizer)
           
 
Methods inherited from class org.freehep.math.fminuit.FMinuitCommands
evaluateDerivatives, evaluateFunction, finalizeFunction, initializeFunction, jmncont, jmnemat, jmnerrs, jmnexcm, jmninit, jmnparm, jmnpout, jmnseti, jmnstat, loadAndInitialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MATRIX_NOT_CALCULATED

protected static final int MATRIX_NOT_CALCULATED
The possible status of the covariance matrix

See Also:
Constant Field Values

MATRIX_DIAGONAL_APPROX

protected static final int MATRIX_DIAGONAL_APPROX
See Also:
Constant Field Values

MATRIX_FULL_FORCED_POS

protected static final int MATRIX_FULL_FORCED_POS
See Also:
Constant Field Values

MATRIX_FULL_ACCURATE

protected static final int MATRIX_FULL_ACCURATE
See Also:
Constant Field Values

NO_OUTPUT

protected static final int NO_OUTPUT
The printout levels for the minimizer output are the following:

See Also:
Constant Field Values

MINIMAL_OUTPUT

protected static final int MINIMAL_OUTPUT
See Also:
Constant Field Values

NORMAL_OUTPUT

protected static final int NORMAL_OUTPUT
See Also:
Constant Field Values

DETAILED_OUTPUT

protected static final int DETAILED_OUTPUT
See Also:
Constant Field Values

MAXIMAL_OUTPUT

protected static final int MAXIMAL_OUTPUT
See Also:
Constant Field Values

SIMPLEX_MIN

protected static final int SIMPLEX_MIN
The different types of minimization.

See Also:
Constant Field Values

MIGRAD_MIN

protected static final int MIGRAD_MIN
See Also:
Constant Field Values

MINIMIZE_MIN

protected static final int MINIMIZE_MIN
See Also:
Constant Field Values
Constructor Detail

MinuitCommands

protected MinuitCommands(MinuitOptimizer theOptimizer)
Default constructor.

Method Detail

loadAndInitialize

protected void loadAndInitialize()

setPrintLevel

public void setPrintLevel(int printLevel)
                   throws IllegalArgumentException
Throws:
IllegalArgumentException

resetMinuit

protected void resetMinuit()
Reset Minuit.


setFunction

protected void setFunction(hep.aida.IFunction function,
                           MinuitOptimizer optimizer)
Set the function to be minimized. When setting a new function the minimizer is cleared of previous information.

Parameters:
function - The function to be minimized.

updateFunction

protected void updateFunction(MinuitOptimizer optimizer)

fixVariable

protected void fixVariable(String varName)

getStatus

protected int getStatus()
Get the status of the fit.

Returns:
The status of the fit based on the current status of the covariance matrix.

getNVariables

protected int getNVariables()
Get the number of (released) variables in the minimization.

Returns:
The number of variables in the minimization.

getErrorDef

protected double getErrorDef()
Get the value of UP, the errorDefinition.

Returns:
The number of UP.

setErrorDef

protected void setErrorDef(int errDef)
Set the Error Definition, the Minuit UP value. Minuit defines variable's errors as the change in the variable's value required to change the function value by the Error Definition (UP). For chiSquared fits UP=1, for negative log likelihood UP=0.5.

Parameters:
errDef - The new value for the Error Definition

setErrorDefinition

protected void setErrorDefinition(double errDef)

setUseFunctionGradient

protected void setUseFunctionGradient(boolean useFunctionGradient)
Tell Minuit if the derivatives provided by the function are to be used.


setStrategy

protected void setStrategy(int strategy)
Set the strategy to be used in calculating the first and second derivative and in certain optimization methods. It determines the reliability of the calculation as it changes the number of allowed function calls.


setPrecision

protected void setPrecision(double precision)
Informs Minuit on the machin precision.


optimize

protected void optimize(String method,
                        int maxIterations,
                        double tolerance)
Minimize the function.

Parameters:
method - The optimization method. It can be: - SIMPLEX performs a minimixation using the simplex method of Nedler and Mead. The minimization will stop after maxIter call have been performed or when the EDM is less than the tolerance (default is 0.1*UP) - MIGRAD The default minimization using the Migrad method. maxIter is the (optional) maximum amount of iterations; when this is reached the minimization will stopped even if it did not converge. The minimization converges when the EDM is less than 0.001*tolerance*UP. - MINIMIZE It starts by using the MIGRAD minimization; it this does not converge it switches to the SIMPLEX method. - IMPROVE If a previous minimization has converged and the function is in and optimal solution, it searches for additional global optimal points. The calculation will be stopped after maxIterations calls. - SEEK Causes a Monte Carlo minimization of the function, by choosing uniformely random values of the variables in an hypercube centered in the current variable values. The size of the hypercube is specified by the value of tolerance.
maxIterations - The maximum amount of allowed iterations.
tolerance - The tolerance for the minimization.

minos

protected void minos()
Perform the Minos error analysis on the specified variables. param maxIter The maximum number of iterations allowed. param vars The list of variables whose errors are to be recalculated. return true if the command was successfull; false otherwise. Check the status of the minimization to know what went wrong.


calculateContour

protected double[][] calculateContour(String parName1,
                                      String parName2)
Calculate the Error Matrix in the current configuration.

Returns:
true if the error matrix was calculated successfully. false otherwise.

calculateContour

protected double[][] calculateContour(String parName1,
                                      String parName2,
                                      int nPoints)

calculateContour

protected double[][] calculateContour(String parName1,
                                      String parName2,
                                      int nPoints,
                                      double nSigmas)

getCovarianceMatrix

protected double[][] getCovarianceMatrix()


Copyright © 2000-2007 FreeHEP. All Rights Reserved.