[PPL-devel] [GIT] ppl/ppl(pip): Modified prototype for solve method in PIP_Tree_Node and derivates.
François Galea
francois.galea at uvsq.fr
Wed Sep 16 15:31:39 CEST 2009
Module: ppl/ppl
Branch: pip
Commit: 64bd2613cda2788010f510107f7ba3fa24ad40ce
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=64bd2613cda2788010f510107f7ba3fa24ad40ce
Author: François Galea <francois.galea at uvsq.fr>
Date: Wed Sep 16 15:21:06 2009 +0200
Modified prototype for solve method in PIP_Tree_Node and derivates.
---
src/PIP_Problem.cc | 2 +-
src/PIP_Tree.cc | 12 ++++++------
src/PIP_Tree.defs.hh | 6 +++---
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/PIP_Problem.cc b/src/PIP_Problem.cc
index 34affcd..ec42436 100644
--- a/src/PIP_Problem.cc
+++ b/src/PIP_Problem.cc
@@ -86,7 +86,7 @@ PPL::PIP_Problem::solve() const {
parameters);
Matrix initial_context(0, parameters.size()+1);
- return_value = x.current_solution->solve(&x.current_solution,
+ return_value = x.current_solution->solve(x.current_solution,
initial_context);
switch (return_value) {
diff --git a/src/PIP_Tree.cc b/src/PIP_Tree.cc
index 30e4080..edc073f 100644
--- a/src/PIP_Tree.cc
+++ b/src/PIP_Tree.cc
@@ -261,13 +261,13 @@ PIP_Decision_Node::update_tableau(PIP_Tree_Node ** /* parent_ref */,
}
PIP_Problem_Status
-PIP_Decision_Node::solve(PIP_Tree_Node **parent_ref, const Matrix& context) {
+PIP_Decision_Node::solve(PIP_Tree_Node*& parent_ref, const Matrix& context) {
PIP_Problem_Status return_status;
PIP_Problem_Status stt;
PIP_Problem_Status stf = UNFEASIBLE_PIP_PROBLEM;
Matrix context_true(context);
merge_assign(context_true, constraints_);
- stt = true_child->solve(&true_child, context_true);
+ stt = true_child->solve(true_child, context_true);
if (false_child) {
// Decision nodes with false child must have exactly one constraint
PPL_ASSERT(1 == std::distance(constraints_.begin(), constraints_.end()));
@@ -275,12 +275,12 @@ PIP_Decision_Node::solve(PIP_Tree_Node **parent_ref, const Matrix& context) {
merge_assign(context_false, constraints_);
Row &last = context_false[context_false.num_rows()-1];
negate_assign(last, last);
- stf = false_child->solve(&false_child, context_false);
+ stf = false_child->solve(false_child, context_false);
}
if (stt == UNFEASIBLE_PIP_PROBLEM && stf == UNFEASIBLE_PIP_PROBLEM) {
return_status = UNFEASIBLE_PIP_PROBLEM;
- *parent_ref = 0;
+ parent_ref = 0;
delete this;
} else
return_status = OPTIMIZED_PIP_PROBLEM;
@@ -517,7 +517,7 @@ PIP_Solution_Node::update_tableau(PIP_Tree_Node ** /* parent_ref */,
}
PIP_Problem_Status
-PIP_Solution_Node::solve(PIP_Tree_Node** parent_ref,
+PIP_Solution_Node::solve(PIP_Tree_Node*& parent_ref,
const Matrix& ctx) {
Matrix context(ctx);
merge_assign(context, constraints_);
@@ -632,7 +632,7 @@ PIP_Solution_Node::solve(PIP_Tree_Node** parent_ref,
std::cout << "No positive pivot found: Solution = _|_"
<< std::endl;
#endif
- *parent_ref = 0;
+ parent_ref = 0;
delete this;
return UNFEASIBLE_PIP_PROBLEM;
}
diff --git a/src/PIP_Tree.defs.hh b/src/PIP_Tree.defs.hh
index 72c6fc6..cb41f49 100644
--- a/src/PIP_Tree.defs.hh
+++ b/src/PIP_Tree.defs.hh
@@ -127,7 +127,7 @@ protected:
An PIP_Problem_Status flag indicating the outcome of the optimization
attempt (unfeasible or optimized problem).
*/
- virtual PIP_Problem_Status solve(PIP_Tree_Node **parent_ref,
+ virtual PIP_Problem_Status solve(PIP_Tree_Node*& parent_ref,
const Matrix& context) = 0;
};
@@ -326,7 +326,7 @@ protected:
An PIP_Problem_Status flag indicating the outcome of the optimization
attempt (unfeasible or optimized problem).
*/
- virtual PIP_Problem_Status solve(PIP_Tree_Node **parent_ref,
+ virtual PIP_Problem_Status solve(PIP_Tree_Node*& parent_ref,
const Matrix& context);
// FIXME: constructors to be decided.
};
@@ -418,7 +418,7 @@ protected:
An PIP_Problem_Status flag indicating the outcome of the optimization
attempt (unfeasible or optimized problem).
*/
- virtual PIP_Problem_Status solve(PIP_Tree_Node **parent_ref,
+ virtual PIP_Problem_Status solve(PIP_Tree_Node*& parent_ref,
const Matrix& context);
};
More information about the PPL-devel
mailing list