2013-02-07 17:50:02 +00:00
|
|
|
#ifndef YAP_PACKAGES_CLPBN_HORUS_VARELIM_H_
|
|
|
|
#define YAP_PACKAGES_CLPBN_HORUS_VARELIM_H_
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2013-02-07 20:09:10 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <unordered_map>
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-11-14 21:55:51 +00:00
|
|
|
#include "GroundSolver.h"
|
2012-05-23 14:56:01 +01:00
|
|
|
#include "FactorGraph.h"
|
|
|
|
#include "Horus.h"
|
|
|
|
|
|
|
|
|
2013-02-08 21:12:46 +00:00
|
|
|
namespace Horus {
|
2013-02-07 23:53:13 +00:00
|
|
|
|
2013-02-13 14:26:47 +00:00
|
|
|
class VarElim : public GroundSolver {
|
2012-05-23 14:56:01 +01:00
|
|
|
public:
|
2012-11-14 21:55:51 +00:00
|
|
|
VarElim (const FactorGraph& fg) : GroundSolver (fg) { }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
2012-12-26 22:55:48 +00:00
|
|
|
~VarElim (void) { }
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
Params solveQuery (VarIds);
|
|
|
|
|
|
|
|
void printSolverFlags (void) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void createFactorList (void);
|
|
|
|
|
|
|
|
void absorveEvidence (void);
|
|
|
|
|
2012-12-26 22:55:48 +00:00
|
|
|
Params processFactorList (const VarIds&);
|
2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
void eliminate (VarId);
|
|
|
|
|
|
|
|
void printActiveFactors (void);
|
|
|
|
|
2012-12-26 22:55:48 +00:00
|
|
|
Factors factorList_;
|
|
|
|
unsigned largestFactorSize_;
|
|
|
|
unsigned totalFactorSize_;
|
2013-02-07 13:37:15 +00:00
|
|
|
std::unordered_map<VarId, std::vector<size_t>> varMap_;
|
2012-12-27 22:25:45 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN (VarElim);
|
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_VARELIM_H_
|
2012-05-23 14:56:01 +01:00
|
|
|
|