add a way to copy a log var

This commit is contained in:
Tiago Gomes 2012-05-15 16:43:32 +01:00
parent 4ade4945a0
commit 2061eefda2
2 changed files with 17 additions and 0 deletions

View File

@ -856,6 +856,21 @@ ConstraintTree::ground (LogVar X)
void
ConstraintTree::copyLogVar (LogVar X_1, LogVar X_2)
{
moveToBottom ({X_1});
CTNodes leafs = getNodesAtLevel (logVars_.size());
for (unsigned i = 0; i < leafs.size(); i++) {
leafs[i]->childs().push_back (
new CTNode (leafs[i]->symbol(), leafs[i]->level() + 1));
}
logVars_.push_back (X_2);
logVarSet_.insert (X_2);
}
unsigned
ConstraintTree::countTuples (const CTNode* n) const
{

View File

@ -208,6 +208,8 @@ class ConstraintTree
ConstraintTrees ground (LogVar);
void copyLogVar (LogVar,LogVar);
private:
unsigned countTuples (const CTNode*) const;