[PPL-devel] [GIT] ppl/ppl(pip): Several minor stylistic improvements.
Enea Zaffanella
zaffanella at cs.unipr.it
Sun Jan 31 00:07:52 CET 2010
Module: ppl/ppl
Branch: pip
Commit: af2068fb4971617c277cc0da51ee2590b6b894b2
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=af2068fb4971617c277cc0da51ee2590b6b894b2
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Sun Jan 31 00:07:27 2010 +0100
Several minor stylistic improvements.
---
src/PIP_Tree.cc | 84 ++++++++++++++++++++++++-------------------------
src/PIP_Tree.defs.hh | 32 +++++++++---------
2 files changed, 57 insertions(+), 59 deletions(-)
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 8958d0d..8a3fad3 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -256,10 +256,10 @@ PIP_Tree_Node::PIP_Tree_Node()
artificial_parameters() {
}
-PIP_Tree_Node::PIP_Tree_Node(const PIP_Tree_Node &x)
- : parent_(0),
- constraints_(x.constraints_),
- artificial_parameters(x.artificial_parameters) {
+PIP_Tree_Node::PIP_Tree_Node(const PIP_Tree_Node& y)
+ : parent_(0), // Parent is not copied.
+ constraints_(y.constraints_),
+ artificial_parameters(y.artificial_parameters) {
}
PIP_Tree_Node::Artificial_Parameter::Artificial_Parameter()
@@ -273,13 +273,12 @@ PIP_Tree_Node::Artificial_Parameter
}
PIP_Tree_Node::Artificial_Parameter
-::Artificial_Parameter(const Artificial_Parameter &x)
- : Linear_Expression(x), denominator(x.denominator) {
+::Artificial_Parameter(const Artificial_Parameter& y)
+ : Linear_Expression(y), denominator(y.denominator) {
}
-const Coefficient&
-PIP_Tree_Node::Artificial_Parameter
-::get_denominator() const {
+Coefficient_traits::const_reference
+PIP_Tree_Node::Artificial_Parameter::get_denominator() const {
return denominator;
}
@@ -319,8 +318,7 @@ PIP_Tree_Node::Artificial_Parameter::ascii_load(std::istream& s) {
PIP_Decision_Node::~PIP_Decision_Node() {
delete true_child;
- if (false_child)
- delete false_child;
+ delete false_child;
}
PIP_Solution_Node::~PIP_Solution_Node() {
@@ -340,36 +338,36 @@ PIP_Solution_Node::PIP_Solution_Node()
solution_valid(false) {
}
-PIP_Solution_Node::PIP_Solution_Node(const PIP_Solution_Node &x)
- : PIP_Tree_Node(x),
- tableau(x.tableau),
- basis(x.basis),
- mapping(x.mapping),
- var_row(x.var_row),
- var_column(x.var_column),
- special_equality_row(x.special_equality_row),
- big_dimension(x.big_dimension),
- sign(x.sign),
- solution(x.solution),
- solution_valid(x.solution_valid) {
+PIP_Solution_Node::PIP_Solution_Node(const PIP_Solution_Node& y)
+ : PIP_Tree_Node(y),
+ tableau(y.tableau),
+ basis(y.basis),
+ mapping(y.mapping),
+ var_row(y.var_row),
+ var_column(y.var_column),
+ special_equality_row(y.special_equality_row),
+ big_dimension(y.big_dimension),
+ sign(y.sign),
+ solution(y.solution),
+ solution_valid(y.solution_valid) {
}
-PIP_Solution_Node::PIP_Solution_Node(const PIP_Solution_Node &x,
+PIP_Solution_Node::PIP_Solution_Node(const PIP_Solution_Node& y,
bool empty_constraints)
: PIP_Tree_Node(),
- tableau(x.tableau),
- basis(x.basis),
- mapping(x.mapping),
- var_row(x.var_row),
- var_column(x.var_column),
- special_equality_row(x.special_equality_row),
- big_dimension(x.big_dimension),
- sign(x.sign),
- solution(x.solution),
- solution_valid(x.solution_valid) {
+ tableau(y.tableau),
+ basis(y.basis),
+ mapping(y.mapping),
+ var_row(y.var_row),
+ var_column(y.var_column),
+ special_equality_row(y.special_equality_row),
+ big_dimension(y.big_dimension),
+ sign(y.sign),
+ solution(y.solution),
+ solution_valid(y.solution_valid) {
if (!empty_constraints) {
- constraints_ = x.constraints_;
- artificial_parameters = x.artificial_parameters;
+ constraints_ = y.constraints_;
+ artificial_parameters = y.artificial_parameters;
}
}
@@ -384,16 +382,16 @@ PIP_Decision_Node::PIP_Decision_Node(PIP_Tree_Node* fcp,
tcp->set_parent(this);
}
-PIP_Decision_Node ::PIP_Decision_Node(const PIP_Decision_Node& x)
- : PIP_Tree_Node(x),
+PIP_Decision_Node ::PIP_Decision_Node(const PIP_Decision_Node& y)
+ : PIP_Tree_Node(y),
true_child(0),
false_child(0) {
- if (x.true_child != 0) {
- true_child = x.true_child->clone();
+ if (y.true_child != 0) {
+ true_child = y.true_child->clone();
true_child->set_parent(this);
}
- if (x.false_child != 0) {
- false_child = x.false_child->clone();
+ if (y.false_child != 0) {
+ false_child = y.false_child->clone();
false_child->set_parent(this);
}
}
@@ -1053,7 +1051,7 @@ PIP_Solution_Node::ascii_load(std::istream& s) {
const Linear_Expression&
PIP_Solution_Node
-::parametric_values(const Variable &v,
+::parametric_values(Variable v,
const Variables_Set& parameters) const {
Variables_Set all_parameters(parameters);
// Complete the parameter set with artificials.
diff --git a/src/PIP_Tree.defs.hh b/src/PIP_Tree.defs.hh
index 9c07242..19d83fc 100644
--- a/src/PIP_Tree.defs.hh
+++ b/src/PIP_Tree.defs.hh
@@ -46,7 +46,7 @@ protected:
PIP_Tree_Node();
//! Copy constructor.
- PIP_Tree_Node(const PIP_Tree_Node &x);
+ PIP_Tree_Node(const PIP_Tree_Node& y);
public:
//! Returns a pointer to a dynamically-allocated copy of \p *this.
@@ -90,9 +90,9 @@ public:
class Artificial_Parameter : public Linear_Expression {
public:
Artificial_Parameter();
- Artificial_Parameter(const Linear_Expression &e,
+ Artificial_Parameter(const Linear_Expression& e,
Coefficient_traits::const_reference d);
- Artificial_Parameter(const Artificial_Parameter &x);
+ Artificial_Parameter(const Artificial_Parameter& y);
Coefficient_traits::const_reference get_denominator() const;
@@ -167,7 +167,7 @@ protected:
\return
the number of inserted artificial parameters.
*/
- dimension_type insert_artificials(Variables_Set ¶ms,
+ dimension_type insert_artificials(Variables_Set& params,
dimension_type space_dimension) const;
/*! \brief
@@ -192,8 +192,8 @@ protected:
virtual void update_tableau(const PIP_Problem& problem,
dimension_type external_space_dim,
dimension_type first_pending_constraint,
- const Constraint_Sequence &input_cs,
- const Variables_Set ¶meters) = 0;
+ const Constraint_Sequence& input_cs,
+ const Variables_Set& parameters) = 0;
/*! \brief
Execute a parametric simplex on the tableau, under specified context.
@@ -224,7 +224,7 @@ protected:
dimension_type space_dimension) = 0;
//! Inserts a new parametric constraint in internal Row format
- void add_constraint(const Row &x, const Variables_Set& parameters);
+ void add_constraint(const Row& x, const Variables_Set& parameters);
}; // class PIP_Tree_Node
@@ -267,7 +267,7 @@ public:
or if \p v is a parameter.
*/
const Linear_Expression&
- parametric_values(const Variable &v,
+ parametric_values(Variable v,
const Variables_Set& parameters) const;
void ascii_dump(std::ostream& s) const;
@@ -286,7 +286,7 @@ private:
//! Default constructor.
Tableau();
//! Copy constructor.
- Tableau(const Tableau& x);
+ Tableau(const Tableau& y);
//! Destructor.
~Tableau();
@@ -462,7 +462,7 @@ private:
bool solution_valid;
//! Determines the sign of given Row.
- static Row_Sign row_sign(const Row &x, dimension_type big_dimension);
+ static Row_Sign row_sign(const Row& x, dimension_type big_dimension);
/*! \brief
Checks whether a constraint is compatible with a context, ie. does not
@@ -476,17 +476,17 @@ private:
The algorithm ensures the feasible solutions are integer, by applying a
cut generation method when intermediate non-integer solutions are found.
*/
- static bool compatibility_check(const Matrix &ctx, const Row &cnst);
+ static bool compatibility_check(const Matrix& ctx, const Row& cnst);
protected:
//! Copy constructor.
- PIP_Solution_Node(const PIP_Solution_Node &x);
+ PIP_Solution_Node(const PIP_Solution_Node& y);
/*! \brief
Copy constructor, allowing not to copy the constraint system and
artificial parameters
*/
- PIP_Solution_Node(const PIP_Solution_Node &x, bool empty_constraints);
+ PIP_Solution_Node(const PIP_Solution_Node& y, bool empty_constraints);
/*! \brief
Populates the parametric simplex tableau using external data, if necessary
@@ -628,7 +628,7 @@ private:
protected:
//! Copy constructor.
- PIP_Decision_Node(const PIP_Decision_Node &x);
+ PIP_Decision_Node(const PIP_Decision_Node& y);
/*! \brief
Populates the parametric simplex tableau using external data, if necessary
@@ -652,8 +652,8 @@ protected:
virtual void update_tableau(const PIP_Problem& problem,
dimension_type external_space_dim,
dimension_type first_pending_constraint,
- const Constraint_Sequence &input_cs,
- const Variables_Set ¶meters);
+ const Constraint_Sequence& input_cs,
+ const Variables_Set& parameters);
/*! \brief
Execute a parametric simplex on the tableau, under specified context.
More information about the PPL-devel
mailing list