Class COptQuestBudgetedSelectionVariable
The engine adds the budget rule, and the optional count rule, to the model as constraints, so a solution that does not meet a rule 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.AddBudgetedSelectionVariable
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
ConstructorsConstructorDescriptionCOptQuestBudgetedSelectionVariable(String name, int n, double[] costs, double budgetMax) Creates a budgeted selection variable whose selected candidates cost at mostbudgetMax.COptQuestBudgetedSelectionVariable(String name, int n, double[] costs, double budgetMin, double budgetMax, int kMin, int kMax) Creates a budgeted selection variable with a budget range and a range for the number of selected candidates. -
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 a budgeted selection variable has no output variables.Returns an empty list, because the values of a budgeted 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
-
COptQuestBudgetedSelectionVariable
public COptQuestBudgetedSelectionVariable(String name, int n, double[] costs, double budgetMin, double budgetMax, int kMin, int kMax) throws COptQuestException Creates a budgeted selection variable with a budget range and a range for the number of selected candidates.- Parameters:
name- base name of the variablen- number of candidates; must be at least 1costs- cost of each candidate, one entry for each candidatebudgetMin- smallest total cost of the selected candidates; 0 or less for no smallest totalbudgetMax- largest total cost of the selected candidateskMin- smallest number of candidates to select; 0 for no smallest numberkMax- largest number of candidates to select;nfor no largest number- Throws:
COptQuestException- ifnis less than 1, ifcostsis null or does not havenentries, if no selection has fromkMintokMaxcandidates, ifbudgetMaxis less than the lowest possible total cost, or ifbudgetMinis positive and greater thanbudgetMaxor than the highest possible total cost
-
COptQuestBudgetedSelectionVariable
public COptQuestBudgetedSelectionVariable(String name, int n, double[] costs, double budgetMax) throws COptQuestException Creates a budgeted selection variable whose selected candidates cost at mostbudgetMax.- Parameters:
name- base name of the variablen- number of candidates; must be at least 1costs- cost of each candidate, one entry for each candidatebudgetMax- largest total cost of the selected candidates- Throws:
COptQuestException- ifnis less than 1, ifcostsis null or does not havenentries, or ifbudgetMaxis less than the lowest possible total cost
-
-
Method Details
-
getProjectedInputVariables
Returns an empty list, because the values of a budgeted 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 a budgeted selection variable has no output variables.The values of a budgeted 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
-