reorder the parameters instead of reordering variables

This commit is contained in:
Tiago Gomes 2012-04-23 22:57:04 +01:00
parent 0ebd6d6e06
commit fc362fe123

View File

@ -102,7 +102,6 @@ FactorGraph::readFromUaiFormat (const char* fileName)
if (Globals::logDomain) { if (Globals::logDomain) {
Util::toLog (params); Util::toLog (params);
} }
// TODO order vars is flag on
addFactor (Factor (factorVarIds[i], factorRanges[i], params)); addFactor (Factor (factorVarIds[i], factorRanges[i], params));
} }
is.close(); is.close();
@ -158,12 +157,14 @@ FactorGraph::readFromLibDaiFormat (const char* fileName)
is >> val; is >> val;
params[index] = val; params[index] = val;
} }
reverse (vids.begin(), vids.end());
if (Globals::logDomain) { if (Globals::logDomain) {
Util::toLog (params); Util::toLog (params);
} }
// TODO order vars is flag on reverse (vids.begin(), vids.end());
addFactor (Factor (vids, ranges, params)); Factor f (vids, ranges, params);
reverse (vids.begin(), vids.end());
f.reorderArguments (vids);
addFactor (f);
} }
is.close(); is.close();
} }
@ -264,7 +265,6 @@ FactorGraph::getStructure (void)
void void
FactorGraph::print (void) const FactorGraph::print (void) const
{ {
/*
for (unsigned i = 0; i < varNodes_.size(); i++) { for (unsigned i = 0; i < varNodes_.size(); i++) {
cout << "var id = " << varNodes_[i]->varId() << endl; cout << "var id = " << varNodes_[i]->varId() << endl;
cout << "label = " << varNodes_[i]->label() << endl; cout << "label = " << varNodes_[i]->label() << endl;
@ -276,7 +276,6 @@ FactorGraph::print (void) const
} }
cout << endl << endl; cout << endl << endl;
} }
*/
for (unsigned i = 0; i < facNodes_.size(); i++) { for (unsigned i = 0; i < facNodes_.size(); i++) {
facNodes_[i]->factor().print(); facNodes_[i]->factor().print();
} }