Package com.opttek.optquest
Class COptQuestDiscreteVariable
java.lang.Object
com.opttek.optquest.COptQuestVariable
com.opttek.optquest.COptQuestDiscreteVariable
- Direct Known Subclasses:
COptQuestBinaryVariable
,COptQuestDesignVariable
,COptQuestIntegerVariable
The CoptQuestDiscreteVariable class defines a decision variable whose values
begin at the lower bound and increment by a step size up to the upper bound
-
Constructor Summary
ConstructorDescriptionDefault constructorCOptQuestDiscreteVariable
(double lowerBound, double upperBound, double step) Constructor that sets the lower bound,upper bound and step size.COptQuestDiscreteVariable
(String name, double lowerBound, double upperBound, double step) Constructor that assigns a name to the variable and sets the lower bound, upper bound and step size. -
Method Summary
Modifier and TypeMethodDescriptiondouble
Get the step sizeboolean
void
SetStepSize
(double val) Sets the step size.Methods inherited from class com.opttek.optquest.COptQuestVariable
equals, GetDOELowerBound, GetDOEUpperBound, GetExclusiveLowerBoundAt, GetExclusiveUpperBoundAt, getID, GetLowerBound, GetName, GetNumberOfExclusiveRanges, GetSuggestedValue, GetUpperBound, getVarRange, hashCode, SetExclusiveRange, SetLowerBound, SetName, SetUpperBound
-
Constructor Details
-
COptQuestDiscreteVariable
Constructor that assigns a name to the variable and sets the lower bound, upper bound and step size.- Parameters:
name
- alphanumeric name. Note: the name can contain blanks or special characters. If the variable name is used in a COptQuestStringConstraint equation, the name should be enclosed in square brackets [] in the COptQuestStringConstraint string equation.lowerBound
- a value between -pow(2,31) and +pow(2,31)-1upperBound
- a value between -pow(2,31) and +pow(2,31)-1step
- the step size which can be any value that is less than or equal to the difference between the upper bound and the lower bound. If the range is not divisible by the step size, the range is extended by extending the upper bound.
-
COptQuestDiscreteVariable
public COptQuestDiscreteVariable(double lowerBound, double upperBound, double step) Constructor that sets the lower bound,upper bound and step size.- Parameters:
lowerBound
- a value between -pow(2,31) and +pow(2,31)-1upperBound
- a value between -pow(2,31) and +pow(2,31)-1step
- the step size which can be any value that is less than or equal to the difference between the upper bound and the lower bound.
-
COptQuestDiscreteVariable
public COptQuestDiscreteVariable()Default constructor
-
-
Method Details
-
SetStepSize
Sets the step size.- Parameters:
val
- the step size which can be any value that is less than or equal to the difference between the upper bound and the lower bound. If the range is not divisible by the step size, the range is extended by extending the upper bound.- Throws:
COptQuestException
- if step size is not valid for variable type
-
GetStepSize
public double GetStepSize()Description copied from class:COptQuestVariable
Get the step size- Overrides:
GetStepSize
in classCOptQuestVariable
- Returns:
- step size
-
isZeroOne
public boolean isZeroOne()- Overrides:
isZeroOne
in classCOptQuestVariable
-