#include <PowerSet.h> using namespace polymake;
template <class ElementType, class ElementComparator=BuildBinary<operations::cmp> > class PowerSet : public Set< Set<ElementType, ElementComparator> >;
As the name says, this is a set of subsets of a base set of ElementType.
There is nothing special about this class, it was introduced mainly as a convenient shortcut for
Set< Set<ElementType> > it is derived from. Due to the
AVL tree data representation, the subsets appear in the
lexicographical order. The base set is encoded only implicitly, as a union of all contained
subsets.
The PowerSet class in its current implementation is definitely not the optimal tool
for representing a power set.
For a base set of non-negative integer numbers, you may get much better performance with a hashing
container, e.g. std_ext::hash_set< Bitset >.
PowerSet has the same set of constructors as Set;
it defines merely two own methods:
| 0 | a subset equal to s was found, power set unchanged |
| -1 | a subset including s (insertMax) or
included in s (insertMin) was found, power set unchanged
|
| 1 | s added to the power set, some other subsets might have been deleted:
included in s (insertMax) or including s (insertMin.)
|
FacetList class, but with the same restriction
as by Bitset: the base set has to be a contiguous range of non-negative integer numbers.
The following classes model power sets in some special but often occuring cases much more efficiently
than PowerSet would do.
The element subsets are not physically stored, but rather generated "on the fly" in the course
of iteration over the power set.
These constructions can be applied to every class conforming to the STL container interface.
However, the resulting power sets belong to the GenericSet family
if and only if the base container is also a GenericSet, since only this assures that the generated
subsets will appear in the lexicographical order. For the sake of brevity, we will nevertheless refer to the basic
container as a set.