classifierLibrary
Class Classifier

java.lang.Object
  extended byclassifierLibrary.Classifier
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
StandardClassifier

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

Libary classifierLibrary, Class Classifier

Copyright by Klaus Hufschlag 2004, 2005, 2006

This file is part of the Generic Classifier Library. The Generic Classifier Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Generic Classifier Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Generic Classifier Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Version:
1.4
Author:
Klaus Hufschlag

Constructor Summary
Classifier(Rule r)
          Constructor
 
Method Summary
 double callFunction(java.lang.String which)
          Calls a functional method of the classifier specified by its name (no further parameters).
 java.lang.Object clone()
           
 boolean compatibility(Classifier cl)
          Checks compatibility of instance to another instance.
 double conditionMatchSubsumptive(Situation sit)
          Computes relative degree of a classifiers condition matching a given situation.
 Classifier cross(Classifier cl)
          Returns Classifier as a result of crossing with another classifier, crossing at random position.
 Classifier cross(Classifier cl, int position)
          Returns Classifier that is a result of crossing with another given classifier, crossing at defined position.
 void debug_out()
          Method for debugging-purposes.
 long getID()
          Returns running number of classifier-object for debugging purposes.
 Rule getRule()
          Returns the rule part of the classifier.
 Classifier mutation(double probability)
          Returns mutation of the current classifier.
 void setRule(Rule r)
          Sets rule-part of the classifier to the given rule.
 double size()
          Returns size of the classifiers rule, if situations are defined as sets should be size of the sets.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Classifier

public Classifier(Rule r)
Constructor

Parameters:
r - rule, becoming part of the classifier.
Method Detail

clone

public java.lang.Object clone()

getRule

public Rule getRule()
Returns the rule part of the classifier.

Returns:
the classifier's rule

setRule

public void setRule(Rule r)
Sets rule-part of the classifier to the given rule.

Parameters:
r - rule to be set for the classifier

conditionMatchSubsumptive

public double conditionMatchSubsumptive(Situation sit)
Computes relative degree of a classifiers condition matching a given situation. Uses wildcards.

Parameters:
sit - situation for comparison
Returns:
relative degree of matching

compatibility

public boolean compatibility(Classifier cl)
Checks compatibility of instance to another instance.

Parameters:
cl - Classifier against which compatibility is to be checked.
Returns:
boolean

debug_out

public void debug_out()
Method for debugging-purposes.


cross

public Classifier cross(Classifier cl,
                        int position)
Returns Classifier that is a result of crossing with another given classifier, crossing at defined position. Should be overridden in derived classes to include crossing of additional parameters, should then be called using super.

Parameters:
cl - Classifier to cross with
position - position for crossover
Returns:
Classifier after crossover

cross

public Classifier cross(Classifier cl)

Returns Classifier as a result of crossing with another classifier, crossing at random position.

Parameters:
cl - Classifier tp cross with
Returns:
Classifier after crossover

mutation

public Classifier mutation(double probability)

Returns mutation of the current classifier. Mutation of elements with given probability.

Parameters:
probability - probability of mutation
Returns:
classifier after mutation

getID

public long getID()

Returns running number of classifier-object for debugging purposes.

Returns:
ID of classifier object.

size

public double size()

Returns size of the classifiers rule, if situations are defined as sets should be size of the sets.

Returns:
sit as double

callFunction

public double callFunction(java.lang.String which)

Calls a functional method of the classifier specified by its name (no further parameters). Enables calling sub-class-specific functions even when using objects declared with generic classes.

Parameters:
which - name of function
Returns:
return value of function (numeric only)