Class COptQuestItemSelectionVariable
kMin to kMax. Use an item selection variable
when the decision is which candidates to include, such as which sites to open.
The engine adds the selection rule to the model as a constraint, so a solution that
selects fewer than kMin or more than kMax candidates is infeasible.
Variable names: <name>@1 to <name>@n, one for each candidate. These are
ordinary binary inputs. The value of each name is 1 if the candidate is selected and 0 if it is
not.
In most programs, you add this variable with one of the
OptQuestModel.AddItemSelectionVariable
methods 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
ConstructorsConstructorDescriptionCOptQuestItemSelectionVariable(String name, int n, int k) Creates an item selection variable that selects exactlykofncandidates.COptQuestItemSelectionVariable(String name, int n, int kMin, int kMax) Creates an item selection variable that selects fromkMintokMaxofncandidates. -
Method Summary
Modifier and TypeMethodDescriptionReturns the constraints that this manifold variable adds to the model.Returns the ordinary decision variables of this manifold variable.Returns an empty list, because an item selection variable has no output variables.Returns an empty list, because the values of an item selection variable are ordinary inputs.Methods 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
-
COptQuestItemSelectionVariable
public COptQuestItemSelectionVariable(String name, int n, int kMin, int kMax) throws COptQuestException Creates an item selection variable that selects fromkMintokMaxofncandidates.- Parameters:
name- base name of the variablen- number of candidates; must be at least 1kMin- smallest number of candidates to select; must be at least 0kMax- largest number of candidates to select; must be fromkMinton- Throws:
COptQuestException- ifnis less than 1, or if no selection has fromkMintokMaxcandidates
-
COptQuestItemSelectionVariable
Creates an item selection variable that selects exactlykofncandidates.- Parameters:
name- base name of the variablen- number of candidates; must be at least 1k- number of candidates to select; must be from 0 ton- Throws:
COptQuestException- ifnis less than 1, or ifkis less than 0 or greater thann
-
-
Method Details
-
getProjectedInputVariables
Returns an empty list, because the values of an item selection variable are ordinary inputs.The values are in the list that
getInputVariables()returns. That list has the variables<name>@1to<name>@n, one for each candidate.- Returns:
- an empty list
-
getOutputVariables
Returns an empty list, because an item selection variable has no output variables.The values of an item selection variable are ordinary inputs, so they are in the list that
getInputVariables()returns. That list has the variables<name>@1to<name>@n, one for each candidate.- Returns:
- an empty list
-
getInputVariables
Description copied from class:COptQuestManifoldVariableReturns 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:
getInputVariablesin classCOptQuestManifoldVariable- Returns:
- fixed-size or immutable list of input variables; never
null
-
getConstraints
Description copied from class:COptQuestManifoldVariableReturns the constraints that this manifold variable adds to the model.The engine adds these constraints to the model when the variable is added. Most manifold variable types add no constraints and return an empty list.
- Overrides:
getConstraintsin classCOptQuestManifoldVariable- Returns:
- list of constraints; never
null
-