MOEA Framework 2.12
API Specification

org.moeaframework.core.variable
Class RealVariable

java.lang.Object
  extended by org.moeaframework.core.variable.RealVariable
All Implemented Interfaces:
Serializable, Variable

public class RealVariable
extends Object
implements Variable

Decision variable for real values.

See Also:
Serialized Form

Constructor Summary
RealVariable(double lowerBound, double upperBound)
          Constructs a real variable in the range lowerBound <= x <= upperBound with an uninitialized value.
RealVariable(double value, double lowerBound, double upperBound)
          Constructs a real variable in the range lowerBound <= x <= upperBound with the specified initial value.
 
Method Summary
 RealVariable copy()
          Returns an independent copy of this decision variable.
 boolean equals(Object obj)
           
 double getLowerBound()
          Returns the lower bound of this decision variable.
 double getUpperBound()
          Returns the upper bound of this decision variable.
 double getValue()
          Returns the current value of this decision variable.
 int hashCode()
           
 void randomize()
          Randomly assign the value of this variable.
 void setValue(double value)
          Sets the value of this decision variable.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RealVariable

public RealVariable(double lowerBound,
                    double upperBound)
Constructs a real variable in the range lowerBound <= x <= upperBound with an uninitialized value.

Parameters:
lowerBound - the lower bound of this decision variable, inclusive
upperBound - the upper bound of this decision variable, inclusive

RealVariable

public RealVariable(double value,
                    double lowerBound,
                    double upperBound)
Constructs a real variable in the range lowerBound <= x <= upperBound with the specified initial value.

Parameters:
value - the initial value of this decision variable
lowerBound - the lower bound of this decision variable, inclusive
upperBound - the upper bound of this decision variable, inclusive
Throws:
IllegalArgumentException - if the value is out of bounds (value < lowerBound) || (value > upperBound)
Method Detail

getValue

public double getValue()
Returns the current value of this decision variable.

Returns:
the current value of this decision variable

setValue

public void setValue(double value)
Sets the value of this decision variable.

Parameters:
value - the new value for this decision variable
Throws:
IllegalArgumentException - if the value is out of bounds (value < getLowerBound()) || (value > getUpperBound())

getLowerBound

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

Returns:
the lower bound of this decision variable, inclusive

getUpperBound

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

Returns:
the upper bound of this decision variable, inclusive

copy

public RealVariable copy()
Description copied from interface: Variable
Returns an independent copy of this decision variable. It is required that x.copy() is completely independent from x. This means any method invoked on x.copy() in no way alters the state of x and vice versa. It is typically the case that x.copy().getClass() == x.getClass() and x.copy().equals(x).

Specified by:
copy in interface Variable
Returns:
an independent copy of this decision variable

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

randomize

public void randomize()
Description copied from interface: Variable
Randomly assign the value of this variable. In general, the randomization should follow a uniform distribution.

Specified by:
randomize in interface Variable

MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!