improve log information

This commit is contained in:
Tiago Gomes 2012-05-23 12:26:14 +01:00
parent 16cb48fea4
commit 7c3e4ed3ab
2 changed files with 10 additions and 4 deletions

View File

@ -116,10 +116,7 @@ void
CbpSolver::createLinks (void) CbpSolver::createLinks (void)
{ {
if (Globals::verbosity > 0) { if (Globals::verbosity > 0) {
cout << "original factor graph has " ; cout << "compressed factor graph contains " ;
cout << fg.nrVarNodes() << " variables and " ;
cout << fg.nrFacNodes() << " factors " << endl;
cout << "compressed factor graph has " ;
cout << fg_->nrVarNodes() << " variables and " ; cout << fg_->nrVarNodes() << " variables and " ;
cout << fg_->nrFacNodes() << " factors " << endl; cout << fg_->nrFacNodes() << " factors " << endl;
cout << endl; cout << endl;

View File

@ -197,6 +197,7 @@ void readLiftedEvidence (
} }
unsigned evidence = (unsigned) YAP_IntOfTerm (YAP_ArgOfTerm (2, pair)); unsigned evidence = (unsigned) YAP_IntOfTerm (YAP_ArgOfTerm (2, pair));
bool found = false; bool found = false;
cout << "has evidence()" << endl;
for (unsigned i = 0; i < obsFormulas.size(); i++) { for (unsigned i = 0; i < obsFormulas.size(); i++) {
if (obsFormulas[i].functor() == functor && if (obsFormulas[i].functor() == functor &&
obsFormulas[i].arity() == args.size() && obsFormulas[i].arity() == args.size() &&
@ -235,6 +236,7 @@ createGroundNetwork (void)
factorList = YAP_TailOfTerm (factorList); factorList = YAP_TailOfTerm (factorList);
} }
unsigned nrObservedVars = 0;
YAP_Term evidenceList = YAP_ARG3; YAP_Term evidenceList = YAP_ARG3;
while (evidenceList != YAP_TermNil()) { while (evidenceList != YAP_TermNil()) {
YAP_Term evTerm = YAP_HeadOfTerm (evidenceList); YAP_Term evTerm = YAP_HeadOfTerm (evidenceList);
@ -243,6 +245,13 @@ createGroundNetwork (void)
assert (fg->getVarNode (vid)); assert (fg->getVarNode (vid));
fg->getVarNode (vid)->setEvidence (ev); fg->getVarNode (vid)->setEvidence (ev);
evidenceList = YAP_TailOfTerm (evidenceList); evidenceList = YAP_TailOfTerm (evidenceList);
nrObservedVars ++;
}
if (Globals::verbosity > 0) {
cout << "factor graph contains " ;
cout << fg->nrVarNodes() << " variables " ;
cout << "(" << nrObservedVars << " observed) and " ;
cout << fg->nrFacNodes() << " factors " << endl;
} }
YAP_Int p = (YAP_Int) (fg); YAP_Int p = (YAP_Int) (fg);
return YAP_Unify (YAP_MkIntTerm (p), YAP_ARG4); return YAP_Unify (YAP_MkIntTerm (p), YAP_ARG4);