Class COptQuestPolicySequenceVariable


public class COptQuestPolicySequenceVariable extends COptQuestManifoldVariable
A policy sequence variable. Its value is a priority score for each item of a set, and one weight for each feature of the items. The score of an item is a weighted sum of its features, and the engine chooses the weights. Use a policy sequence variable when a weighted sum of a few item attributes gives a good order, and the weights are a useful result, for example dispatch order by urgency and setup family.

In every solution that the engine generates, the item scores come from one set of feature weights applied to the feature matrix. Sort the items by descending score to get the ranked list: a higher score means a higher priority. This is the opposite of a sequence variable, where 1 is the highest priority.

Variable names:

  • <name>@<itemName> for each item, an input: the priority score of that item.
  • <name>@<featureName> for each feature, an output: the coefficient of that feature, which is the change in score for one unit of the feature. Multiply each raw feature value of an item by its coefficient and add the products to score a new item. That sum can differ from the reported score by a constant that is the same for every item, so it gives the same order.
  • <name>@<featureName>@contribution for each feature, an output: the signed share of that feature in the rule, in [-1, 1]. The absolute values of all the contributions sum to 1.
  • <name>@<featureName>@confidence for each feature, an output: a confidence in [0, 1] for the weight of that feature. A feature whose values are all equal gets 0.
  • <name>@<itemName>@confidence for each item, an output: a confidence in [0, 1] that the item is in the right place relative to its neighbors in the order. With one item, the value is 1.

The engine computes every value of a policy sequence variable. The item scores are inputs. The coefficients, the contributions and the confidences are outputs. Your evaluator can read these outputs, and must not write them. Item names and feature names are in one set of names, so every item name and feature name must be different from all the others.

Give the feature values in their own units. You do not need to scale them. In a suggested solution, the engine reads only the item scores, and it can change them. For an evaluated or required solution, the engine computes the coefficient, contribution and confidence outputs from the policy that best fits the supplied item scores. It does not change the scores.

Each item name and feature name must not contain whitespace, a semicolon, a comma or @.

In most programs, you add this variable with OptQuestModel.AddPolicySequenceVariable 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 Details

    • COptQuestPolicySequenceVariable

      public COptQuestPolicySequenceVariable(String name, double[][] featureMatrix, String[] itemNames, String[] featureNames) throws COptQuestException
      Creates a policy sequence variable.
      Parameters:
      name - base name of the variable
      featureMatrix - feature values, one row for each item and one column for each feature
      itemNames - names of the items, one for each row of featureMatrix
      featureNames - names of the features, one for each column of featureMatrix
      Throws:
      COptQuestException - if featureMatrix is empty, if the number of item names is not the number of rows, if the number of feature names is not the number of columns, or if an item name or feature name is not valid or is used more than once
  • Method Details

    • getInputVariables

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

      The item scores of a policy sequence variable are in the list that getProjectedInputVariables() returns. Its coefficient, contribution and confidence values are in the list that getOutputVariables() returns.

      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
    • getOutputVariables

      public List<COptQuestUserControlledVariable> getOutputVariables()
      Description copied from class: COptQuestManifoldVariable
      Returns the outputs of this manifold variable.

      For the output vector, output matrix and output N-dimensional variables, your evaluator writes these values before it submits the solution. For a policy sequence variable, the engine computes these values, and your evaluator must not write them. For all other manifold variables, the list is empty.

      Specified by:
      getOutputVariables in class COptQuestManifoldVariable
      Returns:
      fixed-size or immutable list of outputs; never null