LiftedKc: remove unnecessary data members
This commit is contained in:
parent
c9543514c5
commit
e434e87cc8
@ -3,6 +3,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "LiftedKc.h"
|
#include "LiftedKc.h"
|
||||||
|
#include "LiftedWCNF.h"
|
||||||
#include "LiftedOperations.h"
|
#include "LiftedOperations.h"
|
||||||
#include "Indexer.h"
|
#include "Indexer.h"
|
||||||
|
|
||||||
@ -1507,23 +1508,15 @@ LiftedCircuit::printClauses (
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
LiftedKc::~LiftedKc (void)
|
|
||||||
{
|
|
||||||
delete lwcnf_;
|
|
||||||
delete circuit_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Params
|
Params
|
||||||
LiftedKc::solveQuery (const Grounds& query)
|
LiftedKc::solveQuery (const Grounds& query)
|
||||||
{
|
{
|
||||||
pfList_ = parfactorList;
|
ParfactorList pfList (parfactorList);
|
||||||
LiftedOperations::shatterAgainstQuery (pfList_, query);
|
LiftedOperations::shatterAgainstQuery (pfList, query);
|
||||||
LiftedOperations::runWeakBayesBall (pfList_, query);
|
LiftedOperations::runWeakBayesBall (pfList, query);
|
||||||
lwcnf_ = new LiftedWCNF (pfList_);
|
LiftedWCNF lwcnf (pfList);
|
||||||
circuit_ = new LiftedCircuit (lwcnf_);
|
LiftedCircuit circuit (&lwcnf);
|
||||||
if (circuit_->isCompilationSucceeded() == false) {
|
if (circuit.isCompilationSucceeded() == false) {
|
||||||
std::cerr << "Error: the circuit compilation has failed." ;
|
std::cerr << "Error: the circuit compilation has failed." ;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@ -1531,8 +1524,8 @@ LiftedKc::solveQuery (const Grounds& query)
|
|||||||
std::vector<PrvGroup> groups;
|
std::vector<PrvGroup> groups;
|
||||||
Ranges ranges;
|
Ranges ranges;
|
||||||
for (size_t i = 0; i < query.size(); i++) {
|
for (size_t i = 0; i < query.size(); i++) {
|
||||||
ParfactorList::const_iterator it = pfList_.begin();
|
ParfactorList::const_iterator it = pfList.begin();
|
||||||
while (it != pfList_.end()) {
|
while (it != pfList.end()) {
|
||||||
size_t idx = (*it)->indexOfGround (query[i]);
|
size_t idx = (*it)->indexOfGround (query[i]);
|
||||||
if (idx != (*it)->nrArguments()) {
|
if (idx != (*it)->nrArguments()) {
|
||||||
groups.push_back ((*it)->argument (idx).group());
|
groups.push_back ((*it)->argument (idx).group());
|
||||||
@ -1547,18 +1540,18 @@ LiftedKc::solveQuery (const Grounds& query)
|
|||||||
Indexer indexer (ranges);
|
Indexer indexer (ranges);
|
||||||
while (indexer.valid()) {
|
while (indexer.valid()) {
|
||||||
for (size_t i = 0; i < groups.size(); i++) {
|
for (size_t i = 0; i < groups.size(); i++) {
|
||||||
std::vector<LiteralId> litIds = lwcnf_->prvGroupLiterals (groups[i]);
|
std::vector<LiteralId> litIds = lwcnf.prvGroupLiterals (groups[i]);
|
||||||
for (size_t j = 0; j < litIds.size(); j++) {
|
for (size_t j = 0; j < litIds.size(); j++) {
|
||||||
if (indexer[i] == j) {
|
if (indexer[i] == j) {
|
||||||
lwcnf_->addWeight (litIds[j], LogAware::one(),
|
lwcnf.addWeight (litIds[j], LogAware::one(),
|
||||||
LogAware::one());
|
LogAware::one());
|
||||||
} else {
|
} else {
|
||||||
lwcnf_->addWeight (litIds[j], LogAware::zero(),
|
lwcnf.addWeight (litIds[j], LogAware::zero(),
|
||||||
LogAware::one());
|
LogAware::one());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
params.push_back (circuit_->getWeightedModelCount());
|
params.push_back (circuit.getWeightedModelCount());
|
||||||
++ indexer;
|
++ indexer;
|
||||||
}
|
}
|
||||||
LogAware::normalize (params);
|
LogAware::normalize (params);
|
||||||
|
@ -7,30 +7,21 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "LiftedSolver.h"
|
#include "LiftedSolver.h"
|
||||||
#include "LiftedWCNF.h"
|
|
||||||
#include "ParfactorList.h"
|
#include "ParfactorList.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Horus {
|
namespace Horus {
|
||||||
|
|
||||||
class LiftedCircuit;
|
|
||||||
|
|
||||||
class LiftedKc : public LiftedSolver {
|
class LiftedKc : public LiftedSolver {
|
||||||
public:
|
public:
|
||||||
LiftedKc (const ParfactorList& pfList)
|
LiftedKc (const ParfactorList& pfList)
|
||||||
: LiftedSolver(pfList) { }
|
: LiftedSolver(pfList) { }
|
||||||
|
|
||||||
~LiftedKc (void);
|
|
||||||
|
|
||||||
Params solveQuery (const Grounds&);
|
Params solveQuery (const Grounds&);
|
||||||
|
|
||||||
void printSolverFlags (void) const;
|
void printSolverFlags (void) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LiftedWCNF* lwcnf_;
|
|
||||||
LiftedCircuit* circuit_;
|
|
||||||
ParfactorList pfList_;
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN (LiftedKc);
|
DISALLOW_COPY_AND_ASSIGN (LiftedKc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user