Class COptQuestLowRankMatrixVariable


public class COptQuestLowRankMatrixVariable extends COptQuestManifoldVariable
A low-rank matrix variable. Its value is a rows by cols matrix that is a constant matrix plus a correction of low rank. Use a low-rank matrix variable when the decision is a large table made of a few row and column patterns.

In every solution that the engine generates, every entry is from min to max, and the matrix is the constant matrix (min + max) / 2 plus a correction of rank at most rank.

The value of rank is the number of row patterns that the engine can combine. With rank 1, each row of the matrix is the middle value (min + max) / 2 plus one row pattern, multiplied by an amount that can differ from row to row. With each extra unit of rank, the engine can combine one more row pattern. With rank 0, every entry is the middle value.

Variable names: <name>@<row>,<col> for each entry, with 1-based row and column numbers, row by row. Each name contains a comma, so write it in brackets in an expression: [<name>@1,2].

In most programs, you add this variable with OptQuestModel.AddLowRankMatrixVariable 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.AddLowRankMatrixVariable(String, int, int, int, double, double)
  • Constructor Details

    • COptQuestLowRankMatrixVariable

      public COptQuestLowRankMatrixVariable(String name, int rows, int cols, int rank, double min, double max) throws COptQuestException
      Creates a low-rank matrix variable.
      Parameters:
      name - base name of the variable
      rows - number of rows; must be at least 1
      cols - number of columns; must be at least 1
      rank - largest rank of the correction. A value greater than the number of rows or columns is reduced to it. With a value of 0 or less, the matrix is constant.
      min - lower bound of every entry
      max - upper bound of every entry
      Throws:
      COptQuestException - if min or max is NaN, or if min is greater than max
  • Method Details

    • getInputVariables

      public List<COptQuestVariable> getInputVariables()
      Returns an empty list, because a low-rank matrix variable has no ordinary input variables.

      The values of a low-rank matrix variable are in the list that getProjectedInputVariables() returns. That list has one variable <name>@<row>,<col> for each entry.

      Returns:
      an empty list
    • getOutputVariables

      public List<COptQuestUserControlledVariable> getOutputVariables()
      Returns an empty list, because a low-rank matrix variable has no output variables.

      The values of a low-rank matrix variable are in the list that getProjectedInputVariables() returns. That list has one variable <name>@<row>,<col> for each entry.

      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