Avoid importing the std namespace
This commit is contained in:
@@ -24,13 +24,13 @@ Literal::indexOfLogVar (LogVar X) const
|
||||
|
||||
|
||||
|
||||
string
|
||||
std::string
|
||||
Literal::toString (
|
||||
LogVarSet ipgLogVars,
|
||||
LogVarSet posCountedLvs,
|
||||
LogVarSet negCountedLvs) const
|
||||
{
|
||||
stringstream ss;
|
||||
std::stringstream ss;
|
||||
negated_ ? ss << "¬" : ss << "" ;
|
||||
ss << "λ" ;
|
||||
ss << lid_ ;
|
||||
@@ -44,7 +44,7 @@ Literal::toString (
|
||||
ss << "-" << logVars_[i];
|
||||
} else if (ipgLogVars.contains (logVars_[i])) {
|
||||
LogVar X = logVars_[i];
|
||||
const string labels[] = {
|
||||
const std::string labels[] = {
|
||||
"a", "b", "c", "d", "e", "f",
|
||||
"g", "h", "i", "j", "k", "m" };
|
||||
(X >= 12) ? ss << "x_" << X : ss << labels[X];
|
||||
@@ -60,7 +60,7 @@ Literal::toString (
|
||||
|
||||
|
||||
std::ostream&
|
||||
operator<< (ostream &os, const Literal& lit)
|
||||
operator<< (std::ostream &os, const Literal& lit)
|
||||
{
|
||||
os << lit.toString();
|
||||
return os;
|
||||
@@ -320,7 +320,7 @@ void
|
||||
Clause::printClauses (const Clauses& clauses)
|
||||
{
|
||||
for (size_t i = 0; i < clauses.size(); i++) {
|
||||
cout << *clauses[i] << endl;
|
||||
std::cout << *clauses[i] << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ Clause::deleteClauses (Clauses& clauses)
|
||||
|
||||
|
||||
std::ostream&
|
||||
operator<< (ostream &os, const Clause& clause)
|
||||
operator<< (std::ostream &os, const Clause& clause)
|
||||
{
|
||||
for (unsigned i = 0; i < clause.literals_.size(); i++) {
|
||||
if (i != 0) os << " v " ;
|
||||
@@ -394,7 +394,7 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||
/*
|
||||
// INCLUSION-EXCLUSION TEST
|
||||
clauses_.clear();
|
||||
vector<vector<string>> names = {
|
||||
std::vector<std::vector<string>> names = {
|
||||
{"a1","b1"},{"a2","b2"}
|
||||
};
|
||||
Clause* c1 = new Clause (names);
|
||||
@@ -406,7 +406,7 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||
/*
|
||||
// INDEPENDENT PARTIAL GROUND TEST
|
||||
clauses_.clear();
|
||||
vector<vector<string>> names = {
|
||||
std::vector<std::vector<string>> names = {
|
||||
{"a1","b1"},{"a2","b2"}
|
||||
};
|
||||
Clause* c1 = new Clause (names);
|
||||
@@ -422,7 +422,7 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||
/*
|
||||
// ATOM-COUNTING TEST
|
||||
clauses_.clear();
|
||||
vector<vector<string>> names = {
|
||||
std::vector<std::vector<string>> names = {
|
||||
{"p1","p1"},{"p1","p2"},{"p1","p3"},
|
||||
{"p2","p1"},{"p2","p2"},{"p2","p3"},
|
||||
{"p3","p1"},{"p3","p2"},{"p3","p3"}
|
||||
@@ -438,15 +438,15 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||
*/
|
||||
|
||||
if (Globals::verbosity > 1) {
|
||||
cout << "FORMULA INDICATORS:" << endl;
|
||||
std::cout << "FORMULA INDICATORS:" << std::endl;
|
||||
printFormulaIndicators();
|
||||
cout << endl;
|
||||
cout << "WEIGHTED INDICATORS:" << endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "WEIGHTED INDICATORS:" << std::endl;
|
||||
printWeights();
|
||||
cout << endl;
|
||||
cout << "CLAUSES:" << endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "CLAUSES:" << std::endl;
|
||||
printClauses();
|
||||
cout << endl;
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ LiftedWCNF::~LiftedWCNF (void)
|
||||
void
|
||||
LiftedWCNF::addWeight (LiteralId lid, double posW, double negW)
|
||||
{
|
||||
weights_[lid] = make_pair (posW, negW);
|
||||
weights_[lid] = std::make_pair (posW, negW);
|
||||
}
|
||||
|
||||
|
||||
@@ -470,8 +470,8 @@ LiftedWCNF::addWeight (LiteralId lid, double posW, double negW)
|
||||
double
|
||||
LiftedWCNF::posWeight (LiteralId lid) const
|
||||
{
|
||||
unordered_map<LiteralId, std::pair<double,double>>::const_iterator it;
|
||||
it = weights_.find (lid);
|
||||
std::unordered_map<LiteralId, std::pair<double,double>>::const_iterator it
|
||||
= weights_.find (lid);
|
||||
return it != weights_.end() ? it->second.first : LogAware::one();
|
||||
}
|
||||
|
||||
@@ -480,14 +480,14 @@ LiftedWCNF::posWeight (LiteralId lid) const
|
||||
double
|
||||
LiftedWCNF::negWeight (LiteralId lid) const
|
||||
{
|
||||
unordered_map<LiteralId, std::pair<double,double>>::const_iterator it;
|
||||
it = weights_.find (lid);
|
||||
std::unordered_map<LiteralId, std::pair<double,double>>::const_iterator it
|
||||
= weights_.find (lid);
|
||||
return it != weights_.end() ? it->second.second : LogAware::one();
|
||||
}
|
||||
|
||||
|
||||
|
||||
vector<LiteralId>
|
||||
std::vector<LiteralId>
|
||||
LiftedWCNF::prvGroupLiterals (PrvGroup prvGroup)
|
||||
{
|
||||
assert (Util::contains (map_, prvGroup));
|
||||
@@ -536,7 +536,7 @@ LiftedWCNF::addIndicatorClauses (const ParfactorList& pfList)
|
||||
ConstraintTree tempConstr = (*it)->constr()->projectedCopy(
|
||||
formulas[i].logVars());
|
||||
Clause* clause = new Clause (tempConstr);
|
||||
vector<LiteralId> lids;
|
||||
std::vector<LiteralId> lids;
|
||||
for (size_t j = 0; j < formulas[i].range(); j++) {
|
||||
clause->addLiteral (Literal (freeLiteralId_, formulas[i].logVars()));
|
||||
lids.push_back (freeLiteralId_);
|
||||
@@ -568,7 +568,7 @@ LiftedWCNF::addParameterClauses (const ParfactorList& pfList)
|
||||
ParfactorList::const_iterator it = pfList.begin();
|
||||
while (it != pfList.end()) {
|
||||
Indexer indexer ((*it)->ranges());
|
||||
vector<PrvGroup> groups = (*it)->getAllGroups();
|
||||
std::vector<PrvGroup> groups = (*it)->getAllGroups();
|
||||
while (indexer.valid()) {
|
||||
LiteralId paramVarLid = freeLiteralId_;
|
||||
// λu1 ∧ ... ∧ λun ∧ λxi <=> θxi|u1,...,un
|
||||
@@ -611,21 +611,21 @@ LiftedWCNF::printFormulaIndicators (void) const
|
||||
if (map_.empty()) {
|
||||
return;
|
||||
}
|
||||
set<PrvGroup> allGroups;
|
||||
std::set<PrvGroup> allGroups;
|
||||
ParfactorList::const_iterator it = pfList_.begin();
|
||||
while (it != pfList_.end()) {
|
||||
const ProbFormulas& formulas = (*it)->arguments();
|
||||
for (size_t i = 0; i < formulas.size(); i++) {
|
||||
if (Util::contains (allGroups, formulas[i].group()) == false) {
|
||||
allGroups.insert (formulas[i].group());
|
||||
cout << formulas[i] << " | " ;
|
||||
std::cout << formulas[i] << " | " ;
|
||||
ConstraintTree tempCt = (*it)->constr()->projectedCopy (
|
||||
formulas[i].logVars());
|
||||
cout << tempCt.tupleSet();
|
||||
cout << " indicators => " ;
|
||||
vector<LiteralId> indicators =
|
||||
std::cout << tempCt.tupleSet();
|
||||
std::cout << " indicators => " ;
|
||||
std::vector<LiteralId> indicators =
|
||||
(map_.find (formulas[i].group()))->second;
|
||||
cout << indicators << endl;
|
||||
std::cout << indicators << std::endl;
|
||||
}
|
||||
}
|
||||
++ it;
|
||||
@@ -637,12 +637,12 @@ LiftedWCNF::printFormulaIndicators (void) const
|
||||
void
|
||||
LiftedWCNF::printWeights (void) const
|
||||
{
|
||||
unordered_map<LiteralId, std::pair<double,double>>::const_iterator it;
|
||||
it = weights_.begin();
|
||||
std::unordered_map<LiteralId, std::pair<double,double>>::const_iterator it
|
||||
= weights_.begin();
|
||||
while (it != weights_.end()) {
|
||||
cout << "λ" << it->first << " weights: " ;
|
||||
cout << it->second.first << " " << it->second.second;
|
||||
cout << endl;
|
||||
std::cout << "λ" << it->first << " weights: " ;
|
||||
std::cout << it->second.first << " " << it->second.second;
|
||||
std::cout << std::endl;
|
||||
++ it;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user