parameterrules
Class ParameterRule

java.lang.Object
  extended byparameterrules.ParameterRule
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
BoundaryRule, DimerHalfMaxRule, LessThanRule, MultiplyParameterRule, ProductBetweenRule, RatioBetweenRule

public class ParameterRule
extends java.lang.Object
implements java.lang.Cloneable


Field Summary
protected  int numParams
           
protected  int[] paramNums
           
 
Method Summary
 boolean changeParameters(float[] params, int mode, ParameterSet set)
          This method should change parameters so that they conform to this rule.
 ParameterRule copy()
           
 float getFuzzyScore(float[] params)
          This method should return 0 if the parameters in the input set pass the criteria in this rule.
 void init(ParameterSet params)
          Initializes refParam to point to a parameter set which will be used as reference herein.
 boolean isGood(float[] params)
          Returns true if the parameters in the input set meet the criteria for this rule, false otherwise.
protected  void loadParameter(java.lang.String info, BetterTokenizer tokenizer)
          Override this function for each parameter rule to load in setup info specific to that rule.
 void loadParameters(BetterTokenizer tokenizer)
          The main method for loading paramaters from a stream.
protected  void pickNewParameterValue(float[] params, int change_param, float min, float max, int mode, ParameterSet set)
          Picks a new parameter value in the range min to max.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

paramNums

protected int[] paramNums

numParams

protected int numParams
Method Detail

init

public void init(ParameterSet params)
Initializes refParam to point to a parameter set which will be used as reference herein. Usually the rule should be initialized with the parameter set of an iterator. Only override this if there is some special initialization required by a sub-class.


copy

public ParameterRule copy()

isGood

public boolean isGood(float[] params)
Returns true if the parameters in the input set meet the criteria for this rule, false otherwise. The default implementation calls getFuzzyScore() and returns true if the value was <= 0, false otherwise. Most parameter rules should only override getFuzzyScore and leave getGood() alone.

Parameters:
params - The values of all the parameters in the reference parameter set. The params array and the reference parameter set need to match one-to-one.

getFuzzyScore

public float getFuzzyScore(float[] params)
This method should return 0 if the parameters in the input set pass the criteria in this rule. Otherwise it should return a positive number whose magnitude gets larger as the parameter set gets farther from satisfying this rule.

Parameters:
params - The values of all the parameters in the reference parameter set. The params array and the reference parameter set need to match one-to-one.

changeParameters

public boolean changeParameters(float[] params,
                                int mode,
                                ParameterSet set)
This method should change parameters so that they conform to this rule. If the parameters matched the rule without any changes, this method should return true. Otherwise, return false.

Parameters:
params - The values of all the parameters in the reference parameter set. The params array and the reference parameter set need to match one-to-one.

pickNewParameterValue

protected void pickNewParameterValue(float[] params,
                                     int change_param,
                                     float min,
                                     float max,
                                     int mode,
                                     ParameterSet set)
Picks a new parameter value in the range min to max. Both min and max are checked against the standard range for this parameter and adjusted if neccesary. The method picks from either a linear or logarithmic distribution as appropriate for that parameter. This basically encapsulates picking a new value for a parameter in a way that many (but perhaps not all) parameter rules can use rather than rewriting the code each time.
Note that change_param is an index into paramNums, not an index directly to lists of parameters.


loadParameters

public void loadParameters(BetterTokenizer tokenizer)
                    throws java.lang.Exception
The main method for loading paramaters from a stream. You shouldn't ever need to change this. Instead, override loadParameter

Throws:
java.lang.Exception

loadParameter

protected void loadParameter(java.lang.String info,
                             BetterTokenizer tokenizer)
                      throws java.lang.Exception
Override this function for each parameter rule to load in setup info specific to that rule. You can use the refParam to look up the positions of any model parameters you load. The default method will load parameters with the @Param tag and put the parameter numbers into the paramNums array.

Throws:
java.lang.Exception