# Parma_Polyhedra_Library::Constraint_System Class Reference
[C++ Language Interface]

A system of constraints. More...

`#include <ppl.hh>`

Inherits Parma_Polyhedra_Library::Linear_System.

List of all members.

## Classes
class | const_iterator
| An iterator over a system of constraints. More...
## Public Member Functions
| Constraint_System ()
| Default constructor: builds an empty system of constraints.
| Constraint_System (const Constraint &c)
| Builds the singleton system containing only constraint `c`.
| Constraint_System (const Congruence_System &cgs)
| Builds a system containing copies of any equalities in `cgs`.
| Constraint_System (const Constraint_System &cs)
| Ordinary copy constructor.
| ~Constraint_System ()
| Destructor.
Constraint_System & | operator= (const Constraint_System &y)
| Assignment operator.
dimension_type | space_dimension () const
| Returns the dimension of the vector space enclosing `*this`.
bool | has_equalities () const
| Returns `true` if and only if `*this` contains one or more equality constraints.
bool | has_strict_inequalities () const
| Returns `true` if and only if `*this` contains one or more strict inequality constraints.
void | clear ()
| Removes all the constraints from the constraint system and sets its space dimension to 0.
void | insert (const Constraint &c)
| Inserts in `*this` a copy of the constraint `c`, increasing the number of space dimensions if needed.
bool | empty () const
| Returns `true` if and only if `*this` has no constraints.
const_iterator | begin () const
| Returns the const_iterator pointing to the first constraint, if `*this` is not empty; otherwise, returns the past-the-end const_iterator.
const_iterator | end () const
| Returns the past-the-end const_iterator.
bool | OK () const
| Checks if all the invariants are satisfied.
void | ascii_dump () const
| Writes to `std::cerr` an ASCII representation of `*this`.
void | ascii_dump (std::ostream &s) const
| Writes to `s` an ASCII representation of `*this`.
void | print () const
| Prints `*this` to `std::cerr` using `operator<<`.
bool | ascii_load (std::istream &s)
| Loads from `s` an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets `*this` accordingly. Returns `true` if successful, `false` otherwise.
memory_size_type | total_memory_in_bytes () const
| Returns the total size in bytes of the memory occupied by `*this`.
memory_size_type | external_memory_in_bytes () const
| Returns the size in bytes of the memory managed by `*this`.
void | swap (Constraint_System &y)
| Swaps `*this` with `y`.
## Static Public Member Functions
static dimension_type | max_space_dimension ()
| Returns the maximum space dimension a Constraint_System can handle.
static void | initialize ()
| Initializes the class.
static void | finalize ()
| Finalizes the class.
static const Constraint_System & | zero_dim_empty ()
| Returns the singleton system containing only Constraint::zero_dim_false().
## Friends
bool | operator== (const Polyhedron &x, const Polyhedron &y)
| Returns `true` if and only if `x` and `y` are the same polyhedron.
## Related Functions
(Note that these are not member functions.)
std::ostream & | operator<< (std::ostream &s, const Constraint_System &cs)
| Output operator.
void | swap (Parma_Polyhedra_Library::Constraint_System &x, Parma_Polyhedra_Library::Constraint_System &y)
| Specializes `std::swap`.

## Detailed Description

A system of constraints.

An object of the class Constraint_System is a system of constraints, i.e., a multiset of objects of the class Constraint. When inserting constraints in a system, space dimensions are automatically adjusted so that all the constraints in the system are defined on the same vector space.

  In all the examples it is assumed that variables `x` and `y` are defined as follows:

        Variable x(0);
        Variable y(1);

Example 1
  The following code builds a system of constraints corresponding to a square in :

        Constraint_System cs;
        cs.insert(x >= 0);
        cs.insert(x <= 3);
        cs.insert(y >= 0);
        cs.insert(y <= 3);

  Note that: the constraint system is created with space dimension zero; the first and third constraint insertions increase the space dimension to and , respectively.

Example 2
  By adding four strict inequalities to the constraint system of the previous example, we can remove just the four vertices from the square defined above.

        cs.insert(x + y > 0);
        cs.insert(x + y < 6);
        cs.insert(x - y < 3);
        cs.insert(y - x < 3);

Example 3
  The following code builds a system of constraints corresponding to a half-strip in :

        Constraint_System cs;
        cs.insert(x >= 0);
        cs.insert(x - y <= 0);
        cs.insert(x - y + 1 >= 0);

Note:
  After inserting a multiset of constraints in a constraint system, there are no guarantees that an exact copy of them can be retrieved: in general, only an equivalent constraint system will be available, where original constraints may have been reordered, removed (if they are trivial, duplicate or implied by other constraints), linearly combined, etc.

## Friends And Related Function Documentation

bool operator== | ( | const Polyhedron & | x,
|  | const Polyhedron & | y |
| ) |  |  | `[friend]`

Returns `true` if and only if `x` and `y` are the same polyhedron.

Note that `x` and `y` may be topology- and/or dimension-incompatible polyhedra: in those cases, the value `false` is returned.

std::ostream & operator<< | ( | std::ostream & | s,
|  | const Constraint_System & | cs |
| ) |  |  | `[related]`

Output operator.

Writes `true` if `cs` is empty. Otherwise, writes on `s` the constraints of `cs`, all in one row and separated by ", ".

void swap | ( | Parma_Polyhedra_Library::Constraint_System & | x,
|  | Parma_Polyhedra_Library::Constraint_System & | y |
| ) |  |  | `[related]`

Specializes `std::swap`.

The documentation for this class was generated from the following file:

- ppl.hh