Domains Module
==============
+This module provides classes and functions to deal with polyhedral
+domains, i.e. unions of polyhedra.
+
.. py:class :: Domain
- .. py:method:: polyhedra(self)
-
- Return .
-
-Domain Properties
------------------
- .. py:method:: symbols(self)
-
- Returns a list of the symbols used in a set.
+ This class represents polyhedral domains, i.e. unions of polyhedra.
- .. py:method:: dimension(self)
+ .. py:method:: __new__(cls, *polyhedra)
- Returns the number of variables in a set.
+ Create and return a new domain from a string or a list of polyhedra.
- .. py:method:: disjoint(self)
+ .. attribute:: polyhedra
- Returns a set as disjoint.
-
- .. py:method:: num_parameters(self)
-
- Returns the total number of parameters, input, output or set dimensions.
-
- .. py:method:: involves_dims(self, dims)
+ The tuple of polyhedra which constitute the domain.
- Returns true if set depends on given dimensions.
-
-Unary Properties
-----------------
+ .. attribute:: symbols
+
+ Returns a tuple of the symbols that exsist in a domain.
+
+ .. attribute:: dimension
+
+ Returns the number of variables that exist in a domain.
+
.. py:method:: isempty(self)
-
- Return true is set is an Empty set.
+
+ Return ``True`` is a domain is empty.
- .. py:method:: isuniverse(self)
+ .. py:method:: __bool__(self)
- Return true if set is the Universe set.
-
+ Return ``True`` if the domain is non-empty.
+
+ .. py:method:: isuniverse(self)
+
+ Return ``True`` if a domain is the Universe set.
+
.. py:method:: isbounded(self)
-
- Return true if set is bounded
- .. py:method:: disjoint(self)
-
- Returns this set as a disjoint set.
+ Return ``True`` if a domain is bounded.
-Binary Properties
------------------
+ .. py:method:: make_disjoint(self)
+
+ It is not guarenteed that a domain is disjoint. If it is necessary, this method will return an equivalent domain, whose polyhedra are disjoint.
.. py:method:: isdisjoint(self, other)
-
- Return true if the intersection of two sets results in an Empty set.
-
+
+ Return ``True`` if the intersection of *self* and *other* results in an empty set.
+
.. py:method:: issubset(self, other)
-
- Returns true if one set contains the other set.
+
+ Test whether every element in a domain is in *other*.
.. py:method:: __eq__(self, other)
-
- Return true if self == other.
-
+ self == other
+
+ Test whether a domain is equal to *other*.
+
.. py:method:: __lt__(self, other)
-
- Return true if self < other.
-
+ self < other
+
+ Test whether a domain is a strict subset of *other*.
+
.. py:method:: __le__(self, other)
-
- Return true if self <= other.
-
+ self <= other
+
+ Test whether every element in a domain is in *other*.
+
.. py:method:: __gt__(self, other)
-
- Return true if self > other.
-
+ self > other
+
+ Test whether a domain is a strict superset of *other*.
+
.. py:method:: __ge__(self, other)
-
- Return true if self >= other.
-
+ self >= other
-Unary Operations
-----------------
+ Test whether every element in *other* is in a domain.
.. py:method:: complement(self)
+ ~self
+
+ Return the complementary domain of a domain.
+
+ .. py:method:: coalesce(self)
- Return the complement of a set.
+ Simplify the representation of the domain by trying to combine pairs of
+ polyhedra into a single polyhedron.
+
+ .. py:method:: detect_equalities(self)
+
+ Simplify the representation of the domain by detecting implicit
+ equalities.
+
.. py:method:: simplify(self)
- Removes redundant constraints from a set.
+ Return a new domain without any redundant constraints.
- .. py:method:: project(self, dims)
-
- Return a new set with the given dimensions removed.
+ .. py:method:: project(self, variables)
+
+ Return a new domain with the given variables removed.
.. py:method:: aspolyhedron(self)
-
- Return polyhedral hull of a set.
-
- .. py:method:: asdomain(self)
-
- Return
+
+ Return polyhedral hull of a domain.
.. py:method:: sample(self)
-
- Return a single sample subset of a set.
-Binary Operations
------------------
+ Return a single sample subset of a domain.
- .. py:method:: intersection(self)
-
- Return the intersection of two sets as a new set.
+ .. py:method:: intersection(self, other)
+ __or__
+ self | other
- .. py:method:: union(self)
-
- Return the union of two sets as a new set.
+ Return a new domain with the elements that are common between *self* and *other*.
- .. py:method:: __and__(self, other)
-
- Return the union of two sets as a new set.
-
- .. py:method:: __or__(self, other)
-
- Return the intersection of two sets as a new set.
-
- .. py:method:: __add__(self, other)
-
- Return the sum of two sets.
+ .. py:method:: union(self, other)
+ __and__
+ self & other
+
+ Return a new domain with all the elements from *self* and *other*.
.. py:method:: difference(self, other)
-
- Return the difference of two sets.
+ __sub__
+ self - other
-Lexiographic Operations
------------------------
+ Return a new domain with the elements in a domain that are not in *other* .
+
+ .. py:method:: __add__(self, other)
+ self + other
+
+ Return the sum of two domains.
.. py:method:: lexmin(self)
-
- Return a new set containing the lexicographic minimum of the elements in the set.
-
+
+ Return a new domain containing the lexicographic minimum of the elements in the domain.
+
.. py:method:: lexmax(self)
+
+ Return a new domain containing the lexicographic maximum of the elements in the domain.
+
+ .. py:method:: subs(self, symbol, expression=None):
+
+ Subsitute symbol by expression in equations and return the resulting
+ domain.
+
+ .. py:method:: fromstring(cls, string)
+
+ Convert a string into a domain.
+
+ .. py:method:: fromsympy(cls, expr)
- Return a new set containing the lexicographic maximum of the elements in the set.
+ Convert a SymPy expression into a domain.
-Plot Properties
----------------
+ .. py:method:: tosympy(self)
+
+ Convert a domain into a SymPy expression.
+
+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.
.. py:method:: points(self)
+
+ Return a list of the points with integer coordinates contained in a domain as :class:`Points` objects.
+
+ .. py:method:: __contains__(self, point)
- Return a list of the points contained in a set.
+ Return ``True`` if point if contained within the domain.
.. py:method:: vertices(self)
-
- Return a list of the verticies of this set.
-
+
+ Return a list of the verticies of a domain.
+
.. py:method:: faces(self)
-
- Return a list of the vertices for each face of a set.
-
+
+ Return a list of the vertices for each face of a domain.
+
.. py:method:: plot(self, plot=None, **kwargs)
-
- Return a plot of the given set.
-
-
-
+
+ Return a plot of the given domain or add a plot to a plot instance, using matplotlib.