public class IntegerRep extends java.lang.Object implements Attribute
This class represents the integer representation of a gene. It works as described in the XCSI article (see Wilson 2000)
Constructor and Description |
---|
IntegerRep(Attribute r)
It is a constructor for the class.
|
IntegerRep(double env,
int i)
Does create a Integer representation for de environmental value given as a parameter
|
IntegerRep(int lValue,
int rValue,
int i)
It is the default constructor of the class.
|
IntegerRep(int lValue,
int rValue,
int udLimit,
int upLimit)
It is the constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Attribute r)
Return true if the allele matches with the environment
|
double |
getAllele()
It returns the allele as a double
|
Attribute |
getAttributeAllele()
Returns the value of the alelle
|
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()
Return if the integer of the representation.
|
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 that is 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)
Muates the 2 reals contained in the representation.
|
void |
print()
This methods prints the attribute bounds
|
void |
print(java.io.PrintWriter out)
This method prints to the attribute bounds to the specified PrintWriter
|
void |
printNotNorm(java.io.PrintWriter fout,
double lo,
double up)
Prints the classifier representation not normalized on the PrintWriter object given.
|
void |
printNotNorm(java.io.PrintWriter fout,
int lo)
Prints the classifier representation not normalized on the PrintWriter object given.
|
void |
printNotNorm(java.io.PrintWriter fout,
java.util.Vector conv)
Prints the classifier representation 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 greather or equal than the lower value).
|
public IntegerRep(double env, int i)
Does create a Integer representation for de environmental value given as a parameter
env
- is the environmental attribute statei
- index of the attribute bound to mutate with.public IntegerRep(int lValue, int rValue, int i)
It is the default constructor of the class.
lValue
- is the under value to be set.rValue
- is the upper value to be set.i
- is the position of the attribute.public IntegerRep(int lValue, int rValue, int udLimit, int upLimit)
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.udLimit
- is the lower limit value.upLimit
- is the upper limit value.public IntegerRep(Attribute r)
It is 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 Attribute getAttributeAllele()
Returns the value of the alelle
getAttributeAllele
in interface Attribute
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 greather or equal than the lower value). If it isn't, it interchanges its values.
verifyInterval
in interface Attribute
public void makeSpecify(double env)
If the random number that is 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 environment.public void mutate(double currentState)
Muates 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)
Return true if the allele matches with the environment
public double isDontCareSymbol()
Return if the integer of the representation. It's not necessary in integer representation, but it has to be codified because is defined in the interface. So, it will return the generality of the interval. is a don't care symbol
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()
This methods prints the attribute bounds
public void print(java.io.PrintWriter out)
This method prints to the attribute bounds to the specified PrintWriter
public double getAllele()
Attribute
public void printNotNorm(java.io.PrintWriter fout, java.util.Vector conv)
printNotNorm
in interface Attribute
fout
- PrintWriter object given to write on.conv
- covariance matrixpublic void printNotNorm(java.io.PrintWriter fout, int lo)
printNotNorm
in interface Attribute
fout
- PrintWriter object given to write on.lo
- lower value in the interval.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.