Package com.opttek.optquest
Class COptQuestObjectiveFunction
java.lang.Object
com.opttek.optquest.COptQuestObjective
com.opttek.optquest.COptQuestSingleObjective
com.opttek.optquest.COptQuestObjectiveFunction
The COptQuestObjectiveFunction class is used to define a linear objective.
Linear objectives are in the form coeff1 * var1 + coeff2 * var2 + ... + coeffn * varN.
-
Constructor Summary
ConstructorDescriptionDefault constructorConstructor that assigns a name to the objective -
Method Summary
Modifier and TypeMethodDescriptionvoid
AddVariable
(COptQuestVariable variable, double coefficient) Adds a variable and its coefficient to the linear objective which has the form coeff1 * var1 + coeff2 + var2 + coeffn * varN.void
ChangeVariableCoefficient
(COptQuestVariable var, double coefficient) Change the coefficient for this variable.double
GetCoefficientAt
(int index) Returns the coefficient at the specified index.long
Returns the number of variable/coefficient pairs that were added to the linear objective.int
Returns the number of variable/coefficient pairs that were added to the linear objective.GetVariableAt
(int index) Returns the variable at the specified index.boolean
IsLinear()
Returns true.Methods inherited from class com.opttek.optquest.COptQuestSingleObjective
GetReplicationConfidenceErrorPercent, GetReplicationConfidenceLevel, GetReplicationConfidenceType, GetReplicationStatistic, GetReplicationStatisticValue, SetReplicationConfidence, SetReplicationStatistic
Methods inherited from class com.opttek.optquest.COptQuestObjective
equals, GetName, hashCode, IsMaximize, IsMinimize, SetMaximize, SetMinimize, SetName
-
Constructor Details
-
COptQuestObjectiveFunction
Constructor that assigns a name to the objective- Parameters:
name
- alphanumeric name
-
COptQuestObjectiveFunction
public COptQuestObjectiveFunction()Default constructor
-
-
Method Details
-
AddVariable
Adds a variable and its coefficient to the linear objective which has the form coeff1 * var1 + coeff2 + var2 + coeffn * varN. This method is called once for each variable. -
ChangeVariableCoefficient
Change the coefficient for this variable. -
GetNumberOfVariables
public long GetNumberOfVariables()Returns the number of variable/coefficient pairs that were added to the linear objective.- Returns:
- number of variables added to the linear objective
-
GetVariableAt
Returns the variable at the specified index.- Parameters:
index
- value between 0 and the number of variables added to the linear objective- Returns:
- the decision variable at the specified index
-
GetCoefficientAt
public double GetCoefficientAt(int index) Returns the coefficient at the specified index.- Parameters:
index
- value between 0 and the number of variables added to the linear objective- Returns:
- the coefficient at the specified index
-
IsLinear
public boolean IsLinear()Returns true. COptQuestObjectiveFunction objects define a linear objective.- Overrides:
IsLinear
in classCOptQuestObjective
- Returns:
- true if the objective is a linear function of the decision variables.
-
GetNumCoefficients
public int GetNumCoefficients()Returns the number of variable/coefficient pairs that were added to the linear objective.- Returns:
- - the number of coefficients added to the linear objective.
-