Class SampledDouble
java.lang.Object
org.moeaframework.analysis.parameter.AbstractParameter<Double>
org.moeaframework.analysis.parameter.SampledDouble
- All Implemented Interfaces:
NumericParameter<Double>,Parameter<Double>,SampledParameter<Double>,Named
public class SampledDouble
extends AbstractParameter<Double>
implements SampledParameter<Double>, NumericParameter<Double>
Parameter representing a
Double value.-
Constructor Summary
ConstructorsConstructorDescriptionSampledDouble(String name, double lowerBound, double upperBound) Constructs a new double parameter with the given sampling bounds. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringapplyPrecision(double value) Rounds the value using the same precision asSettings.EPS.static SampledDoubleDecodes the string representation of this parameter.Encodes this parameter definition in a format suitable for storing in a file.The lower bound of this parameter.The upper bound of this parameter.Parses this parameter value from the given string.voidSamples this parameter and assigns the value to the sample.Methods inherited from class org.moeaframework.analysis.parameter.AbstractParameter
getName, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.moeaframework.analysis.parameter.Parameter
assignValue, readValue
-
Constructor Details
-
SampledDouble
Constructs a new double parameter with the given sampling bounds.- Parameters:
name- the parameter namelowerBound- the lower boundupperBound- the upper bound
-
-
Method Details
-
getLowerBound
Description copied from interface:NumericParameterThe lower bound of this parameter.- Specified by:
getLowerBoundin interfaceNumericParameter<Double>- Returns:
- the lower bound
-
getUpperBound
Description copied from interface:NumericParameterThe upper bound of this parameter.- Specified by:
getUpperBoundin interfaceNumericParameter<Double>- Returns:
- the upper bound
-
parse
Description copied from interface:ParameterParses this parameter value from the given string. -
sample
Description copied from interface:SampledParameterSamples this parameter and assigns the value to the sample. The scale is a value between0.0and1.0, typically supplied by aSequence, used to generate the sampled value.When converting the scale to the parameter value, implementations are expected to provide equal weighting to each possible value, so that a value does not appear more or less often than any other value.
- Specified by:
samplein interfaceSampledParameter<Double>- Parameters:
sample- the samplescale- value between0.0and1.0used to generate the sample
-
encode
Description copied from interface:ParameterEncodes this parameter definition in a format suitable for storing in a file. -
decode
Decodes the string representation of this parameter.- Parameters:
tokenizer- the tokenizerline- the string representation- Returns:
- the decoded parameter
- Throws:
InvalidParameterException- if the string representation is not a valid parameter
-
applyPrecision
Rounds the value using the same precision asSettings.EPS. This prevents small errors in the floating-point representation / arithmetic from manifesting as different parameter values.- Parameters:
value- the original value- Returns:
- the rounded value stored as a string
-