public class RealRep extends java.lang.Object implements Attribute
This class implements the Lower-Upper Bound Representation, i.e., an attribute is represented by [l_i, u_i]. If some operator modifies the interval limits so that l_i > u_i, then, both bounds are swapped.
Constructor and Description |
---|
RealRep()
Default constructor of the class.
|
RealRep(Attribute r)
It's a constructor for the class.
|
RealRep(double env)
Does construct a real representation allele from the environmental state
|
RealRep(double lValue,
double rValue)
It is the constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Attribute r)
Returns true if the allele matches with the environment
|
double |
getGenerality()
It returns the generality of the allele.
|
double |
getLowerAllele()
Returns the lower real value of the representation
|
double |
getUpperAllele()
Returns the upper real value of the representation
|
double |
isDontCareSymbol()
Returns if the real representation is a don't care symbol.
|
boolean |
isMoreGeneral(Attribute r)
Returns if the current interval is more general than the interval given as a parameter
|
void |
makeSpecify(double env)
If the random number generated is less than the specify probability
(parameter in the Config), the interval is specified with
an uniform distribution [0..l_0]
|
boolean |
match(double env)
Returns true if the allele matches with the environment
|
void |
mutate(double currentState)
Mutates the 2 reals contained in the representation.
|
void |
print()
Prints the classifier representation
|
void |
print(java.io.PrintWriter out)
Prints the classifier representation on the PrintWriter object given.
|
void |
printNotNorm(java.io.PrintWriter fout,
double lo)
Prints the classifier representation not normalized on the PrintWriter object given.
|
void |
printNotNorm(java.io.PrintWriter fout,
double lo,
double up)
Prints the classifier representation not normalized on the PrintWriter object given.
|
void |
setAllele(Attribute r)
Sets the lower and upper values.
|
void |
setAllele(double lValue,
double rValue)
Sets the lower and upper values.
|
boolean |
subsumes(Attribute r)
Returns true if the current representation allele subsumes the representation allele passed as a parameter
|
void |
verifyInterval()
Verifies if the interval is correct (if the upper value
is greater or equal than the lower value).
|
public RealRep()
public RealRep(double env)
Does construct a real representation allele from the environmental state
env
- is the environmental attribute statepublic RealRep(double lValue, double rValue)
It is the constructor of the class. It initializes the lower and upper bound values.
lValue
- is the lower bound value.rValue
- is the upper bound value.public RealRep(Attribute r)
It's a constructor for the class. It clones the realRep object passed as a parameter.
r
- is the real representation that has to be copied in the constructor.public void setAllele(double lValue, double rValue)
Sets the lower and upper values.
public void setAllele(Attribute r)
Sets the lower and upper values.
public double getLowerAllele()
Returns the lower real value of the representation
getLowerAllele
in interface Attribute
public double getUpperAllele()
Returns the upper real value of the representation
getUpperAllele
in interface Attribute
public double getGenerality()
It returns the generality of the allele.
getGenerality
in interface Attribute
public void verifyInterval()
Verifies if the interval is correct (if the upper value is greater or equal than the lower value). If it is not, it interchanges its values.
verifyInterval
in interface Attribute
public void makeSpecify(double env)
If the random number generated is less than the specify probability (parameter in the Config), the interval is specified with an uniform distribution [0..l_0]
makeSpecify
in interface Attribute
env
- is the environmental value for this attributepublic void mutate(double currentState)
Mutates the 2 reals contained in the representation.
public boolean match(double env)
Returns true if the allele matches with the environment
public boolean subsumes(Attribute r)
Returns true if the current representation allele subsumes the representation allele passed as a parameter
public boolean equals(Attribute r)
Returns true if the allele matches with the environment
public double isDontCareSymbol()
Returns if the real representation is a don't care symbol. It's not necessary in real representation, but it has to be codified because is defined in the interface. So, it will return the generality of the interval.
isDontCareSymbol
in interface Attribute
public boolean isMoreGeneral(Attribute r)
Returns if the current interval is more general than the interval given as a parameter
isMoreGeneral
in interface Attribute
r
- is the real representation of the classifier.public void print()
Attribute
public void print(java.io.PrintWriter out)
public void printNotNorm(java.io.PrintWriter fout, double lo, double up)
printNotNorm
in interface Attribute
fout
- PrintWriter object given to write on.lo
- lower value in the interval.up
- upper value in the interval.public void printNotNorm(java.io.PrintWriter fout, double lo)
printNotNorm
in interface Attribute
fout
- PrintWriter object given to write on.lo
- lower value in the interval.