4 This module provides classes and functions to deal with polyhedral
5 domains, i.e. unions of polyhedra.
9 This class represents polyhedral domains, i.e. unions of polyhedra.
11 .. py:method:: __new__(cls, *polyhedra)
13 Create and return a new domain from a string or a list of polyhedra.
15 .. attribute:: polyhedra
17 The tuple of polyhedra which constitute the domain.
19 .. attribute:: symbols
21 Returns a tuple of the symbols that exsist in a domain.
23 .. attribute:: dimension
25 Returns the number of variables that exist in a domain.
27 .. py:method:: isempty(self)
29 Return ``True`` is a domain is empty.
31 .. py:method:: __bool__(self)
33 Return ``True`` if the domain is non-empty.
35 .. py:method:: isuniverse(self)
37 Return ``True`` if a domain is the Universe set.
39 .. py:method:: isbounded(self)
41 Return ``True`` if a domain is bounded.
43 .. py:method:: make_disjoint(self)
45 It is not guarenteed that a domain is disjoint. If it is necessary, this method will return an equivalent domain, whose polyhedra are disjoint.
47 .. py:method:: isdisjoint(self, other)
49 Return ``True`` if the intersection of *self* and *other* results in an empty set.
51 .. py:method:: issubset(self, other)
53 Test whether every element in a domain is in *other*.
55 .. py:method:: __eq__(self, other)
58 Test whether a domain is equal to *other*.
60 .. py:method:: __lt__(self, other)
63 Test whether a domain is a strict subset of *other*.
65 .. py:method:: __le__(self, other)
68 Test whether every element in a domain is in *other*.
70 .. py:method:: __gt__(self, other)
73 Test whether a domain is a strict superset of *other*.
75 .. py:method:: __ge__(self, other)
78 Test whether every element in *other* is in a domain.
80 .. py:method:: complement(self)
83 Return the complementary domain of a domain.
85 .. py:method:: coalesce(self)
87 Simplify the representation of the domain by trying to combine pairs of
88 polyhedra into a single polyhedron.
91 .. py:method:: detect_equalities(self)
93 Simplify the representation of the domain by detecting implicit
96 .. py:method:: simplify(self)
98 Return a new domain without any redundant constraints.
100 .. py:method:: project(self, variables)
102 Return a new domain with the given variables removed.
104 .. py:method:: aspolyhedron(self)
106 Return polyhedral hull of a domain.
108 .. py:method:: sample(self)
110 Return a single sample subset of a domain.
112 .. py:method:: intersection(self, other)
116 Return a new domain with the elements that are common between *self* and *other*.
118 .. py:method:: union(self, other)
122 Return a new domain with all the elements from *self* and *other*.
124 .. py:method:: difference(self, other)
128 Return a new domain with the elements in a domain that are not in *other* .
130 .. py:method:: __add__(self, other)
133 Return the sum of two domains.
135 .. py:method:: lexmin(self)
137 Return a new domain containing the lexicographic minimum of the elements in the domain.
139 .. py:method:: lexmax(self)
141 Return a new domain containing the lexicographic maximum of the elements in the domain.
143 .. py:method:: subs(self, symbol, expression=None):
145 Subsitute symbol by expression in equations and return the resulting
148 .. py:method:: fromstring(cls, string)
150 Convert a string into a domain.
152 .. py:method:: fromsympy(cls, expr)
154 Convert a SymPy expression into a domain.
156 .. py:method:: tosympy(self)
158 Convert a domain into a SymPy expression.
160 A 2D or 3D domain can be plotted using the :meth:`plot` method. The points, vertices, and faces of a domain can be inspected using the following functions.
162 .. py:method:: points(self)
164 Return a list of the points with integer coordinates contained in a domain as :class:`Points` objects.
166 .. py:method:: __contains__(self, point)
168 Return ``True`` if point if contained within the domain.
170 .. py:method:: vertices(self)
172 Return a list of the verticies of a domain.
174 .. py:method:: faces(self)
176 Return a list of the vertices for each face of a domain.
178 .. py:method:: plot(self, plot=None, **kwargs)
180 Return a plot of the given domain or add a plot to a plot instance, using matplotlib.