package hep.aida.ref.optimizer.jminuit;

import hep.aida.ext.IOptimizerConfiguration;
import hep.aida.ext.IOptimizerResult;
import hep.aida.ext.IVariableSettings;
import hep.aida.ref.optimizer.AbstractOptimizer;
import hep.aida.ref.optimizer.OptimizerResult;
import java.util.List;
import java.util.ArrayList;
import org.freehep.math.minuit.FCNBase;
import org.freehep.math.minuit.FunctionMinimum;
import org.freehep.math.minuit.MnMigrad;
import org.freehep.math.minuit.MnUserParameters;
import org.freehep.math.minuit.MnUserCovariance;
import org.freehep.math.minuit.MnContours;
import org.freehep.math.minuit.Point;
/**
 *
 * JMinuit implementation of IOptimizer
 * @author The AIDA team @SLAC.
 *
 */
public class JMinuitOptimizer extends AbstractOptimizer
{
    private FunctionMinimum min;
    private FCNBase fcn;
    private MnUserParameters upar;
    private MnMigrad migrad;
    private ArrayList pars;
    
   public JMinuitOptimizer()
   {
      result = new OptimizerResult();
      this.setConfiguration(new JMinuitConfiguration());
   }
   
    public void optimize()
   {
        
        pars = new ArrayList();
      
      // Load the function in Minuit. This will load all the variables.
      if ( function == null ) throw new IllegalArgumentException("Cannot optimize!! The function was not set correctly!");
      String[] variableNames = function.variableNames();
      if ( variableNames == null || variableNames.length == 0 ) throw new IllegalArgumentException("Cannot optimize!! There are no variable parameters in this function!");
      
      upar = new MnUserParameters();
      for ( int i = 0; i 

Ads help maintain this website.