Class COptQuestTopologicalSequenceVariable


public class COptQuestTopologicalSequenceVariable extends COptQuestManifoldVariable
A topological sequence variable. Its value is an order of the tasks in which every task comes after its predecessors. Use a topological sequence variable when the decision is the order in which to do a set of tasks, and some tasks must always come before others, such as project steps with dependencies or an assembly sequence.

In every solution that the engine generates, the order meets every precedence: a predecessor always has a smaller rank than the task that depends on it.

Variable names: <name>@<task> for each task, in the order of tasks. The value of each name is the integer rank of that task in the order, where 1 is first and n is last. The ranks are a permutation of 1 to n.

In a suggested solution, the engine keeps an order that meets every precedence, and it gives equal ranks different values in the order of tasks. If the order does not meet a precedence, the engine changes it: at each step, of the tasks that can go next, the task with the smallest suggested rank goes next.

In most programs, you add this variable with OptQuestModel.AddTopologicalSequenceVariable 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:
  • OptQuestModel.AddTopologicalSequenceVariable(String, String[], java.util.Map)
  • Constructor Details

    • COptQuestTopologicalSequenceVariable

      public COptQuestTopologicalSequenceVariable(String name, String[] tasks, Map<String,List<String>> predecessors) throws COptQuestException
      Creates a topological sequence variable.

      The constructor checks that no task lists itself as a predecessor and that the precedences form no cycle. It ignores names in predecessors that are not in tasks.

      Parameters:
      name - base name of the variable
      tasks - names of the tasks; there must be at least one, and each must be unique and must not contain whitespace, a semicolon, a comma or @
      predecessors - for each task that has predecessors, the tasks that must come before it; null for no precedences
      Throws:
      COptQuestException - if tasks is null or empty or holds a name that is not valid, if a task lists itself as a predecessor, or if the precedences form a cycle
  • Method Details

    • getInputVariables

      public List<COptQuestVariable> getInputVariables()
      Returns an empty list, because a topological sequence variable has no ordinary input variables.

      The values of a topological sequence variable are in the list that getProjectedInputVariables() returns. That list has one variable <name>@<task> for each task.

      Returns:
      an empty list
    • getOutputVariables

      public List<COptQuestUserControlledVariable> getOutputVariables()
      Returns an empty list, because a topological sequence variable has no output variables.

      The values of a topological sequence variable are in the list that getProjectedInputVariables() returns. That list has one variable <name>@<task> for each task.

      Returns:
      an empty list
    • getProjectedInputVariables

      public List<COptQuestUserControlledVariable> getProjectedInputVariables()
      Description copied from class: COptQuestManifoldVariable
      Returns 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 one mix@<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:
      getProjectedInputVariables in class COptQuestManifoldVariable
      Returns:
      fixed-size or immutable list of these variables; never null