From 3397f694fee0b565deb03f491d002027016baabd Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Mon, 23 Apr 2012 22:12:04 +0100 Subject: [PATCH] sort the variable ids when printing all posterioris --- packages/CLPBN/clpbn/bp/Solver.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/CLPBN/clpbn/bp/Solver.cpp b/packages/CLPBN/clpbn/bp/Solver.cpp index 44d61db2e..a310c6e8a 100644 --- a/packages/CLPBN/clpbn/bp/Solver.cpp +++ b/packages/CLPBN/clpbn/bp/Solver.cpp @@ -29,9 +29,14 @@ Solver::printAnswer (const VarIds& vids) void Solver::printAllPosterioris (void) { + VarIds vids; const VarNodes& vars = fg.varNodes(); for (unsigned i = 0; i < vars.size(); i++) { - printAnswer ({vars[i]->varId()}); + vids.push_back (vars[i]->varId()); + } + std::sort (vids.begin(), vids.end()); + for (unsigned i = 0; i < vids.size(); i++) { + printAnswer ({vids[i]}); } }