check if the factor is not zero when choosing the elimination order

This commit is contained in:
Tiago Gomes 2012-04-19 12:08:27 +01:00
parent cd1e157019
commit 661ce08961

View File

@ -10,6 +10,9 @@ ElimHeuristic ElimGraph::elimHeuristic_ = MIN_NEIGHBORS;
ElimGraph::ElimGraph (const vector<Factor*>& factors) ElimGraph::ElimGraph (const vector<Factor*>& factors)
{ {
for (unsigned i = 0; i < factors.size(); i++) { for (unsigned i = 0; i < factors.size(); i++) {
if (factors[i] == 0) { // if contained just one var with evidence
continue;
}
const VarIds& vids = factors[i]->arguments(); const VarIds& vids = factors[i]->arguments();
for (unsigned j = 0; j < vids.size() - 1; j++) { for (unsigned j = 0; j < vids.size() - 1; j++) {
EgNode* n1 = getEgNode (vids[j]); EgNode* n1 = getEgNode (vids[j]);