Remove license and add to doc examples
[linpy.git] / doc / domain.rst
1 Domains Module
2 ==============
3
4 This module provides classes and functions to deal with polyhedral
5 domains, i.e. unions of polyhedra.
6
7 .. py:class :: Domain
8
9 This class represents polyhedral domains, i.e. unions of polyhedra.
10
11 .. py:method:: __new__(cls, *polyhedra)
12
13 Create and return a new domain from a string or a list of polyhedra.
14
15 .. attribute:: polyhedra
16
17 The tuple of polyhedra which constitute the domain.
18
19 .. attribute:: symbols
20
21 Returns a tuple of the symbols that exsist in a domain.
22
23 .. attribute:: dimension
24
25 Returns the number of variables that exist in a domain.
26
27 .. py:method:: isempty(self)
28
29 Return ``True`` is a domain is empty.
30
31 .. py:method:: __bool__(self)
32
33 Return ``True`` if the domain is non-empty.
34
35 .. py:method:: isuniverse(self)
36
37 Return ``True`` if a domain is the Universe set.
38
39 .. py:method:: isbounded(self)
40
41 Return ``True`` if a domain is bounded.
42
43 .. py:method:: make_disjoint(self)
44
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.
46
47 .. py:method:: isdisjoint(self, other)
48
49 Return ``True`` if the intersection of *self* and *other* results in an empty set.
50
51 .. py:method:: issubset(self, other)
52
53 Test whether every element in a domain is in *other*.
54
55 .. py:method:: __eq__(self, other)
56 self == other
57
58 Test whether a domain is equal to *other*.
59
60 .. py:method:: __lt__(self, other)
61 self < other
62
63 Test whether a domain is a strict subset of *other*.
64
65 .. py:method:: __le__(self, other)
66 self <= other
67
68 Test whether every element in a domain is in *other*.
69
70 .. py:method:: __gt__(self, other)
71 self > other
72
73 Test whether a domain is a strict superset of *other*.
74
75 .. py:method:: __ge__(self, other)
76 self >= other
77
78 Test whether every element in *other* is in a domain.
79
80 .. py:method:: complement(self)
81 ~self
82
83 Return the complementary domain of a domain.
84
85 .. py:method:: coalesce(self)
86
87 Simplify the representation of the domain by trying to combine pairs of
88 polyhedra into a single polyhedron.
89
90
91 .. py:method:: detect_equalities(self)
92
93 Simplify the representation of the domain by detecting implicit
94 equalities.
95
96 .. py:method:: simplify(self)
97
98 Return a new domain without any redundant constraints.
99
100 .. py:method:: project(self, variables)
101
102 Return a new domain with the given variables removed.
103
104 .. py:method:: aspolyhedron(self)
105
106 Return polyhedral hull of a domain.
107
108 .. py:method:: sample(self)
109
110 Return a single sample subset of a domain.
111
112 .. py:method:: intersection(self, other)
113 __or__
114 self | other
115
116 Return a new domain with the elements that are common between *self* and *other*.
117
118 .. py:method:: union(self, other)
119 __and__
120 self & other
121
122 Return a new domain with all the elements from *self* and *other*.
123
124 .. py:method:: difference(self, other)
125 __sub__
126 self - other
127
128 Return a new domain with the elements in a domain that are not in *other* .
129
130 .. py:method:: __add__(self, other)
131 self + other
132
133 Return the sum of two domains.
134
135 .. py:method:: lexmin(self)
136
137 Return a new domain containing the lexicographic minimum of the elements in the domain.
138
139 .. py:method:: lexmax(self)
140
141 Return a new domain containing the lexicographic maximum of the elements in the domain.
142
143 .. py:method:: subs(self, symbol, expression=None):
144
145 Subsitute symbol by expression in equations and return the resulting
146 domain.
147
148 .. py:method:: fromstring(cls, string)
149
150 Convert a string into a domain.
151
152 .. py:method:: fromsympy(cls, expr)
153
154 Convert a SymPy expression into a domain.
155
156 .. py:method:: tosympy(self)
157
158 Convert a domain into a SymPy expression.
159
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.
161
162 .. py:method:: points(self)
163
164 Return a list of the points with integer coordinates contained in a domain as :class:`Points` objects.
165
166 .. py:method:: __contains__(self, point)
167
168 Return ``True`` if point if contained within the domain.
169
170 .. py:method:: vertices(self)
171
172 Return a list of the verticies of a domain.
173
174 .. py:method:: faces(self)
175
176 Return a list of the vertices for each face of a domain.
177
178 .. py:method:: plot(self, plot=None, **kwargs)
179
180 Return a plot of the given domain or add a plot to a plot instance, using matplotlib.