|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.opttek.optquest.COptQuestStringConstraint
public class COptQuestStringConstraint
The COptQuestStringConstraint class is used to define linear and non-linear
constraints using a mathematical expression. For example,
"2*Var1 + 3*Var2 + 1.5*Var3 <= 100" could be used to define a budget constraint.
"Var1", "Var2" and "Var3" must be names that were assigned to COptQuestVariable
objects. If a variable name contains non-alphanumeric characters such as blanks,
the names should be enclosed in square brackets in the equation string.
For example, "2*[Var 1] + 3*[Var 2] + 1.5*[Var 3] <= 100"
The constraint expression can define an efficient frontier by specifying a
comma separated list of right hand side values. For example,
"2*Var1 + 3*Var2 + 1.5*Var3 <= 100,200,300"
The following mathematical functions are supported and can be used in the
mathematical expression:
| Constructor Summary | |
|---|---|
COptQuestStringConstraint()
Default constructor |
|
COptQuestStringConstraint(java.lang.String equation)
Constructor that accepts the string expression that defines the constraint. |
|
COptQuestStringConstraint(java.lang.String name,
java.lang.String equation)
Constructor that assigns a name to the constraint and the string expression that defines the constraint. |
|
| Method Summary | |
|---|---|
void |
AddIndicatorVariable(COptQuestVariable variable,
boolean inverse)
|
void |
CheckExpression()
Checks the constraint expression for syntax errors. |
boolean |
GetCheckLinear()
Returns true if the constraint equation should be checked for linearity. |
java.lang.String |
GetEquation()
Returns the mathematical expression of the constraint. |
java.lang.String |
GetLHSString(int clause)
Returns the left hand side string expression associated with the clause indicated by the input parameter. |
java.lang.String |
GetName()
Returns the constraint name. |
int |
GetNumberOfClauses()
Returns the number of clauses in the string equation. |
int |
GetNumberOfSteps()
Returns the number of steps defined for an Efficient Frontier. |
int |
GetNumberOfVariables()
If the expression is a linear expression, this method returns the number of decision variables in the constraint expression after the expression has been parsed and reduced. |
java.lang.String |
GetOperatorString(int clause)
Returns the operator as a string expression for the clause indicated by the input parameter. |
java.lang.String |
GetRHSString(int clause)
Returns the right hand side string expression associated with the clause indicated by the input parameter. |
boolean |
HasUserVariables()
Returns true if the constraint expression contains a COptQuestUserControlledVariable. |
boolean |
IsAndClauses()
Returns true if the constraint expression has an implied "And" condition. |
boolean |
IsGoal()
Returns true if the constraint has been set as a goal rather than a hard requirement. |
boolean |
IsLinear()
Returns true if the expression is linear. |
boolean |
IsOrClauses()
Returns true if the constraint expression contains the keyword "Or". |
boolean |
IsVariable()
Returns true if the constraint equation defines variable bounds. |
void |
SetCheckLinear(boolean checkLinear)
If true, the constraint should be checked for linearity. |
void |
SetEquation(java.lang.String equation)
Sets the mathematical expression that defines the constraint. |
void |
SetGoal(boolean goalValue)
Makes the constraint a goal where the solution is not marked as infeasible but a solution that satisfies the bounds of the constraint is considered better than a solution that violates the bounds. |
void |
SetName(java.lang.String name)
Assigns an alphanumeric name to the constraint. |
void |
SetReplicationConfidence(int level,
double errPercent)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public COptQuestStringConstraint(java.lang.String name,
java.lang.String equation)
name - - alphanumeric nameequation - - linear or non-linear expression defining the constraintpublic COptQuestStringConstraint(java.lang.String equation)
equation - - linear or non-linear expression defining the constraintpublic COptQuestStringConstraint()
| Method Detail |
|---|
public void SetName(java.lang.String name)
name - - alphanumeric string namepublic java.lang.String GetName()
public void SetEquation(java.lang.String equation)
equation - - mathematical expressionpublic java.lang.String GetEquation()
public void SetGoal(boolean goalValue)
public boolean IsGoal()
public void SetCheckLinear(boolean checkLinear)
checkLinear - - true if the mathematical expression should be checked for
linearity. False if it should not be checked.public boolean GetCheckLinear()
public boolean IsLinear()
public boolean IsVariable()
public int GetNumberOfClauses()
public boolean IsAndClauses()
public boolean IsOrClauses()
public java.lang.String GetRHSString(int clause)
throws COptQuestException
clause - 1 based index of the clause.
COptQuestException
public java.lang.String GetLHSString(int clause)
throws COptQuestException
clause - 1 based index of the clause.
COptQuestException
public java.lang.String GetOperatorString(int clause)
throws COptQuestException
clause - 1 based index of the clause.
COptQuestExceptionpublic int GetNumberOfSteps()
public void AddIndicatorVariable(COptQuestVariable variable,
boolean inverse)
throws COptQuestException
COptQuestException
public void CheckExpression()
throws COptQuestException
COptQuestExceptionpublic int GetNumberOfVariables()
public boolean HasUserVariables()
public void SetReplicationConfidence(int level,
double errPercent)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||