Clean a bit LiftedWCNF class
This commit is contained in:
parent
bff56c75ca
commit
264ef7a067
|
@ -4,6 +4,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "LiftedWCNF.h"
|
#include "LiftedWCNF.h"
|
||||||
|
#include "ParfactorList.h"
|
||||||
#include "ConstraintTree.h"
|
#include "ConstraintTree.h"
|
||||||
#include "Indexer.h"
|
#include "Indexer.h"
|
||||||
|
|
||||||
|
@ -11,7 +12,9 @@
|
||||||
namespace horus {
|
namespace horus {
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Literal::isGround (ConstraintTree constr, LogVarSet ipgLogVars) const
|
Literal::isGround (
|
||||||
|
ConstraintTree constr,
|
||||||
|
const LogVarSet& ipgLogVars) const
|
||||||
{
|
{
|
||||||
if (logVars_.empty()) {
|
if (logVars_.empty()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -392,6 +395,14 @@ operator<< (std::ostream& os, const LitLvTypes& lit)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LitLvTypes::setAllFullLogVars (void)
|
||||||
|
{
|
||||||
|
std::fill (lvTypes_.begin(), lvTypes_.end(), LogVarType::FULL_LV);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
LiftedWCNF::LiftedWCNF (const ParfactorList& pfList)
|
||||||
: freeLiteralId_(0), pfList_(pfList)
|
: freeLiteralId_(0), pfList_(pfList)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,19 +6,16 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
||||||
#include "ParfactorList.h"
|
#include "ConstraintTree.h"
|
||||||
|
#include "ProbFormula.h"
|
||||||
|
#include "LiftedUtils.h"
|
||||||
|
|
||||||
|
|
||||||
namespace horus {
|
namespace horus {
|
||||||
|
|
||||||
class ConstraintTree;
|
class ParfactorList;
|
||||||
|
|
||||||
enum LogVarType
|
enum LogVarType { FULL_LV, POS_LV, NEG_LV };
|
||||||
{
|
|
||||||
FULL_LV,
|
|
||||||
POS_LV,
|
|
||||||
NEG_LV
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef long LiteralId;
|
typedef long LiteralId;
|
||||||
typedef std::vector<LogVarType> LogVarTypes;
|
typedef std::vector<LogVarType> LogVarTypes;
|
||||||
|
@ -27,11 +24,11 @@ typedef std::vector<LogVarType> LogVarTypes;
|
||||||
class Literal
|
class Literal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Literal (LiteralId lid, const LogVars& lvs) :
|
Literal (LiteralId lid, const LogVars& lvs)
|
||||||
lid_(lid), logVars_(lvs), negated_(false) { }
|
: lid_(lid), logVars_(lvs), negated_(false) { }
|
||||||
|
|
||||||
Literal (const Literal& lit, bool negated) :
|
Literal (const Literal& lit, bool negated)
|
||||||
lid_(lit.lid_), logVars_(lit.logVars_), negated_(negated) { }
|
: lid_(lit.lid_), logVars_(lit.logVars_), negated_(negated) { }
|
||||||
|
|
||||||
LiteralId lid (void) const { return lid_; }
|
LiteralId lid (void) const { return lid_; }
|
||||||
|
|
||||||
|
@ -47,13 +44,14 @@ class Literal
|
||||||
|
|
||||||
bool isNegative (void) const { return negated_; }
|
bool isNegative (void) const { return negated_; }
|
||||||
|
|
||||||
bool isGround (ConstraintTree constr, LogVarSet ipgLogVars) const;
|
bool isGround (ConstraintTree constr, const LogVarSet& ipgLogVars) const;
|
||||||
|
|
||||||
size_t indexOfLogVar (LogVar X) const;
|
size_t indexOfLogVar (LogVar X) const;
|
||||||
|
|
||||||
std::string toString (LogVarSet ipgLogVars = LogVarSet(),
|
std::string toString (
|
||||||
LogVarSet posCountedLvs = LogVarSet(),
|
LogVarSet ipgLogVars = LogVarSet(),
|
||||||
LogVarSet negCountedLvs = LogVarSet()) const;
|
LogVarSet posCountedLvs = LogVarSet(),
|
||||||
|
LogVarSet negCountedLvs = LogVarSet()) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend std::ostream& operator<< (std::ostream&, const Literal&);
|
friend std::ostream& operator<< (std::ostream&, const Literal&);
|
||||||
|
@ -172,8 +170,7 @@ class LitLvTypes
|
||||||
|
|
||||||
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); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend std::ostream& operator<< (std::ostream&, const LitLvTypes&);
|
friend std::ostream& operator<< (std::ostream&, const LitLvTypes&);
|
||||||
|
|
Reference in New Issue