MultiAgentDecisionProcess
CPT Class Reference

CPT implements a conditional probability table. More...

#include <CPT.h>

Inheritance diagram for CPT:
[legend]

Public Types

typedef
boost::numeric::ublas::matrix
< double > 
Matrix
 

Public Member Functions

virtual CPTClone () const
 Returns a pointer to a copy of this class. More...
 
 CPT ()
 Constructor without arguments, needed for serialization. More...
 
 CPT (size_t X, size_t Y)
 Constructor with sizes of sets. More...
 
 CPT (const CPT &cpt)
 Copy constructor. More...
 
double Get (Index x, Index y) const
 Returns $ P(x|y) $. More...
 
const MatrixGetMatrixPtr () const
 Get a pointer to the CPT. More...
 
Index Sample (Index y) const
 Returns an (index of a) x drawn according to $ P(x|y) $. More...
 
virtual void SanityCheck () const
 
void Set (Index x, Index y, double prob)
 Sets P(x|y) More...
 
void SetRandom ()
 This will randomize the CPT. More...
 
std::string SoftPrint () const
 
 ~CPT ()
 Destructor. More...
 
- Public Member Functions inherited from CPDDiscreteInterface
virtual ~CPDDiscreteInterface ()
 Destructor. More...
 

Protected Member Functions

size_t nrX () const
 
size_t nrY () const
 

Private Attributes

Matrix _m_probTable
 

Detailed Description

CPT implements a conditional probability table.

Uses full matrices.

Member Typedef Documentation

typedef boost::numeric::ublas::matrix<double> CPT::Matrix

Constructor & Destructor Documentation

CPT::CPT ( )

Constructor without arguments, needed for serialization.

Referenced by Clone().

CPT::CPT ( size_t  X,
size_t  Y 
)

Constructor with sizes of sets.

References _m_probTable.

CPT::CPT ( const CPT cpt)

Copy constructor.

CPT::~CPT ( )

Destructor.

References _m_probTable.

Member Function Documentation

virtual CPT* CPT::Clone ( ) const
inlinevirtual

Returns a pointer to a copy of this class.

Implements CPDDiscreteInterface.

References CPT().

double CPT::Get ( Index  x,
Index  y 
) const
inlinevirtual

Returns $ P(x|y) $.

Implements CPDDiscreteInterface.

References _m_probTable.

const Matrix* CPT::GetMatrixPtr ( ) const
inline

Get a pointer to the CPT.

size_t CPT::nrX ( ) const
inlineprotected

Referenced by Sample().

size_t CPT::nrY ( ) const
inlineprotected
Index CPT::Sample ( Index  y) const
virtual

Returns an (index of a) x drawn according to $ P(x|y) $.

Implements CPDDiscreteInterface.

References _m_probTable, and nrX().

void CPT::SanityCheck ( ) const
virtual
void CPT::Set ( Index  x,
Index  y,
double  prob 
)
inlinevirtual

Sets P(x|y)

x, y are indices of the 'state': e.g. x is an index to the x-th element in X (the set of values x can take) taken joint action and resulting successor state. prob is the probability. The order of events is s, ja, s', so is the arg. list

Implements CPDDiscreteInterface.

References _m_probTable.

Referenced by FSAOHDist_NECOF::FSAOHDist_NECOF(), and MultiAgentDecisionProcessDiscreteFactoredStates::Initialize2DBN().

void CPT::SetRandom ( )

This will randomize the CPT.

References _m_probTable.

string CPT::SoftPrint ( ) const
virtual

Implements CPDDiscreteInterface.

References _m_probTable.

Member Data Documentation

Matrix CPT::_m_probTable
private