PPL
1.2
|
A tree node representing a decision in the space of solutions. More...
#include <PIP_Tree_defs.hh>
Public Member Functions | |
virtual PIP_Tree_Node * | clone () const |
Returns a pointer to a dynamically-allocated copy of *this . More... | |
virtual | ~PIP_Decision_Node () |
Destructor. More... | |
virtual bool | OK () const |
Returns true if and only if *this is well formed. More... | |
virtual const PIP_Decision_Node * | as_decision () const |
Returns this . More... | |
virtual const PIP_Solution_Node * | as_solution () const |
Returns 0, since this is not a solution node. More... | |
const PIP_Tree_Node * | child_node (bool b) const |
Returns a const pointer to the b (true or false) branch of *this . More... | |
PIP_Tree_Node * | child_node (bool b) |
Returns a pointer to the b (true or false) branch of *this . More... | |
void | ascii_dump (std::ostream &s) const |
Dumps to s an ASCII representation of *this . More... | |
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. More... | |
virtual memory_size_type | total_memory_in_bytes () const |
Returns the total size in bytes of the memory occupied by *this . More... | |
virtual memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this . More... | |
![]() | |
virtual | ~PIP_Tree_Node () |
Destructor. More... | |
const Constraint_System & | constraints () const |
Returns the system of parameter constraints controlling *this . More... | |
Artificial_Parameter_Sequence::const_iterator | art_parameter_begin () const |
Returns a const_iterator to the beginning of local artificial parameters. More... | |
Artificial_Parameter_Sequence::const_iterator | art_parameter_end () const |
Returns a const_iterator to the end of local artificial parameters. More... | |
dimension_type | art_parameter_count () const |
Returns the number of local artificial parameters. More... | |
void | print (std::ostream &s, int indent=0) const |
Prints on s the tree rooted in *this . More... | |
void | ascii_dump (std::ostream &s) const |
Dumps to s an ASCII representation of *this . More... | |
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. More... | |
Protected Member Functions | |
PIP_Decision_Node (const PIP_Decision_Node &y) | |
Copy constructor. More... | |
virtual void | update_tableau (const PIP_Problem &pip, dimension_type external_space_dim, dimension_type first_pending_constraint, const Constraint_Sequence &input_cs, const Variables_Set ¶meters) |
Implements pure virtual method PIP_Tree_Node::update_tableau. More... | |
virtual PIP_Tree_Node * | solve (const PIP_Problem &pip, bool check_feasible_context, const Matrix< Row > &context, const Variables_Set ¶ms, dimension_type space_dim, int indent_level) |
Implements pure virtual method PIP_Tree_Node::solve. More... | |
virtual void | print_tree (std::ostream &s, int indent, const std::vector< bool > &pip_dim_is_param, dimension_type first_art_dim) const |
Prints on s the tree rooted in *this . More... | |
![]() | |
PIP_Tree_Node (const PIP_Problem *owner) | |
Constructor: builds a node owned by *owner . More... | |
PIP_Tree_Node (const PIP_Tree_Node &y) | |
Copy constructor. More... | |
const PIP_Problem * | get_owner () const |
Returns a pointer to the PIP_Problem owning object. More... | |
const PIP_Decision_Node * | parent () const |
Returns a pointer to this node's parent. More... | |
void | set_parent (const PIP_Decision_Node *p) |
Set this node's parent to *p . More... | |
void | add_constraint (const Row &row, const Variables_Set ¶meters) |
Inserts a new parametric constraint in internal row format. More... | |
void | parent_merge () |
Merges parent's artificial parameters into *this . More... | |
Private Member Functions | |
PIP_Decision_Node (const PIP_Problem *owner, PIP_Tree_Node *fcp, PIP_Tree_Node *tcp) | |
Builds a decision node having fcp and tcp as child. More... | |
virtual void | set_owner (const PIP_Problem *owner) |
Sets the pointer to the PIP_Problem owning object. More... | |
virtual bool | check_ownership (const PIP_Problem *owner) const |
Returns true if and only if all the nodes in the subtree rooted in *this is owned by *pip . More... | |
Private Attributes | |
PIP_Tree_Node * | false_child |
Pointer to the "false" child of *this . More... | |
PIP_Tree_Node * | true_child |
Pointer to the "true" child of *this . More... | |
Friends | |
class | PIP_Solution_Node |
bool | PIP_Problem::ascii_load (std::istream &s) |
Additional Inherited Members | |
![]() | |
typedef Sparse_Row | Row |
typedef std::vector< Artificial_Parameter > | Artificial_Parameter_Sequence |
A type alias for a sequence of Artificial_Parameter's. More... | |
![]() | |
typedef std::vector< Constraint > | Constraint_Sequence |
A type alias for a sequence of constraints. More... | |
![]() | |
static void | indent_and_print (std::ostream &s, int indent, const char *str) |
A helper function used when printing PIP trees. More... | |
static bool | compatibility_check (Matrix< Row > &s) |
Checks whether a context matrix is satisfiable. More... | |
static bool | compatibility_check (const Matrix< Row > &context, const Row &row) |
Helper method: checks for satisfiability of the restricted context obtained by adding row to context . More... | |
![]() | |
const PIP_Problem * | owner_ |
A pointer to the PIP_Problem object owning this node. More... | |
const PIP_Decision_Node * | parent_ |
A pointer to the parent of *this , null if *this is the root. More... | |
Constraint_System | constraints_ |
The local system of parameter constraints. More... | |
Artificial_Parameter_Sequence | artificial_parameters |
The local sequence of expressions for local artificial parameters. More... | |
![]() | |
std::ostream & | operator<< (std::ostream &os, const PIP_Tree_Node &x) |
Output operator: prints the solution tree rooted in x . More... | |
A tree node representing a decision in the space of solutions.
Definition at line 707 of file PIP_Tree_defs.hh.
|
virtual |
Destructor.
Definition at line 1114 of file PIP_Tree.cc.
References false_child, and true_child.
|
explicitprivate |
Builds a decision node having fcp
and tcp
as child.
The decision node will encode the structure "if \c cs then \p tcp else \p fcp", where the system of constraints cs
is initially empty.
owner | Pointer to the owning PIP_Problem object; it may be null if and only if both children are null. |
fcp | Pointer to "false" child; it may be null. |
tcp | Pointer to "true" child; it may be null. |
fcp
or tcp
is not null, then owner
is required to be not null and equal to the owner of its non-null children; otherwise the behavior is undefined. Definition at line 1082 of file PIP_Tree.cc.
References false_child, Parma_Polyhedra_Library::PIP_Tree_Node::set_parent(), and true_child.
|
protected |
Copy constructor.
Definition at line 1096 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::clone(), false_child, Parma_Polyhedra_Library::PIP_Tree_Node::set_parent(), and true_child.
|
virtual |
Returns this
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1148 of file PIP_Tree.cc.
Referenced by Parma_Polyhedra_Library::PIP_Problem::ascii_dump(), and ascii_dump().
|
virtual |
Returns 0, since this
is not a solution node.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1158 of file PIP_Tree.cc.
void Parma_Polyhedra_Library::PIP_Decision_Node::ascii_dump | ( | std::ostream & | s | ) | const |
Dumps to s
an ASCII representation of *this
.
Definition at line 1525 of file PIP_Tree.cc.
References as_decision(), Parma_Polyhedra_Library::PIP_Solution_Node::as_solution(), Parma_Polyhedra_Library::PIP_Tree_Node::ascii_dump(), and Parma_Polyhedra_Library::PIP_Solution_Node::ascii_dump().
bool Parma_Polyhedra_Library::PIP_Decision_Node::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 1571 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::ascii_load(), Parma_Polyhedra_Library::PIP_Solution_Node::ascii_load(), ascii_load(), Parma_Polyhedra_Library::PIP_Solution_Node::OK(), Parma_Polyhedra_Library::PIP_Tree_Node::PIP_Decision_Node, and Parma_Polyhedra_Library::PIP_Solution_Node::PIP_Solution_Node().
Referenced by Parma_Polyhedra_Library::PIP_Problem::ascii_load(), and ascii_load().
|
privatevirtual |
Returns true
if and only if all the nodes in the subtree rooted in *this
is owned by *pip
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1141 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::check_ownership(), false_child, Parma_Polyhedra_Library::PIP_Tree_Node::get_owner(), and true_child.
|
inline |
Returns a const pointer to the b
(true or false) branch of *this
.
Definition at line 92 of file PIP_Tree_inlines.hh.
|
inline |
Returns a pointer to the b
(true or false) branch of *this
.
Definition at line 98 of file PIP_Tree_inlines.hh.
|
virtual |
Returns a pointer to a dynamically-allocated copy of *this
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1868 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::PIP_Decision_Node.
|
virtual |
Returns the size in bytes of the memory managed by *this
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 3755 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::external_memory_in_bytes().
|
virtual |
Returns true
if and only if *this
is well formed.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1335 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::constraints_, Parma_Polyhedra_Library::Implementation::num_constraints(), and Parma_Polyhedra_Library::PIP_Tree_Node::OK().
|
protectedvirtual |
Prints on s
the tree rooted in *this
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 3862 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::art_parameter_count(), Parma_Polyhedra_Library::PIP_Tree_Node::indent_and_print(), and Parma_Polyhedra_Library::PIP_Tree_Node::print_tree().
|
privatevirtual |
Sets the pointer to the PIP_Problem owning object.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1125 of file PIP_Tree.cc.
References false_child, Parma_Polyhedra_Library::PIP_Tree_Node::owner_, Parma_Polyhedra_Library::PIP_Tree_Node::set_owner(), and true_child.
Referenced by Parma_Polyhedra_Library::PIP_Problem::ascii_load().
|
protectedvirtual |
Implements pure virtual method PIP_Tree_Node::solve.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1397 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Tree_Node::artificial_parameters, Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::PIP_Tree_Node::compatibility_check(), Parma_Polyhedra_Library::PIP_Tree_Node::constraints_, Parma_Polyhedra_Library::Constraint_System::empty(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::PIP_Tree_Node::indent_and_print(), Parma_Polyhedra_Library::Constraint_System::insert(), Parma_Polyhedra_Library::Implementation::num_constraints(), Parma_Polyhedra_Library::Matrix< Row >::num_rows(), Parma_Polyhedra_Library::PIP_Tree_Node::OK(), Parma_Polyhedra_Library::PIP_Solution_Node::OK(), Parma_Polyhedra_Library::PIP_Tree_Node::parent(), Parma_Polyhedra_Library::PIP_Tree_Node::parent_merge(), PPL_USED, Parma_Polyhedra_Library::PIP_Tree_Node::set_parent(), and Parma_Polyhedra_Library::swap().
|
virtual |
Returns the total size in bytes of the memory occupied by *this
.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 3766 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Solution_Node::external_memory_in_bytes().
|
protectedvirtual |
Implements pure virtual method PIP_Tree_Node::update_tableau.
Implements Parma_Polyhedra_Library::PIP_Tree_Node.
Definition at line 1374 of file PIP_Tree.cc.
References Parma_Polyhedra_Library::PIP_Solution_Node::OK().
|
friend |
|
friend |
Definition at line 747 of file PIP_Tree_defs.hh.
|
private |
Pointer to the "false" child of *this
.
Definition at line 753 of file PIP_Tree_defs.hh.
Referenced by check_ownership(), PIP_Decision_Node(), set_owner(), Parma_Polyhedra_Library::PIP_Solution_Node::solve(), and ~PIP_Decision_Node().
|
private |
Pointer to the "true" child of *this
.
Definition at line 756 of file PIP_Tree_defs.hh.
Referenced by check_ownership(), PIP_Decision_Node(), set_owner(), and ~PIP_Decision_Node().