Inference Class Reference

Abstract class from which all inference algorithms are derived. More...

#include <inference.h>

Inheritance diagram for Inference:

MCMC SAT UnitPropagation GibbsSampler MCSAT SimulatedTempering MaxWalkSat List of all members.

Public Member Functions

 Inference (VariableState *state, long int seed, const bool &trackClauseTrueCnts)
 Constructor: Every inference algorithm is required to have a VariableState representing the state of variables and clauses and a seed for any randomization in the algorithm.
virtual ~Inference ()
 Virtual destructor.
virtual void init ()=0
 Initializes the inference algorithm.
virtual void infer ()=0
 Performs the inference algorithm.
virtual void printProbabilities (ostream &out)=0
 Prints the probabilities of each predicate to a stream.
virtual void printTruePreds (ostream &out)=0
 Prints the predicates inferred to be true to a stream.
virtual double getProbability (GroundPredicate *const &gndPred)=0
 Gets the probability of a ground predicate.
long int getSeed ()
void setSeed (long int s)
VariableStategetState ()
void setState (VariableState *s)
const Array< double > * getClauseTrueCnts ()

Protected Attributes

long int seed_
VariableStatestate_
Array< double > * clauseTrueCnts_
bool trackClauseTrueCnts_

Detailed Description

Abstract class from which all inference algorithms are derived.

At least one function is pure virtual making this an abstract class (it can not be instantiated).

Definition at line 76 of file inference.h.


Constructor & Destructor Documentation

Inference::Inference ( VariableState state,
long int  seed,
const bool &  trackClauseTrueCnts 
) [inline]

Constructor: Every inference algorithm is required to have a VariableState representing the state of variables and clauses and a seed for any randomization in the algorithm.

If there is no randomization, seed is not used.

Parameters:
state State of the variables and clauses of the inference.
seed Seed used to initialize randomization in the algorithm.
trackClauseTrueCnts Indicates if true counts for each first-order clause are being kept

Definition at line 91 of file inference.h.

References clauseTrueCnts_, VariableState::getMLN(), MLN::getNumClauses(), Array< Type >::growToSize(), seed_, state_, and trackClauseTrueCnts_.

00093   {
00094     this->state_ = state;
00095     this->seed_ = seed;
00096     if (seed_ <= 0)
00097     {
00098       struct timeval tv;
00099       struct timezone tzp;
00100       gettimeofday(&tv, &tzp);
00101       seed_ = (long int)((( tv.tv_sec & 0177 ) * 1000000) + tv.tv_usec);
00102     }
00103     srandom(seed_);
00104 
00105     trackClauseTrueCnts_ = trackClauseTrueCnts;
00106     if (trackClauseTrueCnts_)
00107     {
00108         // clauseTrueCnts_ will hold the true counts for each first-order clause
00109       clauseTrueCnts_ = new Array<double>;
00110       clauseTrueCnts_->growToSize(state_->getMLN()->getNumClauses(), 0);
00111     }
00112   }


The documentation for this class was generated from the following file:
Generated on Tue Jan 16 05:30:06 2007 for Alchemy by  doxygen 1.5.1