MultiAgentDecisionProcess
StateFactorDiscrete Class Reference

StateFactorDiscrete is a class that represents a state variable, or factor. More...

#include <StateFactorDiscrete.h>

Inheritance diagram for StateFactorDiscrete:
[legend]

Public Member Functions

Index AddStateFactorValue (const std::string &v="rec.undef.by StateFactorDiscrete")
 Adds a value to this state factor and returns the new index. More...
 
std::string GetStateFactorValue (Index domainI) const
 
StateFactorDiscreteoperator= (const StateFactorDiscrete &o)
 Copy assignment operator. More...
 
std::string SoftPrint () const
 Soft prints this state factor. More...
 
 StateFactorDiscrete (const std::string &n="undef. name", const std::string &d="undef. descr.")
 (default) Constructor More...
 
 StateFactorDiscrete (size_t nrVs, const std::string &n="undef. name", const std::string &d="undef. descr.")
 Constructor specifying the number of values. More...
 
 StateFactorDiscrete (const StateFactorDiscrete &a)
 Copy constructor. More...
 
 ~StateFactorDiscrete ()
 Destructor. More...
 
- Public Member Functions inherited from NamedDescribedEntity
std::string GetDescription () const
 Get the description of the NamedDescribedEntity. More...
 
std::string GetName () const
 Get the name of the NamedDescribedEntity. More...
 
 NamedDescribedEntity (const std::string &name=std::string("undefined"), const std::string &description=std::string("undefined"))
 (default) Constructor More...
 
void Print () const
 Prints the name and description (by default). More...
 
void PrintBrief () const
 Prints the name (by default). More...
 
void SetDescription (const std::string &description)
 Set the description. More...
 
void SetName (const std::string &name)
 Set the name. More...
 
virtual std::string SoftPrintBrief () const
 Returns the name (if not reimplemented). More...
 
virtual ~NamedDescribedEntity ()
 Destructor. More...
 

Private Attributes

size_t _m_domainSize
 The size of the domain. More...
 
std::vector< std::string > _m_domainValues
 The vector containing the domain values. More...
 

Additional Inherited Members

- Protected Attributes inherited from NamedDescribedEntity
std::string _m_description
 The description. More...
 
std::string _m_name
 The name. More...
 

Detailed Description

StateFactorDiscrete is a class that represents a state variable, or factor.

It has a name and description (handled by NamedDescribedEntity), as well as a domain: the list of discrete values it can take. These domain values are indexed and associated with a string.

E.g. a state variable 'color' could have domain 0-'red', 1-'blue', 2-'yellow'.

And Xpos could have domain: 0 -'-2', 1-'-1', 2-'0', 3-'+1', 4-'+2'

In the future we might include special state factor types for numerical domains(?).

Constructor & Destructor Documentation

StateFactorDiscrete::StateFactorDiscrete ( const std::string &  n = "undef. name",
const std::string &  d = "undef. descr." 
)

(default) Constructor

StateFactorDiscrete::StateFactorDiscrete ( size_t  nrVs,
const std::string &  n = "undef. name",
const std::string &  d = "undef. descr." 
)

Constructor specifying the number of values.

This constructs n unnamed values.

References _m_domainSize.

StateFactorDiscrete::StateFactorDiscrete ( const StateFactorDiscrete a)

Copy constructor.

StateFactorDiscrete::~StateFactorDiscrete ( )

Destructor.

Member Function Documentation

Index StateFactorDiscrete::AddStateFactorValue ( const std::string &  v = "rec.undef.by StateFactorDiscrete")

Adds a value to this state factor and returns the new index.

I.e., the domain index or 'state factor value' index.

References _m_domainSize, and _m_domainValues.

StateFactorDiscrete & StateFactorDiscrete::operator= ( const StateFactorDiscrete o)

Copy assignment operator.

string StateFactorDiscrete::SoftPrint ( ) const
virtual

Soft prints this state factor.

Reimplemented from NamedDescribedEntity.

References _m_domainValues, NamedDescribedEntity::GetDescription(), and NamedDescribedEntity::GetName().

Member Data Documentation

size_t StateFactorDiscrete::_m_domainSize
private

The size of the domain.

Referenced by AddStateFactorValue(), and StateFactorDiscrete().

std::vector<std::string> StateFactorDiscrete::_m_domainValues
private

The vector containing the domain values.

E.g. for factor 'color' this contains 'blue', 'red', etc.

Referenced by AddStateFactorValue(), and SoftPrint().