X-Git-Url: https://svn.cri.ensmp.fr/git/linpy.git/blobdiff_plain/997e3c68590b274c372a6785cda5a69887683891..197818714e75c2353ed8b7c9fec653f1212f13ae:/doc/domain.rst diff --git a/doc/domain.rst b/doc/domain.rst index edf8934..06eec6e 100644 --- a/doc/domain.rst +++ b/doc/domain.rst @@ -1,27 +1,36 @@ Domains Module ============== -.. py:class :: Domain - - .. py:method:: symbols +This module provides classes and functions to deal with polyhedral +domains, i.e. unions of polyhedra. - Returns a tuple of the symbols that exsist in a domain. +.. py:class :: Domain - .. py:method:: dimension + This class represents polyhedral domains, i.e. unions of polyhedra. - Returns the number of variables that exist in a domain. + .. py:method:: __new__(cls, *polyhedra) + + Create and return a new domain from a string or a list of polyhedra. - .. py:method:: disjoint + .. attribute:: polyhedra + + The tuple of polyhedra which constitute the domain. + + .. attribute:: symbols - Returns a domain as disjoint. + Returns a tuple of the symbols that exsist in a domain. - .. py:method:: involves_vars(self, dims) + .. attribute:: dimension - Returns ``True`` if a domain depends on the given dimensions. + Returns the number of variables that exist in a domain. .. py:method:: isempty(self) Return ``True`` is a domain is empty. + + .. py:method:: __bool__(self) + + Return ``True`` if the domain is non-empty. .. py:method:: isuniverse(self) @@ -31,9 +40,9 @@ Domains Module Return ``True`` if a domain is bounded. - .. py:method:: disjoint(self) + .. py:method:: make_disjoint(self) - It is not guarenteed that a domain is disjoint. If it is necessary, this method will return a domain as disjoint. + 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) @@ -69,17 +78,28 @@ Domains Module Test whether every element in *other* is in a domain. .. py:method:: complement(self) - ¬self - - Return the complement of a domain. + ~self + + Return the complementary domain of a domain. + + .. py:method:: coalesce(self) + + 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) Return a new domain without any redundant constraints. - .. py:method:: project(self, dims) + .. py:method:: project(self, variables) - Return a new domain with the given dimensions removed. + Return a new domain with the given variables removed. .. py:method:: aspolyhedron(self) @@ -90,16 +110,19 @@ Domains Module Return a single sample subset of a domain. .. py:method:: intersection(self, other) + __or__ self | other Return a new domain with the elements that are common between *self* and *other*. .. 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) + __sub__ self - other Return a new domain with the elements in a domain that are not in *other* . @@ -111,18 +134,38 @@ Domains Module .. 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 set containing the lexicographic maximum of the elements in the set. + 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) + + Convert a SymPy expression into a domain. + + .. py:method:: tosympy(self) + + Convert a domain into a SymPy expression. -A 2D or 3D domain can be plotted using the :meth:`plot` function. The points, verticies, and faces of a domain can be inspected using the following functions. +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 contained in a domain as :class:`Points` objects. + Return a list of the points with integer coordinates contained in a domain as :class:`Points` objects. + + .. py:method:: __contains__(self, point) + + Return ``True`` if point if contained within the domain. .. py:method:: vertices(self) @@ -134,4 +177,4 @@ A 2D or 3D domain can be plotted using the :meth:`plot` function. The points, ve .. py:method:: plot(self, plot=None, **kwargs) - Return a plot of the given domain. + Return a plot of the given domain or add a plot to a plot instance, using matplotlib.