refactor printing of a parfactor

This commit is contained in:
Tiago Gomes 2012-05-15 16:57:50 +01:00
parent 346b70145f
commit 7ec4887e77
2 changed files with 53 additions and 28 deletions

View File

@ -557,6 +557,15 @@ Parfactor::print (bool printParams) const
copy.moveToTop (copy.logVarSet().elements());
cout << "Tuples: " << copy.tupleSet() << endl;
if (printParams) {
printParameters();
}
}
void
Parfactor::printParameters (void) const
{
vector<string> jointStrings;
StatesIndexer indexer (ranges_);
while (indexer.valid()) {
@ -585,7 +594,19 @@ Parfactor::print (bool printParams) const
cout << " = " << params_[i] << endl;
}
}
cout << endl;
void
Parfactor::printProjections (void) const
{
ConstraintTree copy (*constr_);
LogVarSet Xs = copy.logVarSet();
for (unsigned i = 0; i < Xs.size(); i++) {
cout << "-> projection of " << Xs[i] << ": " ;
cout << copy.tupleSet ({Xs[i]}) << endl;
}
}

View File

@ -80,6 +80,10 @@ class Parfactor : public TFactor<ProbFormula>
void print (bool = false) const;
void printParameters (void) const;
void printProjections (void) const;
string getLabel (void) const;
private: