when expanding a counting formula, check if the expanded log vars are still counting log vars
This commit is contained in:
parent
52f4aa0340
commit
1173b4c25b
@ -37,7 +37,7 @@ class Symbol
|
||||
class LogVar
|
||||
{
|
||||
public:
|
||||
LogVar (void) : id_(numeric_limits<unsigned>::max()) { }
|
||||
LogVar (void) : id_(Util::maxUnsigned()) { }
|
||||
|
||||
LogVar (unsigned id) : id_(id) { }
|
||||
|
||||
@ -52,7 +52,7 @@ class LogVar
|
||||
|
||||
bool valid (void) const
|
||||
{
|
||||
return id_ != numeric_limits<unsigned>::max();
|
||||
return id_ != Util::maxUnsigned();
|
||||
}
|
||||
|
||||
friend ostream& operator<< (ostream &os, const LogVar& X);
|
||||
|
@ -285,6 +285,12 @@ Parfactor::expand (LogVar X, LogVar X_new1, LogVar X_new2)
|
||||
args_.insert (args_.begin() + fIdx + 1, args_[fIdx]);
|
||||
args_[fIdx].rename (X, X_new1);
|
||||
args_[fIdx + 1].rename (X, X_new2);
|
||||
if (H1 == 2) {
|
||||
args_[fIdx].clearCountedLogVar();
|
||||
}
|
||||
if (H2 == 2) {
|
||||
args_[fIdx + 1].clearCountedLogVar();
|
||||
}
|
||||
ranges_.insert (ranges_.begin() + fIdx + 1, H2);
|
||||
ranges_[fIdx] = H1;
|
||||
}
|
||||
|
@ -76,6 +76,14 @@ ProbFormula::setCountedLogVar (LogVar lv)
|
||||
|
||||
|
||||
|
||||
void
|
||||
ProbFormula::clearCountedLogVar (void)
|
||||
{
|
||||
countedLogVar_ = LogVar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
ProbFormula::rename (LogVar oldName, LogVar newName)
|
||||
{
|
||||
|
@ -51,6 +51,8 @@ class ProbFormula
|
||||
|
||||
void setCountedLogVar (LogVar);
|
||||
|
||||
void clearCountedLogVar (void);
|
||||
|
||||
void rename (LogVar, LogVar);
|
||||
|
||||
static unsigned getNewGroup (void);
|
||||
|
Reference in New Issue
Block a user