2013-02-07 17:50:02 +00:00
|
|
|
#ifndef YAP_PACKAGES_CLPBN_HORUS_PARFACTORLIST_H_
|
|
|
|
#define YAP_PACKAGES_CLPBN_HORUS_PARFACTORLIST_H_
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
#include "Parfactor.h"
|
|
|
|
#include "ProbFormula.h"
|
|
|
|
|
2013-02-07 23:53:13 +00:00
|
|
|
|
2013-02-08 21:12:46 +00:00
|
|
|
namespace Horus {
|
2013-02-07 23:53:13 +00:00
|
|
|
|
2012-12-27 12:54:58 +00:00
|
|
|
class Parfactor;
|
|
|
|
|
2013-02-07 13:37:15 +00:00
|
|
|
|
2013-02-13 14:26:47 +00:00
|
|
|
class ParfactorList {
|
2012-05-23 14:56:01 +01:00
|
|
|
public:
|
2013-02-28 19:45:37 +00:00
|
|
|
ParfactorList() { }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
ParfactorList (const ParfactorList&);
|
|
|
|
|
|
|
|
ParfactorList (const Parfactors&);
|
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
~ParfactorList();
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
const std::list<Parfactor*>& parfactors() const { return pfList_; }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
void clear() { pfList_.clear(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
size_t size() const { return pfList_.size(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
typedef std::list<Parfactor*>::iterator iterator;
|
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
iterator begin() { return pfList_.begin(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
iterator end() { return pfList_.end(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
typedef std::list<Parfactor*>::const_iterator const_iterator;
|
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
const_iterator begin() const { return pfList_.begin(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
const_iterator end() const { return pfList_.end(); }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
void add (Parfactor* pf);
|
|
|
|
|
|
|
|
void add (const Parfactors& pfs);
|
|
|
|
|
|
|
|
void addShattered (Parfactor* pf);
|
|
|
|
|
2013-02-07 13:37:15 +00:00
|
|
|
std::list<Parfactor*>::iterator insertShattered (
|
|
|
|
std::list<Parfactor*>::iterator, Parfactor*);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-07 13:37:15 +00:00
|
|
|
std::list<Parfactor*>::iterator remove (
|
|
|
|
std::list<Parfactor*>::iterator);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-07 13:37:15 +00:00
|
|
|
std::list<Parfactor*>::iterator removeAndDelete (
|
|
|
|
std::list<Parfactor*>::iterator);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
bool isAllShattered() const;
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-28 19:45:37 +00:00
|
|
|
void print() const;
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-11-14 23:13:46 +00:00
|
|
|
ParfactorList& operator= (const ParfactorList& pfList);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool isShattered (const Parfactor*) const;
|
|
|
|
|
|
|
|
bool isShattered (const Parfactor*, const Parfactor*) const;
|
|
|
|
|
|
|
|
void addToShatteredList (Parfactor*);
|
|
|
|
|
|
|
|
Parfactors shatterAgainstMySelf (Parfactor* g);
|
|
|
|
|
|
|
|
Parfactors shatterAgainstMySelf2 (Parfactor* g);
|
|
|
|
|
|
|
|
Parfactors shatterAgainstMySelf (
|
2012-05-24 22:55:20 +01:00
|
|
|
Parfactor* g, size_t fIdx1, size_t fIdx2);
|
2012-12-17 18:39:42 +00:00
|
|
|
|
2012-05-23 14:56:01 +01:00
|
|
|
std::pair<Parfactors, Parfactors> shatter (
|
|
|
|
Parfactor*, Parfactor*);
|
|
|
|
|
|
|
|
std::pair<Parfactors, Parfactors> shatter (
|
2012-05-24 22:55:20 +01:00
|
|
|
size_t, Parfactor*, size_t, Parfactor*);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
Parfactors shatter (
|
|
|
|
Parfactor*,
|
2012-05-24 23:38:44 +01:00
|
|
|
size_t,
|
2012-05-23 14:56:01 +01:00
|
|
|
ConstraintTree*,
|
|
|
|
ConstraintTree*,
|
2012-05-24 23:38:44 +01:00
|
|
|
PrvGroup);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-05-24 23:38:44 +01:00
|
|
|
void updateGroups (PrvGroup group1, PrvGroup group2);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
bool proper (
|
|
|
|
const ProbFormula&, ConstraintTree,
|
|
|
|
const ProbFormula&, ConstraintTree) const;
|
|
|
|
|
|
|
|
bool identical (
|
|
|
|
const ProbFormula&, ConstraintTree,
|
|
|
|
const ProbFormula&, ConstraintTree) const;
|
|
|
|
|
|
|
|
bool disjoint (
|
|
|
|
const ProbFormula&, ConstraintTree,
|
|
|
|
const ProbFormula&, ConstraintTree) const;
|
|
|
|
|
2013-02-07 13:37:15 +00:00
|
|
|
std::list<Parfactor*> pfList_;
|
2012-05-23 14:56:01 +01:00
|
|
|
};
|
|
|
|
|
2013-02-08 21:12:46 +00:00
|
|
|
} // namespace Horus
|
2013-02-07 23:53:13 +00:00
|
|
|
|
2013-02-08 00:20:01 +00:00
|
|
|
#endif // YAP_PACKAGES_CLPBN_HORUS_PARFACTORLIST_H_
|
2012-05-23 14:56:01 +01:00
|
|
|
|