Combination
dstz.element.combination
powerset(simple_space, allow_empty=False)
Generates the power set from a given set of elements.
The power set is the set of all possible subsets of the input
simple_space. Each subset is wrapped in an Element object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
simple_space
|
set
|
The input set of elements for which to generate the power set. |
required |
allow_empty
|
bool
|
If |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
set |
A set of |
Example
s = {Element('A'), Element('B')} powerset(s, allow_empty=True) {Element(set()), Element({'A'}), Element({'B'}), Element({'A', 'B'})}
Source code in dstz/element/combination.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
simple_space(n)
Generates a simple set of elements.
Creates a set of 'n' unique Element objects, where each element's
value is a consecutive uppercase letter starting from 'A'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
The number of elements to generate in the space. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
set |
A set containing the generated |
Example
simple_space(3) {Element('A'), Element('B'), Element('C')}
Source code in dstz/element/combination.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |