public final class Combinator extends Object
Uses the indexing schema introduced in
CombinationUtil.
| Modifier and Type | Method and Description |
|---|---|
static List<int[]> |
computeCartesianProduct(it.unimi.dsi.fastutil.ints.Int2IntMap parameters,
int combinationSize)
Computes the full cartesian product of the given parameters.
|
static Set<int[]> |
computeCombinations(int[] parameters,
int size)
Computes all size-value-combinations there are with the given parameters.
|
static List<it.unimi.dsi.fastutil.ints.IntSet> |
computeNegativeParameterCombinations(int[] parameters,
int[] negativeParameters,
int size)
Computes subsets of parameter indices with the given size multiplied with negative parameters
|
static List<it.unimi.dsi.fastutil.ints.IntSet> |
computeParameterCombinations(int[] parameters,
int size)
Computes all subsets of parameter indices with the given size.
|
static List<int[]> |
computeSubCombinations(int[] combination)
Computes all sub-combinations of this combination.
|
static List<int[]> |
computeSubCombinations(int[] combination,
int size)
Computes all sub-combinations with the given size that the combination has.
|
public static List<int[]> computeCartesianProduct(it.unimi.dsi.fastutil.ints.Int2IntMap parameters, int combinationSize)
parameters - the parameters for whose values the cartesian product
shall be computed. Must no be null or emptycombinationSize - the size of the combinations returned. Empty
places are filled with
CombinationUtil.NO_VALUE.
Must not be smaller than the number of parametersNullPointerException - if parameters is nullIllegalArgumentException - if there are no parameters or if the
combinationsSize is too smallpublic static List<it.unimi.dsi.fastutil.ints.IntSet> computeParameterCombinations(int[] parameters, int size)
parameters - the set of parameters for which all subsets shall be
generated. Must not be nullsize - the size of the returned subsets. Must not be negative or
greater than the number of parametersNullPointerException - if parameters is nullIllegalArgumentException - if the size is negative or too largepublic static List<it.unimi.dsi.fastutil.ints.IntSet> computeNegativeParameterCombinations(int[] parameters, int[] negativeParameters, int size)
For example, f( [0, 1, 2, 3], [ 0 ], 0) == { (0) } f( [0, 1, 2, 3], [ 0 ], 1) == { (0, 1), (0, 2), (0, 3) } f( [0, 1, 2, 3], [ 0 ], 2) == { (0, 1, 2), (0, 1, 3), (0, 2, 3) } f( [0, 1, 2, 3], [ 0 ], 3) == { (0, 1, 2, 3) } f( [0, 1, 2, 3], [ 0 ], 4) == { (0, 1, 2, 3) } f( [0, 1, 2, 3], [ 0 ], 5) == { (0, 1, 2, 3) }
parameters - the set of parameters for which all subsets shall be
generated. Must not be nullnegativeParameters - the subset of parameters which are always presentsize - the size of the returned subsets. Must not be negative or
greater than the number of parametersNullPointerException - if parameters is nullIllegalArgumentException - if the size is negative or too largepublic static Set<int[]> computeCombinations(int[] parameters, int size)
parameters - all parameters. They are defined as their number of values. So [2, 3] means the first parameter
has two values, and the second one has three. Must not be nullsize - the size of sub-combinations of values in the parameters that are calculatedpublic static List<int[]> computeSubCombinations(int[] combination, int size)
combination - a combination. Must not be nullsize - the size of sub-combinations. Must be positivepublic static List<int[]> computeSubCombinations(int[] combination)
computeCombinations(int[], int) with sizes from 1 to combinations.length.combination - a combination. Must not be null but can have unset valuesCopyright © 2019. All rights reserved.