This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/horus/ParfactorList.h

112 lines
2.5 KiB
C
Raw Normal View History

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
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
class ParfactorList {
2012-05-23 14:56:01 +01:00
public:
ParfactorList() { }
2012-05-23 14:56:01 +01:00
ParfactorList (const ParfactorList&);
ParfactorList (const Parfactors&);
~ParfactorList();
2012-05-23 14:56:01 +01:00
const std::list<Parfactor*>& parfactors() const { return pfList_; }
2012-05-23 14:56:01 +01:00
void clear() { pfList_.clear(); }
2012-05-23 14:56:01 +01:00
size_t size() const { return pfList_.size(); }
2012-05-23 14:56:01 +01:00
typedef std::list<Parfactor*>::iterator iterator;
iterator begin() { return pfList_.begin(); }
2012-05-23 14:56:01 +01:00
iterator end() { return pfList_.end(); }
2012-05-23 14:56:01 +01:00
typedef std::list<Parfactor*>::const_iterator const_iterator;
const_iterator begin() const { return pfList_.begin(); }
2012-05-23 14:56:01 +01: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
bool isAllShattered() const;
2012-05-23 14:56:01 +01:00
void print() const;
2012-12-17 18:39:42 +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
};
} // 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