gov.sns.tools.optimizer
Class SearchAlgorithm

java.lang.Object
  |
  +--gov.sns.tools.optimizer.SearchAlgorithm
Direct Known Subclasses:
CoordsStepSearchAlgorithm, RandomSearchAlgorithm, SimplexSearchAlgorithm

public abstract class SearchAlgorithm
extends java.lang.Object


Constructor Summary
protected SearchAlgorithm()
          Creates a new instance of SearchAlgorithm
 
Method Summary
protected  boolean accept(double[] coords)
          returns true if all coordinates inside limits and false otherwise.
protected  boolean acceptProxyForFitting(ParameterProxy pr)
          returns true if this ParameterProxy will be used in fitting.
protected abstract  double getBestScore()
          returns the best score after step
protected  java.util.Map getBestSolutionMap()
          returns the best solution map.
 int getNumVariables()
          returns the number of variables.
protected  Scorer getScorer()
          returns the Scorer's instance.
protected abstract  int getType()
          returns the type of the algorithm.
 java.util.List getVariables()
          returns the vector with ParameterProxy instances.
protected  boolean getWantToStop()
          returns true if the algorithm wants to stop.
protected abstract  boolean makeStep()
          make one step in the search.
protected abstract  void reset()
          reset for searching from scratch; forget history
protected  void setScorer(Scorer scorer)
           
protected  void setVariables(java.util.Collection theVariables)
          set the variables to be used in the search
protected  void setWantToStop(boolean st)
          this method is used by Solver to notify the algorithm about its desire to stop.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchAlgorithm

protected SearchAlgorithm()
Creates a new instance of SearchAlgorithm

Method Detail

setScorer

protected final void setScorer(Scorer scorer)

setVariables

protected final void setVariables(java.util.Collection theVariables)
set the variables to be used in the search


getVariables

public final java.util.List getVariables()
returns the vector with ParameterProxy instances.


getNumVariables

public final int getNumVariables()
returns the number of variables.


getScorer

protected final Scorer getScorer()
returns the Scorer's instance.


getBestSolutionMap

protected final java.util.Map getBestSolutionMap()
returns the best solution map. It returns Map with ParameterProxy instances as keys and Double as parameters values.


accept

protected boolean accept(double[] coords)
returns true if all coordinates inside limits and false otherwise. This method could be overridden if it is necessary. By default the upper and lower limits are used to accept or to reject coordinates.


acceptProxyForFitting

protected boolean acceptProxyForFitting(ParameterProxy pr)
returns true if this ParameterProxy will be used in fitting. By default it returns true all the time. To change the response the subclasses should override this method.


setWantToStop

protected final void setWantToStop(boolean st)
this method is used by Solver to notify the algorithm about its desire to stop. It is not appropriate to use this method in subclasses.


getWantToStop

protected final boolean getWantToStop()
returns true if the algorithm wants to stop.


reset

protected abstract void reset()
reset for searching from scratch; forget history


makeStep

protected abstract boolean makeStep()
make one step in the search. It returns ShouldStop boolean.


getBestScore

protected abstract double getBestScore()
returns the best score after step


getType

protected abstract int getType()
returns the type of the algorithm.