Skip to content

Commit

Permalink
Merge branch 'projection' into ganak
Browse files Browse the repository at this point in the history
  • Loading branch information
arijitsh committed Nov 29, 2024
2 parents aa70aef + fe42898 commit 7f8660c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions include/stp/STPManager/STPManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,17 @@ class STPMgr

bool isProjSymbol(ASTNode& s)
{
if (_proj_symbol_list.size() == 0)
return true;
return _proj_symbol_list.find(s) != _proj_symbol_list.end();
}

bool isAnyProjSymbolDeclared()
{
if (_proj_symbol_list.size() == 0)
return false;
return true;
}

bool FoundIntroducedSymbolSet(const ASTNode& in)
{
Expand Down
13 changes: 11 additions & 2 deletions lib/ToSat/ToCNFAIG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ void ToCNFAIG::fill_node_to_var(Cnf_Dat_t* cnfData,
{
BBNodeManagerAIG::SymbolToBBNode::const_iterator it;
assert(nodeToVars.size() == 0);
uint32_t proj_var_num = 0, non_proj_var_num = 0;

// todo. cf. with addvariables above...
// Each symbol maps to a vector of CNF variables.
Expand All @@ -155,9 +156,9 @@ void ToCNFAIG::fill_node_to_var(Cnf_Dat_t* cnfData,
const vector<BBNodeAIG>& b = it->second;
assert(nodeToVars.find(n) == nodeToVars.end());
if (bm->isProjSymbol(n))
std::cout << "proj symbol" << n.GetName() << std::endl;
proj_var_num++;
else
std::cout << "not proj symbol" << n.GetName() << std::endl;
non_proj_var_num++;
const int width = (n.GetType() == BOOLEAN_TYPE) ? 1 : n.GetValueWidth();

// INT_MAX for parts of symbols that didn't get encoded.
Expand All @@ -181,5 +182,13 @@ void ToCNFAIG::fill_node_to_var(Cnf_Dat_t* cnfData,

nodeToVars.insert(make_pair(n, v));
}
if (!bm->isAnyProjSymbolDeclared())
{
std::cout << "c No variables declared as projection var, moving to "
"non-projection mode"
<< std::endl;
}
std::cout << "c Projection variables: " << proj_var_num
<< " Other variables: " << non_proj_var_num << std::endl;
}
} // namespace stp

0 comments on commit 7f8660c

Please sign in to comment.