jmetal.encodings.variable
Class BinaryReal

java.lang.Object
  extended by jmetal.core.Variable
      extended by jmetal.encodings.variable.Binary
          extended by jmetal.encodings.variable.BinaryReal
All Implemented Interfaces:
java.io.Serializable

public class BinaryReal
extends Binary

This class extends the Binary class to represent a Real encodings.variable encoded by a binary string

See Also:
Serialized Form

Field Summary
static int DEFAULT_PRECISION
          Defines the default number of bits used for binary coded variables.
 
Fields inherited from class jmetal.encodings.variable.Binary
bits_, numberOfBits_
 
Constructor Summary
BinaryReal()
          Constructor.
BinaryReal(BinaryReal variable)
          Copy constructor
BinaryReal(java.util.BitSet bits, int nbBits, double lowerBound, double upperBound)
           
BinaryReal(int numberOfBits, double lowerBound, double upperBound)
          Constructor
 
Method Summary
 void decode()
          Decodes the real value encoded in the binary string represented by the BinaryReal object.
 Variable deepCopy()
          Creates an exact copy of a BinaryReal object.
 double getLowerBound()
          Returns the lower bound of the encodings.variable.
 double getUpperBound()
          Returns the upper bound of the encodings.variable.
 double getValue()
          Returns the double value of the encodings.variable.
 void setLowerBound(double lowerBound)
          Sets the lower bound of the encodings.variable.
 void setUpperBound(double upperBound)
          Sets the upper bound of the encodings.variable.
 void setValue(double value)
          This implementation is efficient for binary string of length up to 24 bits, and for positive intervals.
 java.lang.String toString()
          Returns a string representing the object.
 
Methods inherited from class jmetal.encodings.variable.Binary
getIth, getNumberOfBits, hammingDistance, setIth
 
Methods inherited from class jmetal.core.Variable
getVariableType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PRECISION

public static final int DEFAULT_PRECISION
Defines the default number of bits used for binary coded variables.

See Also:
Constant Field Values
Constructor Detail

BinaryReal

public BinaryReal()
Constructor.


BinaryReal

public BinaryReal(int numberOfBits,
                  double lowerBound,
                  double upperBound)
Constructor

Parameters:
numberOfBits - Length of the binary string.
lowerBound - The lower limit for the encodings.variable
upperBound - The upper limit for the encodings.variable.

BinaryReal

public BinaryReal(java.util.BitSet bits,
                  int nbBits,
                  double lowerBound,
                  double upperBound)
Parameters:
bits - BitSet
nbBits - Number of bits
lowerBound - Lower bound
upperBound - Upper bound

BinaryReal

public BinaryReal(BinaryReal variable)
Copy constructor

Parameters:
variable - The encodings.variable to copy
Method Detail

decode

public void decode()
Decodes the real value encoded in the binary string represented by the BinaryReal object. The decoded value is stores in the value_ field and can be accessed by the method getValue.

Overrides:
decode in class Binary

getValue

public double getValue()
Returns the double value of the encodings.variable.

Overrides:
getValue in class Variable
Returns:
the double value.

setValue

public void setValue(double value)
              throws JMException
This implementation is efficient for binary string of length up to 24 bits, and for positive intervals.

Overrides:
setValue in class Variable
Throws:
JMException
See Also:
Contributor: jl hippolyte

deepCopy

public Variable deepCopy()
Creates an exact copy of a BinaryReal object.

Overrides:
deepCopy in class Binary
Returns:
The copy of the object

getLowerBound

public double getLowerBound()
Returns the lower bound of the encodings.variable.

Overrides:
getLowerBound in class Variable
Returns:
the lower bound.

getUpperBound

public double getUpperBound()
Returns the upper bound of the encodings.variable.

Overrides:
getUpperBound in class Variable
Returns:
the upper bound.

setLowerBound

public void setLowerBound(double lowerBound)
Sets the lower bound of the encodings.variable.

Overrides:
setLowerBound in class Variable
Parameters:
lowerBound - the lower bound.

setUpperBound

public void setUpperBound(double upperBound)
Sets the upper bound of the encodings.variable.

Overrides:
setUpperBound in class Variable
Parameters:
upperBound - the upper bound.

toString

public java.lang.String toString()
Returns a string representing the object.

Overrides:
toString in class Binary
Returns:
the string.