24 #ifndef PPL_PIP_Tree_defs_hh
25 #define PPL_PIP_Tree_defs_hh 1
71 #if PPL_USE_SPARSE_MATRIX
84 virtual bool OK()
const = 0;
123 void print(std::ostream& s,
int indent = 0)
const;
191 const Constraint_Sequence& input_cs,
220 bool check_feasible_context,
224 int indent_level) = 0;
251 const std::vector<bool>& pip_dim_is_param,
309 Coefficient_traits::const_reference d);
315 Coefficient_traits::const_reference
denominator()
const;
373 virtual bool OK()
const;
432 void scale(Coefficient_traits::const_reference ratio);
491 const std::vector<bool>&
basis,
498 Coefficient_traits::const_reference
denominator()
const;
667 bool check_feasible_context,
699 virtual void print_tree(std::ostream& s,
int indent,
700 const std::vector<bool>& pip_dim_is_param,
716 virtual bool OK()
const;
806 bool check_feasible_context,
813 virtual void print_tree(std::ostream& s,
int indent,
814 const std::vector<bool>& pip_dim_is_param,
819 namespace IO_Operators {
836 #endif // !defined(PPL_PIP_Tree_defs_hh)
Artificial_Parameter_Sequence::const_iterator art_parameter_begin() const
Returns a const_iterator to the beginning of local artificial parameters.
const PIP_Problem * owner_
A pointer to the PIP_Problem object owning this node.
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.
bool operator==(const Artificial_Parameter &y) const
Returns true if and only if *this and y are equal.
Coefficient denom
The normalized (i.e., positive) denominator.
std::vector< dimension_type > var_column
The variable identifiers associated to the columns of the simplex tableau.
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.
Artificial parameters in PIP solution trees.
bool operator!=(const Artificial_Parameter &y) const
Returns true if and only if *this and y are different.
static bool compatibility_check(Matrix< Row > &s)
Checks whether a context matrix is satisfiable.
virtual void set_owner(const PIP_Problem *owner)
Sets the pointer to the PIP_Problem owning object.
virtual memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
void swap(CO_Tree &x, CO_Tree &y)
virtual const PIP_Decision_Node * as_decision() const =0
Returns this if *this is a decision node, 0 otherwise.
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.
A finite sequence of coefficients.
virtual void set_owner(const PIP_Problem *owner)
Sets the pointer to the PIP_Problem owning object.
void generate_cut(dimension_type index, Variables_Set ¶meters, Matrix< Row > &context, dimension_type &space_dimension, int indent_level)
Generate a Gomory cut using non-integer tableau row index.
size_t dimension_type
An unsigned integral type for representing space dimensions.
PIP_Tree_Node * false_child
Pointer to the "false" child of *this.
An std::set of variables' indexes.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
virtual bool OK() const
Returns true if and only if *this is well formed.
const PIP_Decision_Node * parent() const
Returns a pointer to this node's parent.
Tableau tableau
The parametric simplex tableau.
const Linear_Expression & parametric_values(Variable var) const
Returns a parametric expression for the values of problem variable var.
virtual void set_owner(const PIP_Problem *owner)=0
Sets the pointer to the PIP_Problem owning object.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
virtual memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
std::ostream & operator<<(std::ostream &s, const Ask_Tell< D > &x)
void ascii_dump(std::ostream &os) const
Dumps to os an ASCII representation of *this.
static Row_Sign row_sign(const Row &x, dimension_type big_dimension)
Returns the sign of row x.
A sparse matrix of Coefficient.
dimension_type special_equality_row
The variable number of the special inequality used for modeling equality constraints.
bool ascii_load(std::istream &is)
Loads from is an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this...
const PIP_Problem * get_owner() const
Returns a pointer to the PIP_Problem owning object.
A finite sparse sequence of coefficients.
PIP_Tree_Node(const PIP_Problem *owner)
Constructor: builds a node owned by *owner.
dimension_type big_dimension
The column index in the parametric part of the simplex tableau corresponding to the big parameter; no...
virtual memory_size_type external_memory_in_bytes() const =0
Returns the size in bytes of the memory managed by *this.
PIP_Solution_Node(const PIP_Problem *owner)
Constructor: builds a solution node owned by *owner.
virtual ~PIP_Decision_Node()
Destructor.
bool solution_valid
An indicator for solution validity.
A Parametric Integer (linear) Programming problem.
virtual PIP_Tree_Node * clone() const =0
Returns a pointer to a dynamically-allocated copy of *this.
Not computed yet (default).
Artificial_Parameter_Sequence::const_iterator art_parameter_end() const
Returns a const_iterator to the end of local artificial parameters.
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)=0
Populates the parametric simplex tableau using external data.
virtual PIP_Tree_Node * clone() const
Returns a pointer to a dynamically-allocated copy of *this.
A tree node representing a decision in the space of solutions.
The row contains both positive and negative coefficients.
A dimension of the vector space.
All nonzero row coefficients are negative.
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.
std::vector< Artificial_Parameter > Artificial_Parameter_Sequence
A type alias for a sequence of Artificial_Parameter's.
std::vector< dimension_type > var_row
The variable identifiers associated to the rows of the simplex tableau.
virtual bool check_ownership(const PIP_Problem *owner) const =0
Returns true if and only if all the nodes in the subtree rooted in *this are owned by *owner...
void ascii_dump(std::ostream &s) const
Dumps to s an ASCII representation of *this.
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.
dimension_type art_parameter_count() const
Returns the number of local artificial parameters.
bool OK() const
Returns true if and only if *this is well formed.
#define PPL_OUTPUT_DECLARATIONS
void parent_merge()
Merges parent's artificial parameters into *this.
virtual ~PIP_Tree_Node()
Destructor.
Tableau()
Default constructor.
virtual void print_tree(std::ostream &s, int indent, const std::vector< bool > &pip_dim_is_param, dimension_type first_art_dim) const =0
Prints on s the tree rooted in *this.
Coefficient_traits::const_reference denominator() const
Returns the value of the denominator.
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.
virtual bool OK() const =0
Returns true if and only if *this is well formed.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
bool OK() const
Returns true if and only if the parameter is well-formed.
std::vector< dimension_type > mapping
A mapping between the tableau rows/columns and the original variables.
void ascii_dump(std::ostream &os) const
Dumps to os an ASCII representation of *this.
virtual const PIP_Solution_Node * as_solution() const
Returns this.
void ascii_dump(std::ostream &s) const
Dumps to s an ASCII representation of *this.
virtual const PIP_Decision_Node * as_decision() const
Returns this.
const Constraint_System & constraints() const
Returns the system of parameter constraints controlling *this.
virtual bool OK() const
Returns true if and only if *this is well formed.
void set_parent(const PIP_Decision_Node *p)
Set this node's parent to *p.
Coefficient_traits::const_reference denominator() const
Returns the normalized (i.e., positive) denominator.
All nonzero row coefficients are positive.
void scale(Coefficient_traits::const_reference ratio)
Multiplies all coefficients and denominator with ratio.
bool is_integer() const
Tests whether the matrix is integer, i.e., the denominator is 1.
std::vector< Linear_Expression > solution
Parametric values for the solution.
PPL_COEFFICIENT_TYPE Coefficient
An alias for easily naming the type of PPL coefficients.
PIP_Tree_Node * true_child
Pointer to the "true" child of *this.
virtual const PIP_Solution_Node * as_solution() const =0
Returns this if *this is a solution node, 0 otherwise.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
const PIP_Tree_Node * child_node(bool b) const
Returns a const pointer to the b (true or false) branch of *this.
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...
virtual memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
const PIP_Decision_Node * parent_
A pointer to the parent of *this, null if *this is the root.
virtual const PIP_Solution_Node * as_solution() const
Returns 0, since this is not a solution node.
Artificial_Parameter()
Default constructor: builds a zero artificial parameter.
The entire library is confined to this namespace.
All row coefficients are zero.
void update_solution() const
Helper method.
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...
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
virtual ~PIP_Solution_Node()
Destructor.
Artificial_Parameter_Sequence artificial_parameters
The local sequence of expressions for local artificial parameters.
void normalize()
Normalizes the modulo of coefficients so that they are mutually prime.
std::vector< bool > basis
A boolean vector for identifying the basic variables.
Row_Sign
The possible values for the sign of a parametric linear expression.
std::vector< Constraint > Constraint_Sequence
A type alias for a sequence of constraints.
void add_constraint(const Row &row, const Variables_Set ¶meters)
Inserts a new parametric constraint in internal row format.
Matrix< Row > t
The matrix of parameter coefficients.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
Coefficient denom
A common denominator for all matrix elements.
virtual PIP_Tree_Node * clone() const
Returns a pointer to a dynamically-allocated copy of *this.
A tree node representing part of the space of solutions.
virtual const PIP_Decision_Node * as_decision() const
Returns 0, since this is not a decision node.
bool is_better_pivot(const std::vector< dimension_type > &mapping, const std::vector< bool > &basis, const dimension_type row_0, const dimension_type col_0, const dimension_type row_1, const dimension_type col_1) const
Compares two pivot row and column pairs before pivoting.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
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.
void m_swap(Artificial_Parameter &y)
Swaps *this with y.
Constraint_System constraints_
The local system of parameter constraints.
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)=0
Executes a parametric simplex on the tableau, under specified context.
A node of the PIP solution tree.
virtual memory_size_type total_memory_in_bytes() const =0
Returns the total size in bytes of the memory occupied by *this.
Matrix< Row > s
The matrix of simplex coefficients.
A tag type to select the alternative copy constructor.
virtual memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
static void indent_and_print(std::ostream &s, int indent, const char *str)
A helper function used when printing PIP trees.
void print(std::ostream &s, int indent=0) const
Prints on s the tree rooted in *this.
std::vector< Row_Sign > sign
A cache for computed sign values of constraint parametric RHS.
The type for parametric simplex tableau.
bool ascii_load(std::istream &is)
Loads from is an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this...