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.
Constructor and Description |
---|
Rule()
Constructor, creating an empty Rule.
|
Rule(Situation Condition,
Situation Action)
Constructor with Condition and Action-Part of the rule as parameters.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public Rule(Situation Condition, Situation Action)
Condition
- Situation to be set as conditionAction
- Situation to be set as actionpublic Rule()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public Situation getCondition()
public Situation getAction()
public void setCondition(Situation Condition)
Condition
- Situation to be set for condition.public void setAction(Situation Action)
Action
- Situation to be set for action.public boolean compatibility(Rule Rule)
Rule
- rule to compare with.public Rule cross(Rule toCross, int Position)
toCross
- Rule to cross withPosition
- Position at which to crosspublic void randomizeRule()
public Rule mutation(double Probability)
Probability
- Probability for mutationclassifierLibrary.Situation.mutation
public double conditionMatchSubsumptive(Situation sit)
sit
- Situation for comparison.public double conditionMatch(Situation sit)
sit
- Situation, mit der verglichen werden soll.public double getSpecifity()
public void debug_out()
public int getLength()
public double size()