Class COptQuestTreeVariable
In every solution that the engine generates, the edges form a spanning tree. The tree has exactly n - 1 edges and no cycle. Any node can be the root.
Variable names: <name>@<nodeFrom>,<nodeTo> for every ordered pair of nodes,
including a node paired with itself: the full n by n adjacency matrix, row by row in the order of
nodeNames. The value of each name is 1 if the edge from nodeFrom to
nodeTo is present and 0 if it is not. The diagonal is always 0. Each name contains a
comma, so write it in brackets in an expression: [<name>@A,B].
In a suggested solution, a value greater than 0.5 is an edge. The engine keeps a suggested tree as it is. Otherwise, the engine keeps one incoming edge for each node other than the root, and it uses a suggested edge where it can.
In most programs, you add this variable with
OptQuestModel.AddTreeVariable 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
ConstructorsConstructorDescriptionCOptQuestTreeVariable(String name, String[] nodeNames) Creates a tree variable over the given nodes.COptQuestTreeVariable(String name, String[] nodeNames, String rootNode, Map<String, List<String>> predecessors) Creates a tree variable over the given nodes, with an optional fixed root and optional precedences. -
Method Summary
Modifier and TypeMethodDescriptionReturns an empty list, because a tree variable has no ordinary input variables.Returns an empty list, because a tree 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
-
COptQuestTreeVariable
Creates a tree variable over the given nodes.- Parameters:
name- base name of the variablenodeNames- names of the nodes; there must be at least one, and each must be unique and must not contain whitespace, a semicolon, a comma or@- Throws:
COptQuestException- ifnodeNamesis null or empty, or holds a name that is not valid
-
COptQuestTreeVariable
public COptQuestTreeVariable(String name, String[] nodeNames, String rootNode, Map<String, List<String>> predecessors) throws COptQuestExceptionCreates a tree variable over the given nodes, with an optional fixed root and optional precedences.- Parameters:
name- base name of the variablenodeNames- names of the nodes; there must be at least one, and each must be unique and must not contain whitespace, a semicolon, a comma or@rootNode- the node that is the root of every tree, or null or empty to let any node be the rootpredecessors- map from a node to the nodes that must come before it, or null. A node never comes above one of its predecessors in the tree. Names that are not nodes are ignored.- Throws:
COptQuestException- ifnodeNamesis null or empty, holds a name that is not valid, ifrootNodeis not one of the nodes, if the root node has a predecessor, if a node lists itself as a predecessor, or if the precedences form a cycle
-
-
Method Details
-
getInputVariables
Returns an empty list, because a tree variable has no ordinary input variables.The values of a tree variable are in the list that
getProjectedInputVariables()returns. That list has one variable<name>@<nodeFrom>,<nodeTo>for every ordered pair of nodes.- Returns:
- an empty list
-
getOutputVariables
Returns an empty list, because a tree variable has no output variables.The values of a tree variable are in the list that
getProjectedInputVariables()returns. That list has one variable<name>@<nodeFrom>,<nodeTo>for every ordered pair of nodes.- 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
-