classifierLibrary
Class Rule

java.lang.Object
  extended byclassifierLibrary.Rule
All Implemented Interfaces:
java.lang.Cloneable

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

Library classifierLibrary, Class Rule

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
Rule()
          Constructor, creating an empty Rule.
Rule(Situation Condition, Situation Action)
          Constructor with Condition and Action-Part of the rule as parameters.
 
Method Summary
 java.lang.Object clone()
           
 boolean compatibility(Rule Rule)
          Checks compatibility (in sense of comparability) of the rule with a rule given for comparison.
 double conditionMatch(Situation sit)
          Method returns relative fit of the condition part of the rule to a situation to compare with, not taking wildcards / subordinate relations of symbols into account.
 double conditionMatchSubsumptive(Situation sit)
          Method returns relative fit of the condition part of the rule to a situation to compare with, taking wildcards / subordinate relations of symbols into account.
 Rule cross(Rule toCross, int Position)
          Performs a crossover of the rule at given position with Kreuzt die Regel an der another rule given, returning the result as a new rule.
 void debug_out()
          Method for output of debugging information.
 Situation getAction()
          Returns a pointer to the action part of the rule.
 Situation getCondition()
          Returns a pointer to condition part of the rule.
 int getLength()
          Method returns the lenght (for sets this should be the size of the defined basic set) of the situations in condition and action part of the rule.
 double getSpecifity()
          Method returns number of specific elements (i.e. non wildcards) in relation to condition size.
 Rule mutation(double Probability)
          Method for mutation with a given probability.
 void randomizeRule()
          Method sets rule parts to random situations.
 void setAction(Situation Action)
          Sets the action part of the rule to the given situation.
 void setCondition(Situation Condition)
          Sets the condition part of the rule to the given situation.
 double size()
          Method returns the size (for sets this should be their actual number of elements) of the situations in condition and action part of the rule.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Rule

public Rule(Situation Condition,
            Situation Action)
Constructor with Condition and Action-Part of the rule as parameters.

Parameters:
Condition - Situation to be set as condition
Action - Situation to be set as action

Rule

public Rule()
Constructor, creating an empty Rule.

Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Throws:
java.lang.CloneNotSupportedException

getCondition

public Situation getCondition()
Returns a pointer to condition part of the rule.

Returns:
Situation used as condition

getAction

public Situation getAction()
Returns a pointer to the action part of the rule.

Returns:
Situation used as action

setCondition

public void setCondition(Situation Condition)
Sets the condition part of the rule to the given situation.

Parameters:
Condition - Situation to be set for condition.

setAction

public void setAction(Situation Action)
Sets the action part of the rule to the given situation.

Parameters:
Action - Situation to be set for action.

compatibility

public boolean compatibility(Rule Rule)
Checks compatibility (in sense of comparability) of the rule with a rule given for comparison.

Parameters:
Rule - rule to compare with.
Returns:
true, if compareable, else false

cross

public Rule cross(Rule toCross,
                  int Position)
Performs a crossover of the rule at given position with Kreuzt die Regel an der another rule given, returning the result as a new rule.

Parameters:
toCross - Rule to cross with
Position - Position at which to cross
Returns:
new rule after crossover

randomizeRule

public void randomizeRule()
Method sets rule parts to random situations.


mutation

public Rule mutation(double Probability)
Method for mutation with a given probability. (Implementation of effect of probability depends on implemenation of Situation.)

Parameters:
Probability - Probability for mutation
Returns:
rule after mutation
See Also:
classifierLibrary.Situation.mutation

conditionMatchSubsumptive

public double conditionMatchSubsumptive(Situation sit)
Method returns relative fit of the condition part of the rule to a situation to compare with, taking wildcards / subordinate relations of symbols into account.

Parameters:
sit - Situation for comparison.
Returns:
relative fit

conditionMatch

public double conditionMatch(Situation sit)
Method returns relative fit of the condition part of the rule to a situation to compare with, not taking wildcards / subordinate relations of symbols into account.

Parameters:
sit - Situation, mit der verglichen werden soll.
Returns:
relative Übereinstimmung

getSpecifity

public double getSpecifity()
Method returns number of specific elements (i.e. non wildcards) in relation to condition size.

Returns:
relativer Anteil spezifischer Elemente (d.h. nicht Wildcards)

debug_out

public void debug_out()
Method for output of debugging information.


getLength

public int getLength()
Method returns the lenght (for sets this should be the size of the defined basic set) of the situations in condition and action part of the rule.

Returns:
total length of the rule

size

public double size()
Method returns the size (for sets this should be their actual number of elements) of the situations in condition and action part of the rule.

Returns:
total size of the rule