Class COptQuestPathVariable
In every solution that the engine generates, the path is valid. The positions of the nodes on the path are 1 to L, where L is the length of the path, with no gap and no repeat. The start node, when given, has position 1. The end node, when given and different from the start node, has position L. When the start node and the end node are the same node, it has position 1 only. Every required node is on the path. The path can have only one node.
Variable names: <name>@<node> for each node, in the order of nodeNames.
The value of each name is the 1-based position of that node on the path, or 0 if the node is not
on the path.
In a suggested solution, the engine puts a node whose value is 0 or less off the path, and it uses the other values only to order the nodes. The engine numbers the positions again, and it adds the start node, the end node and the required nodes when they are missing.
In most programs, you add this variable with
OptQuestModel.AddPathVariable
and read its values with OptQuestSolution.GetValue(String) and the generated names.
Construct this class only when you add the variable with
COptQuestOptimization.AddVariable(COptQuestVariable).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCOptQuestPathVariable(String name, String[] nodeNames) Creates a path variable with any start node, any end node and no required nodes.COptQuestPathVariable(String name, String[] nodeNames, String startNode, String endNode) Creates a path variable with an optional start node and an optional end node.COptQuestPathVariable(String name, String[] nodeNames, String startNode, String endNode, String[] requiredNodes) Creates a path variable with an optional start node, an optional end node and nodes that must be on the path. -
Method Summary
Modifier and TypeMethodDescriptionReturns an empty list, because a path variable has no ordinary input variables.Returns an empty list, because a path variable has no output variables.Returns the decision values of this manifold variable that are not ordinary decision variables.Methods inherited from class com.opttek.optquest.COptQuestManifoldVariable
getConstraintsMethods inherited from class com.opttek.optquest.COptQuestUserControlledVariable
GetReplicationStatistic, GetReplicationStatisticValue, SetExclusiveRange, SetLowerBound, SetReplicationStatistic, SetUpperBoundMethods inherited from class com.opttek.optquest.COptQuestVariable
equals, GetDOELowerBound, GetDOEUpperBound, GetExclusiveLowerBoundAt, GetExclusiveUpperBoundAt, getID, GetLowerBound, GetName, GetNumberOfExclusiveRanges, GetStepSize, GetSuggestedValue, GetUpperBound, getVarRange, hashCode, isZeroOne, SetName
-
Constructor Details
-
COptQuestPathVariable
Creates a path variable with any start node, any end node and no required nodes.- Parameters:
name- base name of the variablenodeNames- names of the candidate nodes; there must be at least two, and each must be unique and must not contain whitespace, a semicolon, a comma or@- Throws:
COptQuestException- ifnodeNamesis null, has fewer than two nodes or holds a name that is not valid
-
COptQuestPathVariable
public COptQuestPathVariable(String name, String[] nodeNames, String startNode, String endNode) throws COptQuestException Creates a path variable with an optional start node and an optional end node.- Parameters:
name- base name of the variablenodeNames- names of the candidate nodes; there must be at least two, and each must be unique and must not contain whitespace, a semicolon, a comma or@startNode- the node at position 1, or null for any start nodeendNode- the node at the last position, or null for any end node- Throws:
COptQuestException- ifnodeNamesis null, has fewer than two nodes or holds a name that is not valid, or ifstartNodeorendNodeis not innodeNames
-
COptQuestPathVariable
public COptQuestPathVariable(String name, String[] nodeNames, String startNode, String endNode, String[] requiredNodes) throws COptQuestException Creates a path variable with an optional start node, an optional end node and nodes that must be on the path.- Parameters:
name- base name of the variablenodeNames- names of the candidate nodes; there must be at least two, and each must be unique and must not contain whitespace, a semicolon, a comma or@startNode- the node at position 1, or null for any start nodeendNode- the node at the last position, or null for any end noderequiredNodes- nodes that must be on the path, or null for none- Throws:
COptQuestException- ifnodeNamesis null, has fewer than two nodes or holds a name that is not valid, or ifstartNode,endNodeor a required node is not innodeNames
-
-
Method Details
-
getInputVariables
Returns an empty list, because a path variable has no ordinary input variables.The values of a path variable are in the list that
getProjectedInputVariables()returns. That list has one variable<name>@<node>for each node.- Returns:
- an empty list
-
getOutputVariables
Returns an empty list, because a path variable has no output variables.The values of a path variable are in the list that
getProjectedInputVariables()returns. That list has one variable<name>@<node>for each node.- Returns:
- an empty list
-
getProjectedInputVariables
Description copied from class:COptQuestManifoldVariableReturns the decision values of this manifold variable that are not ordinary decision variables.For example, an angle variable returns
angle@theta, and a mixture variable returns onemix@<component>name for each component. In every solution that the engine generates, and in every suggested solution, these values are inside the set of the variable. Your evaluator reads them as inputs:OptQuestSolution.GetInputNames()returns them.A constraint that uses one of these names is checked after the evaluation, like a constraint on an output. Your evaluator can receive values that break the constraint, and the solution is then infeasible.
- Specified by:
getProjectedInputVariablesin classCOptQuestManifoldVariable- Returns:
- fixed-size or immutable list of these variables; never
null
-