|
PPL
0.12.1
|
An std::set of variables' indexes. More...
#include <Variables_Set.defs.hh>
Public Member Functions | |
| Variables_Set () | |
| Builds the empty set of variable indexes. | |
| Variables_Set (const Variable v) | |
Builds the singleton set of indexes containing v.id();. | |
| Variables_Set (const Variable v, const Variable w) | |
Builds the set of variables's indexes in the range from v.id() to w.id(). | |
| dimension_type | space_dimension () const |
| Returns the dimension of the smallest vector space enclosing all the variables whose indexes are in the set. | |
| void | insert (Variable v) |
Inserts the index of variable v into the set. | |
| 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. | |
| 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<<. | |
Static Public Member Functions | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Variables_Set can handle. | |
Private Types | |
| typedef std::set< dimension_type > | Base |
Related Functions | |
(Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Variables_Set &vs) |
| std::ostream & | operator<< (std::ostream &s, const Variables_Set &vs) |
| Output operator. | |
An std::set of variables' indexes.
Definition at line 47 of file Variables_Set.defs.hh.
|
private |
Definition at line 50 of file Variables_Set.defs.hh.
Builds the empty set of variable indexes.
Definition at line 33 of file Variables_Set.inlines.hh.
: Base() { }
|
inlineexplicit |
Builds the singleton set of indexes containing v.id();.
Definition at line 43 of file Variables_Set.inlines.hh.
References insert().
| Parma_Polyhedra_Library::Variables_Set::Variables_Set | ( | const Variable | v, |
| const Variable | w | ||
| ) |
Builds the set of variables's indexes in the range from v.id() to w.id().
If v.id() <= w.id(), this constructor builds the set of variables' indexes v.id(), v.id()+1, ..., w.id(). The empty set is built otherwise.
Definition at line 30 of file Variables_Set.cc.
References Parma_Polyhedra_Library::Variable::id(), and insert().
: Base() { for (dimension_type d = v.id(), last = w.id(); d <= last; ++d) insert(d); }
| void Parma_Polyhedra_Library::Variables_Set::ascii_dump | ( | ) | const |
Writes to std::cerr an ASCII representation of *this.
| void Parma_Polyhedra_Library::Variables_Set::ascii_dump | ( | std::ostream & | s | ) | const |
Writes to s an ASCII representation of *this.
Definition at line 59 of file Variables_Set.cc.
{
dimension_type variables_set_size = size();
s << "\nvariables( " << variables_set_size << " )\n";
for (Variables_Set::const_iterator i = begin(),
i_end = end(); i != i_end; ++i)
s << *i << " ";
}
| bool Parma_Polyhedra_Library::Variables_Set::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.
Definition at line 70 of file Variables_Set.cc.
{
clear();
std::string str;
if (!(s >> str) || str != "variables(")
return false;
dimension_type size;
if (!(s >> size))
return false;
if (!(s >> str) || str != ")")
return false;
for (dimension_type i = 0; i < size; ++i) {
dimension_type variable_value;
if (!(s >> variable_value))
return false;
insert(variable_value);
}
return true;
}
Returns the size in bytes of the memory managed by *this.
Definition at line 60 of file Variables_Set.inlines.hh.
Referenced by total_memory_in_bytes().
{
// We assume sets are implemented by means of red-black trees that
// require to store the color (we assume an enum) and three pointers
// to the parent, left and right child, respectively.
enum color { red, black };
return size() * (sizeof(color) + 3*sizeof(void*) + sizeof(dimension_type));
}
|
inline |
Inserts the index of variable v into the set.
Definition at line 38 of file Variables_Set.inlines.hh.
References Parma_Polyhedra_Library::Variable::id().
Referenced by Parma_Polyhedra_Library::MIP_Problem::choose_branching_variable(), Parma_Polyhedra_Library::PIP_Solution_Node::generate_cut(), Parma_Polyhedra_Library::PIP_Solution_Node::update_tableau(), Variables_Set(), and Parma_Polyhedra_Library::Implementation::wrap_assign().
{
insert(v.id());
}
Returns the maximum space dimension a Variables_Set can handle.
Definition at line 49 of file Variables_Set.inlines.hh.
{
return Variable::max_space_dimension();
}
| bool Parma_Polyhedra_Library::Variables_Set::OK | ( | ) | const |
Checks if all the invariants are satisfied.
Definition at line 37 of file Variables_Set.cc.
References Parma_Polyhedra_Library::Variable::OK().
{
for (const_iterator i = begin(), set_end = end(); i != set_end; ++i)
if (!Variable(*i).OK())
return false;
return true;
}
| void Parma_Polyhedra_Library::Variables_Set::print | ( | ) | const |
Prints *this to std::cerr using operator<<.
|
inline |
Returns the dimension of the smallest vector space enclosing all the variables whose indexes are in the set.
Definition at line 54 of file Variables_Set.inlines.hh.
Referenced by Parma_Polyhedra_Library::MIP_Problem::add_to_integer_space_dimensions(), Parma_Polyhedra_Library::PIP_Problem::add_to_parameter_space_dimensions(), Parma_Polyhedra_Library::Box< ITV >::drop_some_non_integer_points(), Parma_Polyhedra_Library::Octagonal_Shape< T >::drop_some_non_integer_points(), Parma_Polyhedra_Library::BD_Shape< T >::drop_some_non_integer_points(), Parma_Polyhedra_Library::Grid::drop_some_non_integer_points(), Parma_Polyhedra_Library::Box< ITV >::fold_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::BD_Shape< T >::fold_space_dimensions(), Parma_Polyhedra_Library::Grid::fold_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::fold_space_dimensions(), Parma_Polyhedra_Library::MIP_Problem::MIP_Problem(), Parma_Polyhedra_Library::PIP_Problem::PIP_Problem(), Parma_Polyhedra_Library::Grid_Generator_System::remove_space_dimensions(), Parma_Polyhedra_Library::Box< ITV >::remove_space_dimensions(), Parma_Polyhedra_Library::Octagonal_Shape< T >::remove_space_dimensions(), Parma_Polyhedra_Library::BD_Shape< T >::remove_space_dimensions(), Parma_Polyhedra_Library::Grid::remove_space_dimensions(), Parma_Polyhedra_Library::Polyhedron::remove_space_dimensions(), Parma_Polyhedra_Library::Box< ITV >::unconstrain(), Parma_Polyhedra_Library::Polyhedron::unconstrain(), Parma_Polyhedra_Library::Octagonal_Shape< T >::unconstrain(), Parma_Polyhedra_Library::Grid::unconstrain(), Parma_Polyhedra_Library::BD_Shape< T >::unconstrain(), Parma_Polyhedra_Library::Implementation::wrap_assign(), Parma_Polyhedra_Library::Box< ITV >::wrap_assign(), and Parma_Polyhedra_Library::Grid::wrap_assign().
{
reverse_iterator i = rbegin();
return (i == rend()) ? 0 : (*i + 1);
}
Returns the total size in bytes of the memory occupied by *this.
Definition at line 69 of file Variables_Set.inlines.hh.
References external_memory_in_bytes().
{
return sizeof(*this) + external_memory_in_bytes();
}
|
related |
Output operator.
|
related |
Definition at line 46 of file Variables_Set.cc.
{
s << '{';
for (Variables_Set::const_iterator i = vs.begin(),
vs_end = vs.end(); i != vs_end; ) {
s << ' ' << Variable(*i++);
if (i != vs_end)
s << ',';
}
s << " }";
return s;
}