- Main Page
- Modules
- Namespaces
- Classes
- Related Pages

- Class List
- Class Hierarchy
- Class Members

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

A system of constraints. More...

List of all members.

## 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 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_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.
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.
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 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`.
## Classes
class | const_iterator
| An iterator over a system of constraints. More...

## 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 ", ".