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
|
class LogVar
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LogVar (void) : id_(numeric_limits<unsigned>::max()) { }
|
LogVar (void) : id_(Util::maxUnsigned()) { }
|
||||||
|
|
||||||
LogVar (unsigned id) : id_(id) { }
|
LogVar (unsigned id) : id_(id) { }
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class LogVar
|
|||||||
|
|
||||||
bool valid (void) const
|
bool valid (void) const
|
||||||
{
|
{
|
||||||
return id_ != numeric_limits<unsigned>::max();
|
return id_ != Util::maxUnsigned();
|
||||||
}
|
}
|
||||||
|
|
||||||
friend ostream& operator<< (ostream &os, const LogVar& X);
|
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_.insert (args_.begin() + fIdx + 1, args_[fIdx]);
|
||||||
args_[fIdx].rename (X, X_new1);
|
args_[fIdx].rename (X, X_new1);
|
||||||
args_[fIdx + 1].rename (X, X_new2);
|
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_.insert (ranges_.begin() + fIdx + 1, H2);
|
||||||
ranges_[fIdx] = H1;
|
ranges_[fIdx] = H1;
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,14 @@ ProbFormula::setCountedLogVar (LogVar lv)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ProbFormula::clearCountedLogVar (void)
|
||||||
|
{
|
||||||
|
countedLogVar_ = LogVar();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ProbFormula::rename (LogVar oldName, LogVar newName)
|
ProbFormula::rename (LogVar oldName, LogVar newName)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,8 @@ class ProbFormula
|
|||||||
|
|
||||||
void setCountedLogVar (LogVar);
|
void setCountedLogVar (LogVar);
|
||||||
|
|
||||||
|
void clearCountedLogVar (void);
|
||||||
|
|
||||||
void rename (LogVar, LogVar);
|
void rename (LogVar, LogVar);
|
||||||
|
|
||||||
static unsigned getNewGroup (void);
|
static unsigned getNewGroup (void);
|
||||||
|
Reference in New Issue
Block a user