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