one step close to use one solver instatiation to solve several queries
This commit is contained in:
parent
b673dfd462
commit
4522850cd6
@ -4,8 +4,8 @@
|
||||
#include "LiftedOperations.h"
|
||||
|
||||
|
||||
LiftedBp::LiftedBp (const ParfactorList& pfList)
|
||||
: LiftedSolver (pfList), pfList_(pfList)
|
||||
LiftedBp::LiftedBp (const ParfactorList& parfactorList)
|
||||
: LiftedSolver (parfactorList)
|
||||
{
|
||||
refineParfactors();
|
||||
createFactorGraph();
|
||||
@ -82,6 +82,7 @@ LiftedBp::printSolverFlags (void) const
|
||||
void
|
||||
LiftedBp::refineParfactors (void)
|
||||
{
|
||||
pfList_ = parfactorList;
|
||||
while (iterate() == false);
|
||||
|
||||
if (Globals::verbosity > 2) {
|
||||
|
@ -16,7 +16,9 @@ LiftedKc::~LiftedKc (void)
|
||||
Params
|
||||
LiftedKc::solveQuery (const Grounds& query)
|
||||
{
|
||||
pfList_ = parfactorList;
|
||||
LiftedOperations::shatterAgainstQuery (pfList_, query);
|
||||
LiftedOperations::runWeakBayesBall (pfList_, query);
|
||||
lwcnf_ = new LiftedWCNF (pfList_);
|
||||
circuit_ = new LiftedCircuit (lwcnf_);
|
||||
vector<PrvGroup> groups;
|
||||
|
@ -12,7 +12,7 @@ class LiftedKc : public LiftedSolver
|
||||
{
|
||||
public:
|
||||
LiftedKc (const ParfactorList& pfList)
|
||||
: LiftedSolver(pfList), pfList_(pfList) { }
|
||||
: LiftedSolver(pfList) { }
|
||||
|
||||
~LiftedKc (void);
|
||||
|
||||
@ -21,10 +21,9 @@ class LiftedKc : public LiftedSolver
|
||||
void printSolverFlags (void) const;
|
||||
|
||||
private:
|
||||
LiftedWCNF* lwcnf_;
|
||||
LiftedCircuit* circuit_;
|
||||
|
||||
ParfactorList pfList_;
|
||||
LiftedWCNF* lwcnf_;
|
||||
LiftedCircuit* circuit_;
|
||||
ParfactorList pfList_;
|
||||
};
|
||||
|
||||
#endif // HORUS_LIFTEDKC_H
|
||||
|
@ -631,6 +631,7 @@ Params
|
||||
LiftedVe::solveQuery (const Grounds& query)
|
||||
{
|
||||
assert (query.empty() == false);
|
||||
pfList_ = parfactorList;
|
||||
runSolver (query);
|
||||
(*pfList_.begin())->normalize();
|
||||
Params params = (*pfList_.begin())->params();
|
||||
|
@ -136,7 +136,7 @@ class LiftedVe : public LiftedSolver
|
||||
{
|
||||
public:
|
||||
LiftedVe (const ParfactorList& pfList)
|
||||
: LiftedSolver(pfList), pfList_(pfList) { }
|
||||
: LiftedSolver(pfList) { }
|
||||
|
||||
Params solveQuery (const Grounds&);
|
||||
|
||||
|
@ -9,8 +9,7 @@ ParfactorList::ParfactorList (const ParfactorList& pfList)
|
||||
while (it != pfList.end()) {
|
||||
addShattered (new Parfactor (**it));
|
||||
++ it;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -126,6 +125,27 @@ ParfactorList::print (void) const
|
||||
|
||||
|
||||
|
||||
ParfactorList&
|
||||
ParfactorList::operator= (const ParfactorList& pfList)
|
||||
{
|
||||
if (this != &pfList) {
|
||||
ParfactorList::const_iterator it0 = pfList_.begin();
|
||||
while (it0 != pfList_.end()) {
|
||||
delete *it0;
|
||||
++ it0;
|
||||
}
|
||||
pfList_.clear();
|
||||
ParfactorList::const_iterator it = pfList.begin();
|
||||
while (it != pfList.end()) {
|
||||
addShattered (new Parfactor (**it));
|
||||
++ it;
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool
|
||||
ParfactorList::isShattered (const Parfactor* g) const
|
||||
{
|
||||
|
@ -56,6 +56,8 @@ class ParfactorList
|
||||
bool isAllShattered (void) const;
|
||||
|
||||
void print (void) const;
|
||||
|
||||
ParfactorList& operator= (const ParfactorList& pfList);
|
||||
|
||||
private:
|
||||
|
||||
|
Reference in New Issue
Block a user