<< Click to Display Table of Contents >> Navigation: Reference Manual > Node values > DSL_discVal |
Header file: discval.h
class DSL_discVal: public DSL_nodeVal
DSL_discVal class is derived from DSL_nodeVal. It is a base class for all node value classes used for various discrete node types.
The value is represented by a DSL_Dmatrix member object, which contains posterior probabilities for chance nodes and expected utilities for decision nodes. The matrix can be multi-dimensional if the node is a plate node in the DBN, or if the node is in an influence diagram and has value indexing parents. Otherwise, the matrix is one-dimensional and its size is equal to the number of node outcomes.
DSL_discVal supports two types of evidence:
1.discrete evidence, specified as outcome index or outcome id passed to SetEvidence(int) or SetEvidence(const char*)
2.continuous evidence, which is only valid for discrete nodes with outcome intervals, specified as a numeric value passed to SetEvidence(double).
virtual int GetMean(double& mean) const;
Overridden method from DSL_nodeVal. Writes the mean value of the node to the mean output parameter. Returns DSL_OKAY on success, or a negative error code on failure. Can succeed only if node has defined outcome intervals or point values.
virtual int GetStdDev(double& stddev) const;
Overridden method from DSL_nodeVal. Writes the standard deviation of the node to the stddev output parameter. Returns DSL_OKAY on success, or a negative error code on failure. Can succeed only if the node has defined outcome intervals or point values.
virtual int ClearEvidence();
Overridden method from DSL_nodeVal. Removes all types of evidence from the node. Returns DSL_OKAY on success, or a negative error code on failure.
virtual int GetEvidence() const;
Overridden method from DSL_nodeVal. If node has evidence set, returns non-negative evidence outcome index. Returns negative error code on failure.
virtual const char* GetEvidenceId() const;
Overridden method from DSL_nodeVal. If the node has evidence set, returns the identifier of the evidence outcome. Returns NULL if node has no evidence.
virtual int GetEvidence(double &evidence) const;
Overridden method from DSL_nodeVal. If the node has continuous evidence, the evidence value is written to the output evidence parameter. Returns DSL_OKAY on success, or a negative error code on failure.
virtual int SetEvidence(int evidence);
Overridden method from DSL_nodeVal. Sets the evidence as an integer index of the node's outcome. Returns DSL_OKAY on success, or a negative error code on failure.
virtual int SetEvidence(const char* outcomeId);
Overridden method from DSL_nodeVal. Sets the evidence as an integer index of the node's outcome. The outcome index is determined by comparing the outcomeId with the node outcome identifiers. Returns DSL_OKAY on success, or a negative error code on failure.
virtual int SetEvidence(double evidence);
Overridden method from DSL_nodeVal. Sets the evidence as a continuous number. Valid only if the node has defined outcome intervals. Returns DSL_OKAY on success, or a negative error code on failure.
bool IsContinuousEvidence() const;
Returns true when the node has evidence set and the evidence is continuous. Only nodes with outcome intervals can have continuous evidence.