Class COptQuestPartitionVariable
m items into exactly k
groups. The groups have no order, and no group is empty. Use a partition variable when the
decision is a division of items into groups, such as crews into shifts or customers into
delivery zones.
In every solution that the engine generates, every group has at least one item, and the same division into groups always gets the same group numbers.
Variable names: <name>@1 to <name>@m, one for each item. The value of
each name is the number of the group that the item is in, counted from 1. Item 1 is always in
group 1. For each later item, the group number is at most one more than the largest group number
among the items before it.
In a suggested solution, the engine rounds each value to the nearest group number from
1 to k. It then fills any empty group and numbers the groups again, so the values
can change.
In most programs, you add this variable with
OptQuestModel.AddPartitionVariable
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
ConstructorsConstructorDescriptionCOptQuestPartitionVariable(String name, int m, int k) Creates a partition variable that dividesmitems intokgroups. -
Method Summary
Modifier and TypeMethodDescriptionReturns the constraints that this manifold variable adds to the model.Returns an empty list, because a partition variable has no ordinary input variables.Returns an empty list, because a partition variable has no output variables.Returns the decision values of this manifold variable that are not ordinary decision variables.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
-
COptQuestPartitionVariable
Creates a partition variable that dividesmitems intokgroups.- Parameters:
name- base name of the variablem- number of items; must be at leastkk- number of groups; must be at least 1- Throws:
COptQuestException- ifkis less than 1 ormis less thank
-
-
Method Details
-
getInputVariables
Returns an empty list, because a partition variable has no ordinary input variables.The values of a partition variable are in the list that
getProjectedInputVariables()returns. That list has the variables<name>@1to<name>@m, one for each item.- Returns:
- an empty list
-
getOutputVariables
Returns an empty list, because a partition variable has no output variables.The values of a partition variable are in the list that
getProjectedInputVariables()returns. That list has the variables<name>@1to<name>@m, one for each item.- Returns:
- an empty list
-
getProjectedInputVariables
Description copied from class:COptQuestManifoldVariableReturns 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 onemix@<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:
getProjectedInputVariablesin classCOptQuestManifoldVariable- Returns:
- fixed-size or immutable list of these 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
-