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/clpbn/bp/VarElimSolver.h

45 lines
791 B
C
Raw Normal View History

2011-12-12 15:29:51 +00:00
#ifndef HORUS_VARELIMSOLVER_H
#define HORUS_VARELIMSOLVER_H
#include "unordered_map"
#include "Solver.h"
#include "FactorGraph.h"
2012-03-22 11:33:24 +00:00
#include "Horus.h"
2011-12-12 15:29:51 +00:00
using namespace std;
class VarElimSolver : public Solver
{
public:
2012-04-10 15:00:18 +01:00
VarElimSolver (const FactorGraph& fg) : Solver (fg) { }
2012-03-31 23:27:37 +01:00
2011-12-12 15:29:51 +00:00
~VarElimSolver (void);
2012-03-31 23:27:37 +01:00
2012-04-10 15:00:18 +01:00
Params solveQuery (VarIds);
2011-12-12 15:29:51 +00:00
void printSolverFlags (void) const;
2011-12-12 15:29:51 +00:00
private:
void createFactorList (void);
2012-03-31 23:27:37 +01:00
2012-04-05 18:38:56 +01:00
void absorveEvidence (void);
2012-03-31 23:27:37 +01:00
2012-04-05 18:38:56 +01:00
void findEliminationOrder (const VarIds&);
2012-03-31 23:27:37 +01:00
2012-03-22 11:33:24 +00:00
void processFactorList (const VarIds&);
2012-03-31 23:27:37 +01:00
2011-12-12 15:29:51 +00:00
void eliminate (VarId);
2012-03-31 23:27:37 +01:00
2011-12-12 15:29:51 +00:00
void printActiveFactors (void);
2012-03-22 11:33:24 +00:00
vector<Factor*> factorList_;
VarIds elimOrder_;
2011-12-12 15:29:51 +00:00
unordered_map<VarId, vector<unsigned>> varFactors_;
};
#endif // HORUS_VARELIMSOLVER_H