Whitespace clean
This commit is contained in:
parent
2f2f88e571
commit
3eb6b76ddd
@ -63,7 +63,7 @@ class BayesBallGraph
|
||||
void addEdge (VarId vid1, VarId vid2);
|
||||
|
||||
const BBNode* getNode (VarId vid) const;
|
||||
|
||||
|
||||
BBNode* getNode (VarId vid);
|
||||
|
||||
bool empty (void) const { return nodes_.empty(); }
|
||||
|
@ -59,7 +59,7 @@ class BpLink
|
||||
ss << var_->label();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
FacNode* fac_;
|
||||
VarNode* var_;
|
||||
@ -97,7 +97,7 @@ class BeliefProp : public GroundSolver
|
||||
virtual Params getPosterioriOf (VarId);
|
||||
|
||||
virtual Params getJointDistributionOf (const VarIds&);
|
||||
|
||||
|
||||
protected:
|
||||
void runSolver (void);
|
||||
|
||||
|
@ -57,7 +57,7 @@ class CTNode
|
||||
CTChilds_& childs (void) { return childs_; }
|
||||
|
||||
const CTChilds_& childs (void) const { return childs_; }
|
||||
|
||||
|
||||
size_t nrChilds (void) const { return childs_.size(); }
|
||||
|
||||
bool isRoot (void) const { return level_ == 0; }
|
||||
@ -108,7 +108,7 @@ class ConstraintTree
|
||||
ConstraintTree (const LogVars&);
|
||||
|
||||
ConstraintTree (const LogVars&, const Tuples&);
|
||||
|
||||
|
||||
ConstraintTree (vector<vector<string>> names);
|
||||
|
||||
ConstraintTree (const ConstraintTree&);
|
||||
@ -121,7 +121,7 @@ class ConstraintTree
|
||||
~ConstraintTree (void);
|
||||
|
||||
CTNode* root (void) const { return root_; }
|
||||
|
||||
|
||||
bool empty (void) const { return root_->childs().empty(); }
|
||||
|
||||
const LogVars& logVars (void) const
|
||||
@ -135,17 +135,17 @@ class ConstraintTree
|
||||
assert (LogVarSet (logVars_) == logVarSet_);
|
||||
return logVarSet_;
|
||||
}
|
||||
|
||||
|
||||
size_t nrLogVars (void) const
|
||||
{
|
||||
return logVars_.size();
|
||||
assert (LogVarSet (logVars_) == logVarSet_);
|
||||
}
|
||||
|
||||
|
||||
void addTuple (const Tuple&);
|
||||
|
||||
|
||||
bool containsTuple (const Tuple&);
|
||||
|
||||
|
||||
void moveToTop (const LogVars&);
|
||||
|
||||
void moveToBottom (const LogVars&);
|
||||
@ -159,7 +159,7 @@ class ConstraintTree
|
||||
void applySubstitution (const Substitution&);
|
||||
|
||||
void project (const LogVarSet&);
|
||||
|
||||
|
||||
ConstraintTree projectedCopy (const LogVarSet&);
|
||||
|
||||
void remove (const LogVarSet&);
|
||||
@ -201,9 +201,9 @@ class ConstraintTree
|
||||
ConstraintTrees ground (LogVar);
|
||||
|
||||
void copyLogVar (LogVar,LogVar);
|
||||
|
||||
|
||||
ConstraintTree& operator= (const ConstraintTree& ct);
|
||||
|
||||
|
||||
private:
|
||||
unsigned countTuples (const CTNode*) const;
|
||||
|
||||
|
@ -88,13 +88,13 @@ class FacCluster
|
||||
const FacNode* first (void) const { return members_.front(); }
|
||||
|
||||
const FacNodes& members (void) const { return members_; }
|
||||
|
||||
|
||||
FacNode* representative (void) const { return repr_; }
|
||||
|
||||
void setRepresentative (FacNode* fn) { repr_ = fn; }
|
||||
|
||||
VarClusters& varClusters (void) { return varClusters_; }
|
||||
|
||||
|
||||
private:
|
||||
FacNodes members_;
|
||||
FacNode* repr_;
|
||||
@ -112,9 +112,9 @@ class CountingBp : public GroundSolver
|
||||
void printSolverFlags (void) const;
|
||||
|
||||
Params solveQuery (VarIds);
|
||||
|
||||
|
||||
static bool checkForIdenticalFactors;
|
||||
|
||||
|
||||
private:
|
||||
Color getNewColor (void)
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ ElimGraph::ElimGraph (const vector<Factor*>& factors)
|
||||
ElimGraph::~ElimGraph (void)
|
||||
{
|
||||
for (size_t i = 0; i < nodes_.size(); i++) {
|
||||
delete nodes_[i];
|
||||
delete nodes_[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
enum ElimHeuristic
|
||||
enum ElimHeuristic
|
||||
{
|
||||
SEQUENTIAL,
|
||||
MIN_NEIGHBORS,
|
||||
@ -49,7 +49,7 @@ class ElimGraph
|
||||
ElimGraph (const Factors&);
|
||||
|
||||
~ElimGraph (void);
|
||||
|
||||
|
||||
VarIds getEliminatingOrder (const VarIds&);
|
||||
|
||||
void print (void) const;
|
||||
|
@ -34,7 +34,7 @@ class TFactor
|
||||
void setDistId (unsigned id) { distId_ = id; }
|
||||
|
||||
void normalize (void) { LogAware::normalize (params_); }
|
||||
|
||||
|
||||
void randomize (void)
|
||||
{
|
||||
for (size_t i = 0; i < params_.size(); ++i) {
|
||||
@ -207,7 +207,7 @@ class TFactor
|
||||
Ranges ranges_;
|
||||
Params params_;
|
||||
unsigned distId_;
|
||||
|
||||
|
||||
private:
|
||||
void extend (unsigned range_prod)
|
||||
{
|
||||
|
@ -15,8 +15,8 @@ class FacNode;
|
||||
class VarNode : public Var
|
||||
{
|
||||
public:
|
||||
VarNode (VarId varId, unsigned nrStates,
|
||||
int evidence = Constants::NO_EVIDENCE)
|
||||
VarNode (VarId varId, unsigned nrStates,
|
||||
int evidence = Constants::NO_EVIDENCE)
|
||||
: Var (varId, nrStates, evidence) { }
|
||||
|
||||
VarNode (const Var* v) : Var (v) { }
|
||||
@ -77,7 +77,7 @@ class FactorGraph
|
||||
|
||||
void setFactorsAsBayesian (void) { bayesFactors_ = true; }
|
||||
|
||||
bool bayesianFactors (void) const { return bayesFactors_ ; }
|
||||
bool bayesianFactors (void) const { return bayesFactors_; }
|
||||
|
||||
size_t nrVarNodes (void) const { return varNodes_.size(); }
|
||||
|
||||
@ -112,7 +112,7 @@ class FactorGraph
|
||||
void exportToUaiFormat (const char*) const;
|
||||
|
||||
void exportToLibDaiFormat (const char*) const;
|
||||
|
||||
|
||||
private:
|
||||
// DISALLOW_COPY_AND_ASSIGN (FactorGraph);
|
||||
|
||||
@ -130,7 +130,7 @@ class FactorGraph
|
||||
FacNodes facNodes_;
|
||||
|
||||
BayesBallGraph structure_;
|
||||
bool bayesFactors_;
|
||||
bool bayesFactors_;
|
||||
|
||||
typedef unordered_map<unsigned, VarNode*> VarMap;
|
||||
VarMap varMap_;
|
||||
@ -139,8 +139,8 @@ class FactorGraph
|
||||
|
||||
|
||||
struct sortByVarId
|
||||
{
|
||||
bool operator()(VarNode* vn1, VarNode* vn2) {
|
||||
{
|
||||
bool operator()(VarNode* vn1, VarNode* vn2) {
|
||||
return vn1->varId() < vn2->varId();
|
||||
}
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ class GroundSolver
|
||||
|
||||
Params getJointByConditioning (GroundSolverType,
|
||||
FactorGraph, const VarIds& jointVarIds) const;
|
||||
|
||||
|
||||
protected:
|
||||
const FactorGraph& fg;
|
||||
};
|
||||
|
@ -12,17 +12,17 @@ class HistogramSet
|
||||
{
|
||||
public:
|
||||
HistogramSet (unsigned, unsigned);
|
||||
|
||||
|
||||
void nextHistogram (void);
|
||||
|
||||
unsigned operator[] (size_t idx) const;
|
||||
|
||||
|
||||
unsigned nrHistograms (void) const;
|
||||
|
||||
void reset (void);
|
||||
|
||||
static vector<Histogram> getHistograms (unsigned ,unsigned);
|
||||
|
||||
|
||||
static unsigned nrHistograms (unsigned, unsigned);
|
||||
|
||||
static size_t findIndex (
|
||||
@ -31,14 +31,14 @@ class HistogramSet
|
||||
static vector<double> getNumAssigns (unsigned, unsigned);
|
||||
|
||||
friend std::ostream& operator<< (ostream &os, const HistogramSet& hs);
|
||||
|
||||
|
||||
private:
|
||||
unsigned maxCount (size_t) const;
|
||||
|
||||
void clearAfter (size_t);
|
||||
|
||||
unsigned size_;
|
||||
Histogram hist_;
|
||||
unsigned size_;
|
||||
Histogram hist_;
|
||||
};
|
||||
|
||||
#endif // HORUS_HISTOGRAM_H
|
||||
|
@ -133,12 +133,12 @@ runLiftedSolver (void)
|
||||
case LiftedSolverType::LBP: solver = new LiftedBp (pfListCopy); break;
|
||||
case LiftedSolverType::LKC: solver = new LiftedKc (pfListCopy); break;
|
||||
}
|
||||
|
||||
|
||||
if (Globals::verbosity > 0) {
|
||||
solver->printSolverFlags();
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
||||
YAP_Term taskList = YAP_ARG2;
|
||||
vector<Params> results;
|
||||
while (taskList != YAP_TermNil()) {
|
||||
|
@ -185,7 +185,7 @@ LiftedBp::rangeOfGround (const Ground& gr)
|
||||
return std::numeric_limits<unsigned>::max();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Params
|
||||
LiftedBp::getJointByConditioning (
|
||||
|
@ -28,7 +28,7 @@ class LiftedBp : public LiftedSolver
|
||||
void createFactorGraph (void);
|
||||
|
||||
vector<vector<unsigned>> getWeights (void) const;
|
||||
|
||||
|
||||
unsigned rangeOfGround (const Ground&);
|
||||
|
||||
Params getJointByConditioning (const ParfactorList&, const Grounds&);
|
||||
|
@ -238,7 +238,7 @@ LiftedCircuit::compile (
|
||||
*follow = new TrueNode();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (clauses.size() == 1 && clauses[0]->isUnit()) {
|
||||
*follow = new LeafNode (clauses[0], *lwcnf_);
|
||||
return;
|
||||
@ -326,13 +326,13 @@ LiftedCircuit::tryUnitPropagation (
|
||||
explanation << " UP on " << clauses[i]->literals()[0];
|
||||
explanationMap_[andNode] = explanation.str();
|
||||
}
|
||||
|
||||
|
||||
Clauses unitClause = { clauses[i] };
|
||||
compile (andNode->leftBranch(), unitClause);
|
||||
compile (andNode->rightBranch(), propagClauses);
|
||||
(*follow) = andNode;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -409,11 +409,11 @@ LiftedCircuit::tryShannonDecomp (
|
||||
explanation << " SD on " << literals[j];
|
||||
explanationMap_[orNode] = explanation.str();
|
||||
}
|
||||
|
||||
|
||||
compile (orNode->leftBranch(), clauses);
|
||||
compile (orNode->rightBranch(), otherClauses);
|
||||
(*follow) = orNode;
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -949,7 +949,7 @@ LiftedCircuit::exportToGraphViz (CircuitNode* node, ofstream& os)
|
||||
{
|
||||
assert (node != 0);
|
||||
|
||||
static unsigned nrAuxNodes = 0;
|
||||
static unsigned nrAuxNodes = 0;
|
||||
stringstream ss;
|
||||
ss << "n" << nrAuxNodes;
|
||||
string auxNode = ss.str();
|
||||
@ -957,7 +957,7 @@ LiftedCircuit::exportToGraphViz (CircuitNode* node, ofstream& os)
|
||||
string opStyle = "shape=circle,width=0.7,margin=\"0.0,0.0\"," ;
|
||||
|
||||
switch (getCircuitNodeType (node)) {
|
||||
|
||||
|
||||
case OR_NODE: {
|
||||
OrNode* casted = dynamic_cast<OrNode*>(node);
|
||||
printClauses (casted, os);
|
||||
@ -966,7 +966,7 @@ LiftedCircuit::exportToGraphViz (CircuitNode* node, ofstream& os)
|
||||
os << escapeNode (node) << " -> " << auxNode;
|
||||
os << " [label=\"" << getExplanationString (node) << "\"]" ;
|
||||
os << endl;
|
||||
|
||||
|
||||
os << auxNode << " -> " ;
|
||||
os << escapeNode (*casted->leftBranch());
|
||||
os << " [label=\" " << (*casted->leftBranch())->weight() << "\"]" ;
|
||||
|
@ -33,7 +33,7 @@ class CircuitNode
|
||||
class OrNode : public CircuitNode
|
||||
{
|
||||
public:
|
||||
OrNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { }
|
||||
OrNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { }
|
||||
|
||||
CircuitNode** leftBranch (void) { return &leftBranch_; }
|
||||
CircuitNode** rightBranch (void) { return &rightBranch_; }
|
||||
@ -51,7 +51,7 @@ class AndNode : public CircuitNode
|
||||
{
|
||||
public:
|
||||
AndNode (void) : CircuitNode(), leftBranch_(0), rightBranch_(0) { }
|
||||
|
||||
|
||||
AndNode (CircuitNode* leftBranch, CircuitNode* rightBranch)
|
||||
: CircuitNode(), leftBranch_(leftBranch), rightBranch_(rightBranch) { }
|
||||
|
||||
@ -153,13 +153,13 @@ class SmoothNode : public CircuitNode
|
||||
public:
|
||||
SmoothNode (const Clauses& clauses, const LiftedWCNF& lwcnf)
|
||||
: CircuitNode(), clauses_(clauses), lwcnf_(lwcnf) { }
|
||||
|
||||
|
||||
const Clauses& clauses (void) const { return clauses_; }
|
||||
|
||||
Clauses clauses (void) { return clauses_; }
|
||||
|
||||
double weight (void) const;
|
||||
|
||||
|
||||
double weight (void) const;
|
||||
|
||||
private:
|
||||
Clauses clauses_;
|
||||
const LiftedWCNF& lwcnf_;
|
||||
@ -246,16 +246,15 @@ class LiftedCircuit
|
||||
string extraOptions = "");
|
||||
|
||||
string escapeNode (const CircuitNode* node) const;
|
||||
|
||||
|
||||
string getExplanationString (CircuitNode* node);
|
||||
|
||||
CircuitNode* root_;
|
||||
const LiftedWCNF* lwcnf_;
|
||||
|
||||
bool compilationSucceeded_;
|
||||
Clauses backupClauses_;
|
||||
unordered_map<CircuitNode*, Clauses> originClausesMap_;
|
||||
unordered_map<CircuitNode*, string> explanationMap_;
|
||||
bool compilationSucceeded_;
|
||||
};
|
||||
|
||||
#endif // HORUS_LIFTEDCIRCUIT_H
|
||||
|
@ -8,19 +8,20 @@ class LiftedOperations
|
||||
public:
|
||||
static void shatterAgainstQuery (
|
||||
ParfactorList& pfList, const Grounds& query);
|
||||
|
||||
|
||||
static void runWeakBayesBall (
|
||||
ParfactorList& pfList, const Grounds&);
|
||||
|
||||
|
||||
static void absorveEvidence (
|
||||
ParfactorList& pfList, ObservedFormulas& obsFormulas);
|
||||
|
||||
|
||||
static Parfactors countNormalize (Parfactor*, const LogVarSet&);
|
||||
|
||||
static Parfactor calcGroundMultiplication (Parfactor pf);
|
||||
|
||||
private:
|
||||
static Parfactors absorve (ObservedFormula&, Parfactor*);
|
||||
static Parfactors absorve (ObservedFormula&, Parfactor*);
|
||||
};
|
||||
|
||||
#endif // HORUS_LIFTEDOPERATIONS_H
|
||||
|
||||
|
@ -149,7 +149,7 @@ class Substitution
|
||||
{
|
||||
return Util::contains (subs_, X);
|
||||
}
|
||||
|
||||
|
||||
size_t nrReplacements (void) const { return subs_.size(); }
|
||||
|
||||
LogVars getDiscardedLogVars (void) const;
|
||||
|
@ -108,7 +108,7 @@ Clause::containsPositiveLiteral (
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool
|
||||
Clause::containsNegativeLiteral (
|
||||
LiteralId lid,
|
||||
@ -427,7 +427,7 @@ LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||
c2->addLiteralComplemented (Literal (1, {1,0}));
|
||||
clauses_.push_back(c2);
|
||||
*/
|
||||
|
||||
|
||||
if (Globals::verbosity > 1) {
|
||||
cout << "FORMULA INDICATORS:" << endl;
|
||||
printFormulaIndicators();
|
||||
@ -631,7 +631,7 @@ LiftedWCNF::printWeights (void) const
|
||||
unordered_map<LiteralId, std::pair<double,double>>::const_iterator it;
|
||||
it = weights_.begin();
|
||||
while (it != weights_.end()) {
|
||||
cout << "λ" << it->first << " weights: " ;
|
||||
cout << "λ" << it->first << " weights: " ;
|
||||
cout << it->second.first << " " << it->second.second;
|
||||
cout << endl;
|
||||
++ it;
|
||||
|
@ -33,19 +33,19 @@ class Literal
|
||||
LiteralId lid (void) const { return lid_; }
|
||||
|
||||
LogVars logVars (void) const { return logVars_; }
|
||||
|
||||
size_t nrLogVars (void) const { return logVars_.size(); }
|
||||
|
||||
size_t nrLogVars (void) const { return logVars_.size(); }
|
||||
|
||||
LogVarSet logVarSet (void) const { return LogVarSet (logVars_); }
|
||||
|
||||
|
||||
void complement (void) { negated_ = !negated_; }
|
||||
|
||||
bool isPositive (void) const { return negated_ == false; }
|
||||
|
||||
bool isNegative (void) const { return negated_; }
|
||||
|
||||
|
||||
bool isGround (ConstraintTree constr, LogVarSet ipgLogVars) const;
|
||||
|
||||
|
||||
size_t indexOfLogVar (LogVar X) const;
|
||||
|
||||
string toString (LogVarSet ipgLogVars = LogVarSet(),
|
||||
@ -74,9 +74,9 @@ class Clause
|
||||
void addLiteral (const Literal& l) { literals_.push_back (l); }
|
||||
|
||||
const Literals& literals (void) const { return literals_; }
|
||||
|
||||
|
||||
Literals& literals (void) { return literals_; }
|
||||
|
||||
|
||||
size_t nrLiterals (void) const { return literals_.size(); }
|
||||
|
||||
const ConstraintTree& constr (void) const { return constr_; }
|
||||
@ -100,7 +100,7 @@ class Clause
|
||||
unsigned nrPosCountedLogVars (void) const { return posCountedLvs_.size(); }
|
||||
|
||||
unsigned nrNegCountedLogVars (void) const { return negCountedLvs_.size(); }
|
||||
|
||||
|
||||
void addLiteralComplemented (const Literal& lit);
|
||||
|
||||
bool containsLiteral (LiteralId lid) const;
|
||||
@ -119,8 +119,8 @@ class Clause
|
||||
|
||||
bool isPositiveCountedLogVar (LogVar X) const;
|
||||
|
||||
bool isNegativeCountedLogVar (LogVar X) const;
|
||||
|
||||
bool isNegativeCountedLogVar (LogVar X) const;
|
||||
|
||||
bool isIpgLogVar (LogVar X) const;
|
||||
|
||||
TinySet<LiteralId> lidSet (void) const;
|
||||
@ -130,13 +130,13 @@ class Clause
|
||||
LogVarTypes logVarTypes (size_t litIdx) const;
|
||||
|
||||
void removeLiteral (size_t litIdx);
|
||||
|
||||
|
||||
static bool independentClauses (Clause& c1, Clause& c2);
|
||||
|
||||
static vector<Clause*> copyClauses (const vector<Clause*>& clauses);
|
||||
|
||||
static vector<Clause*> copyClauses (const vector<Clause*>& clauses);
|
||||
|
||||
static void printClauses (const vector<Clause*>& clauses);
|
||||
|
||||
|
||||
friend std::ostream& operator<< (ostream &os, const Clause& clause);
|
||||
|
||||
private:
|
||||
@ -171,14 +171,14 @@ class LitLvTypes
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
LitLvTypes (LiteralId lid, const LogVarTypes& lvTypes) :
|
||||
lid_(lid), lvTypes_(lvTypes) { }
|
||||
|
||||
|
||||
LiteralId lid (void) const { return lid_; }
|
||||
|
||||
|
||||
const LogVarTypes& logVarTypes (void) const { return lvTypes_; }
|
||||
|
||||
|
||||
void setAllFullLogVars (void) {
|
||||
std::fill (lvTypes_.begin(), lvTypes_.end(), LogVarType::FULL_LV); }
|
||||
|
||||
@ -228,7 +228,7 @@ class LiftedWCNF
|
||||
|
||||
Clauses clauses_;
|
||||
LiteralId freeLiteralId_;
|
||||
const ParfactorList& pfList_;
|
||||
const ParfactorList& pfList_;
|
||||
unordered_map<PrvGroup, vector<LiteralId>> map_;
|
||||
unordered_map<LiteralId, std::pair<double,double>> weights_;
|
||||
};
|
||||
|
@ -23,10 +23,10 @@ CC=@CC@
|
||||
CXX=@CXX@
|
||||
|
||||
# normal
|
||||
#CXXFLAGS= -std=c++0x @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../../.. -I$(srcdir)/../../../include @CPPFLAGS@ -DNDEBUG
|
||||
CXXFLAGS= -std=c++0x @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../../.. -I$(srcdir)/../../../include @CPPFLAGS@ -DNDEBUG
|
||||
|
||||
# debug
|
||||
CXXFLAGS= -std=c++0x @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../../.. -I$(srcdir)/../../../include @CPPFLAGS@ -g -O0 -Wextra
|
||||
#CXXFLAGS= -std=c++0x @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) -D_YAP_NOT_INSTALLED_=1 -I$(srcdir) -I../../.. -I$(srcdir)/../../../include @CPPFLAGS@ -g -O0 -Wextra
|
||||
|
||||
|
||||
#
|
||||
@ -57,13 +57,13 @@ HEADERS = \
|
||||
$(srcdir)/Horus.h \
|
||||
$(srcdir)/Indexer.h \
|
||||
$(srcdir)/LiftedBp.h \
|
||||
$(srcdir)/LiftedCircuit.h \
|
||||
$(srcdir)/LiftedKc.h \
|
||||
$(srcdir)/LiftedOperations.h \
|
||||
$(srcdir)/LiftedSolver.h \
|
||||
$(srcdir)/LiftedCircuit.h \
|
||||
$(srcdir)/LiftedKc.h \
|
||||
$(srcdir)/LiftedOperations.h \
|
||||
$(srcdir)/LiftedSolver.h \
|
||||
$(srcdir)/LiftedUtils.h \
|
||||
$(srcdir)/LiftedVe.h \
|
||||
$(srcdir)/LiftedWCNF.h \
|
||||
$(srcdir)/LiftedWCNF.h \
|
||||
$(srcdir)/Parfactor.h \
|
||||
$(srcdir)/ParfactorList.h \
|
||||
$(srcdir)/ProbFormula.h \
|
||||
@ -73,7 +73,7 @@ HEADERS = \
|
||||
$(srcdir)/Var.h \
|
||||
$(srcdir)/VarElim.h \
|
||||
$(srcdir)/WeightedBp.h
|
||||
|
||||
|
||||
CPP_SOURCES = \
|
||||
$(srcdir)/BayesBall.cpp \
|
||||
$(srcdir)/BayesBallGraph.cpp \
|
||||
@ -87,12 +87,12 @@ CPP_SOURCES = \
|
||||
$(srcdir)/HorusCli.cpp \
|
||||
$(srcdir)/HorusYap.cpp \
|
||||
$(srcdir)/LiftedBp.cpp \
|
||||
$(srcdir)/LiftedCircuit.cpp \
|
||||
$(srcdir)/LiftedKc.cpp \
|
||||
$(srcdir)/LiftedOperations.cpp \
|
||||
$(srcdir)/LiftedCircuit.cpp \
|
||||
$(srcdir)/LiftedKc.cpp \
|
||||
$(srcdir)/LiftedOperations.cpp \
|
||||
$(srcdir)/LiftedUtils.cpp \
|
||||
$(srcdir)/LiftedVe.cpp \
|
||||
$(srcdir)/LiftedWCNF.cpp \
|
||||
$(srcdir)/LiftedWCNF.cpp \
|
||||
$(srcdir)/Parfactor.cpp \
|
||||
$(srcdir)/ParfactorList.cpp \
|
||||
$(srcdir)/ProbFormula.cpp \
|
||||
@ -114,12 +114,12 @@ OBJS = \
|
||||
Histogram.o \
|
||||
HorusYap.o \
|
||||
LiftedBp.o \
|
||||
LiftedCircuit.o \
|
||||
LiftedKc.o \
|
||||
LiftedOperations.o \
|
||||
LiftedCircuit.o \
|
||||
LiftedKc.o \
|
||||
LiftedOperations.o \
|
||||
LiftedUtils.o \
|
||||
LiftedVe.o \
|
||||
LiftedWCNF.o \
|
||||
LiftedWCNF.o \
|
||||
ProbFormula.o \
|
||||
Parfactor.o \
|
||||
ParfactorList.o \
|
||||
@ -178,8 +178,8 @@ depend: $(HEADERS) $(CPP_SOURCES)
|
||||
-@if test "$(GCC)" = yes; then\
|
||||
$(CC) -std=c++0x -MM -MG $(CFLAGS) -I$(srcdir) -I$(srcdir)/../../../../include -I$(srcdir)/../../../../H $(CPP_SOURCES) >> Makefile;\
|
||||
else\
|
||||
makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../../../H -I$(srcdir)/../../../../include -- $(CPP_SOURCES) |\
|
||||
sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
|
||||
makedepend -f - -- $(CFLAGS) -I$(srcdir)/../../../../H -I$(srcdir)/../../../../include -- $(CPP_SOURCES) |\
|
||||
sed 's|.*/\([^:]*\):|\1:|' >> Makefile ;\
|
||||
fi
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
@ -33,21 +33,21 @@ class Parfactor : public TFactor<ProbFormula>
|
||||
const ConstraintTree* constr (void) const { return constr_; }
|
||||
|
||||
const LogVars& logVars (void) const { return constr_->logVars(); }
|
||||
|
||||
|
||||
const LogVarSet& logVarSet (void) const { return constr_->logVarSet(); }
|
||||
|
||||
LogVarSet countedLogVars (void) const;
|
||||
|
||||
LogVarSet uncountedLogVars (void) const;
|
||||
|
||||
|
||||
LogVarSet elimLogVars (void) const;
|
||||
|
||||
|
||||
LogVarSet exclusiveLogVars (size_t fIdx) const;
|
||||
|
||||
|
||||
void sumOutIndex (size_t fIdx);
|
||||
|
||||
void multiply (Parfactor&);
|
||||
|
||||
|
||||
bool canCountConvert (LogVar X);
|
||||
|
||||
void countConvert (LogVar);
|
||||
@ -75,7 +75,7 @@ class Parfactor : public TFactor<ProbFormula>
|
||||
bool containsGroup (PrvGroup) const;
|
||||
|
||||
bool containsGroups (vector<PrvGroup>) const;
|
||||
|
||||
|
||||
unsigned nrFormulas (LogVar) const;
|
||||
|
||||
int indexOfLogVar (LogVar) const;
|
||||
@ -99,7 +99,7 @@ class Parfactor : public TFactor<ProbFormula>
|
||||
static bool canMultiply (Parfactor*, Parfactor*);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
void simplifyCountingFormulas (size_t fIdx);
|
||||
|
||||
void simplifyParfactor (size_t fIdx1, size_t fIdx2);
|
||||
@ -113,7 +113,7 @@ class Parfactor : public TFactor<ProbFormula>
|
||||
static void alignAndExponentiate (Parfactor*, Parfactor*);
|
||||
|
||||
static void alignLogicalVars (Parfactor*, Parfactor*);
|
||||
|
||||
|
||||
ConstraintTree* constr_;
|
||||
|
||||
};
|
||||
|
@ -221,7 +221,7 @@ ParfactorList::isShattered (
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
ParfactorList::addToShatteredList (Parfactor* g)
|
||||
{
|
||||
@ -481,7 +481,7 @@ ParfactorList::shatter (
|
||||
ConstraintTree* commCt2 = split2.first;
|
||||
ConstraintTree* exclCt2 = split2.second;
|
||||
|
||||
assert (commCt1->tupleSet (f1.logVars()) ==
|
||||
assert (commCt1->tupleSet (f1.logVars()) ==
|
||||
commCt2->tupleSet (f2.logVars()));
|
||||
|
||||
// stringstream ss1; ss1 << "" << count << "_A.dot" ;
|
||||
|
@ -56,11 +56,10 @@ class ParfactorList
|
||||
bool isAllShattered (void) const;
|
||||
|
||||
void print (void) const;
|
||||
|
||||
|
||||
ParfactorList& operator= (const ParfactorList& pfList);
|
||||
|
||||
private:
|
||||
|
||||
bool isShattered (const Parfactor*) const;
|
||||
|
||||
bool isShattered (const Parfactor*, const Parfactor*) const;
|
||||
@ -73,7 +72,7 @@ class ParfactorList
|
||||
|
||||
Parfactors shatterAgainstMySelf (
|
||||
Parfactor* g, size_t fIdx1, size_t fIdx2);
|
||||
|
||||
|
||||
std::pair<Parfactors, Parfactors> shatter (
|
||||
Parfactor*, Parfactor*);
|
||||
|
||||
|
@ -30,11 +30,11 @@ class ProbFormula
|
||||
const LogVars& logVars (void) const { return logVars_; }
|
||||
|
||||
LogVarSet logVarSet (void) const { return LogVarSet (logVars_); }
|
||||
|
||||
|
||||
PrvGroup group (void) const { return group_; }
|
||||
|
||||
void setGroup (PrvGroup g) { group_ = g; }
|
||||
|
||||
|
||||
bool sameSkeletonAs (const ProbFormula&) const;
|
||||
|
||||
bool contains (LogVar) const;
|
||||
@ -48,20 +48,20 @@ class ProbFormula
|
||||
bool isCounting (void) const;
|
||||
|
||||
LogVar countedLogVar (void) const;
|
||||
|
||||
|
||||
void setCountedLogVar (LogVar);
|
||||
|
||||
void clearCountedLogVar (void);
|
||||
|
||||
|
||||
void rename (LogVar, LogVar);
|
||||
|
||||
|
||||
static PrvGroup getNewGroup (void);
|
||||
|
||||
friend std::ostream& operator<< (ostream &os, const ProbFormula& f);
|
||||
|
||||
friend bool operator== (const ProbFormula& f1, const ProbFormula& f2);
|
||||
|
||||
private:
|
||||
private:
|
||||
Symbol functor_;
|
||||
LogVars logVars_;
|
||||
unsigned range_;
|
||||
|
@ -225,7 +225,7 @@ class TinySet
|
||||
typename vector<T>::size_type i;
|
||||
for (i = 0; i < s.size(); i++) {
|
||||
out << ((i != 0) ? "," : "") << s.vec_[i];
|
||||
}
|
||||
}
|
||||
out << "}" ;
|
||||
return out;
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ VarElim::createFactorList (void)
|
||||
it->second.push_back (i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ class WeightedLink : public BpLink
|
||||
swap (currMsg_, nextMsg_);
|
||||
LogAware::pow (pwdMsg_, weight_);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
size_t index_;
|
||||
unsigned weight_;
|
||||
@ -33,13 +33,13 @@ class WeightedLink : public BpLink
|
||||
|
||||
class WeightedBp : public BeliefProp
|
||||
{
|
||||
public:
|
||||
public:
|
||||
WeightedBp (const FactorGraph& fg,
|
||||
const vector<vector<unsigned>>& weights)
|
||||
: BeliefProp (fg), weights_(weights) { }
|
||||
|
||||
~WeightedBp (void);
|
||||
|
||||
|
||||
Params getPosterioriOf (VarId);
|
||||
|
||||
private:
|
||||
@ -53,7 +53,7 @@ class WeightedBp : public BeliefProp
|
||||
Params getVarToFactorMsg (const BpLink*) const;
|
||||
|
||||
void printLinkInformation (void) const;
|
||||
|
||||
|
||||
vector<vector<unsigned>> weights_;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user