Class COptQuestIntegerNDVariable


public class COptQuestIntegerNDVariable extends COptQuestManifoldVariable
An integer N-dimensional variable: an array of integer variables with the shape dims. The elements are ordinary input variables.

Variable names: <name>@<i1>,<i2>,... for each element, with one 1-based index for each dimension. The last index changes fastest. With two or more dimensions, each name contains a comma, so write it in brackets in an expression: [<name>@1,2,3].

Each element takes the values min, min + 1, min + 2, and so on, up to max. Give whole-number bounds to get whole-number values.

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

    • COptQuestIntegerNDVariable

      public COptQuestIntegerNDVariable(String name, int[] dims, double min, double max) throws COptQuestException
      Creates an integer N-dimensional variable.
      Parameters:
      name - base name of the variable
      dims - size of each dimension; there must be at least one dimension, and each size must be at least 1
      min - lower bound of each element
      max - upper bound of each element
      Throws:
      COptQuestException - if dims is null or empty, or if a size is less than 1
  • Method Details

    • getProjectedInputVariables

      public List<COptQuestUserControlledVariable> getProjectedInputVariables()
      Returns an empty list, because the values of an integer N-dimensional variable are ordinary inputs.

      The values are in the list that getInputVariables() returns. That list has one variable <name>@<i1>,<i2>,... for each element.

      Returns:
      an empty list
    • getOutputVariables

      public List<COptQuestUserControlledVariable> getOutputVariables()
      Returns an empty list, because an integer N-dimensional variable has no output variables.

      The values of an integer N-dimensional variable are ordinary inputs, so they are in the list that getInputVariables() returns. That list has one variable <name>@<i1>,<i2>,... for each element.

      Returns:
      an empty list
    • getInputVariables

      public List<COptQuestVariable> getInputVariables()
      Description copied from class: COptQuestManifoldVariable
      Returns the ordinary decision variables of this manifold variable.

      The engine chooses these values directly. Your evaluator reads them as inputs. The item selection and budgeted selection types use this list, and so do the vector, matrix and N-dimensional types of continuous, integer, discrete and binary variables. For every other type, the list is empty.

      Specified by:
      getInputVariables in class COptQuestManifoldVariable
      Returns:
      fixed-size or immutable list of input variables; never null