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/VarElim.h
2012-11-14 21:55:51 +00:00

47 lines
813 B
C++

#ifndef HORUS_VARELIM_H
#define HORUS_VARELIM_H
#include "unordered_map"
#include "GroundSolver.h"
#include "FactorGraph.h"
#include "Horus.h"
using namespace std;
class VarElim : public GroundSolver
{
public:
VarElim (const FactorGraph& fg) : GroundSolver (fg) { }
~VarElim (void);
Params solveQuery (VarIds);
void printSolverFlags (void) const;
private:
void createFactorList (void);
void absorveEvidence (void);
void findEliminationOrder (const VarIds&);
void processFactorList (const VarIds&);
void eliminate (VarId);
void printActiveFactors (void);
Factors factorList_;
VarIds elimOrder_;
unsigned largestFactorSize_;
unsigned totalFactorSize_;
unordered_map<VarId, vector<size_t>> varFactors_;
};
#endif // HORUS_VARELIM_H