Reference Manual: DSL nodeValue

From DSL

Jump to: navigation, search

There are several types of values, each one designed to hold the results for each type of node. Most of the following methods can be applied to every kind of value. When that is not the case, the call will return DSL_WRONG_NODE_TYPE or signal the error by some other mean. In general, it is not a good idea to call one of these methods with a node that does not support it (NOTE: this lack of support will be changed in future releases of the library). Each value type may behave slightly differently so in the description of each method there is a table that lists these differences.

Each node type is associated with a value type as indicated in the following table:


Node Type Value Type
DSL_LIST DSL_listOfDecisions
DSL_TRUTHTABLE DSL_beliefVector
DSL_CPT DSL_beliefVector
DSL_NOISY_MAX DSL_beliefVector
DSL_TABLE DSL_expectedUtility
DSL_MAU DSL_mauExpectedUtility


Methods

  • int AddIndexingParent(int theParent)

Adds theParent to our set of indexing parents. To learn more about indexing parents, read the chapter devoted to solving influence diagrams.


  • int ClearEvidence(void)

Clears the observed state of the node. Note that this doesn't guarantee that after this call the node will not be evidence anymore, as evidence can be propagated from other nodes into this one (there must be some deterministic relationship between nodes for this to happen).


  • int GetType(void)

Returns our type:


Value Type GetType() returns
DSL_listOfDecisions DSL_LISTOFDECISIONS
DSL_beliefVector DSL_BELIEFVECTOR
DSL_expectedUtility DSL_EXPECTEDUTILITY
DSL_mauExpectedUtility DSL_MAUEXPECTEDUTILITY


  • char *GetTypeName(void)

Returns a pointer to a string containing the "name" of the type of the value.


Value Type GetType() returns
DSL_LISTOFDECISIONS "LIST OF DECISIONS"
DSL_BELIEFVECTOR "BELIEF VECTOR"
DSL_EXPECTEDUTILITY "EXPECTED UTILITY"
DSL_MAUEXPECTEDUTILITY "EXPECTED UTILITY"


  • int GetSize(void)

Returns the size of the "important" part of the value:


Value Type GetSize() returns
DSL_LISTOFDECISIONS Size of the table that holds the expected utility of the policies
DSL_BELIEFVECTOR Size of the table that holds the marginal probabilities of the node
DSL_EXPECTEDUTILITY Size of the table that holds the expected utility of all the policies
DSL_MAUEXPECTEDUTILITY Size of the table that holds the expected utility of all the policies


  • DSL_intArray &GetIndexingParents(void)

Returns an array with the handles of the indexing parents of this node.


  • int GetEvidence(void)

Returns the observed state of the node. This observation may come directly from the user or can be deduced from other observations in other nodes of the network.

Error return values: DSL_OUT_OF_RANGE (if no state has been observed for this node).


  • int GetValue(DSL_Dmatrix *)


Value Type GetValue returns
DSL_LISTOFDECISIONS Expected utilities for each of the choices
DSL_BELIEFVECTOR Marginal probabilities of the states of the node
DSL_EXPECTEDUTILITY Expected utilities for all the policies
DSL_MAUEXPECTEDUTILITY Expected utilities for all the policies


Another more convenient form of the above method is GetMatrix() described below :


  • DSL_Dmatrix* GetMatrix()

These functions grant access to the DSL_Dmatrix object containing numeric representation of node value. It performs the same function as the GetValue function described above, but is just a more convenient function, as you do not need to provide a pointer as an argument to this function.


  • int Handle(void)

Returns our handle in the network we are part of.


  • int IsValueValid(void)

Returns a non-zero value if the value of the node is valid (i.e., up to date with the latest changes/observations). The meaning of validity for each type of value is as follows:


Value Type Value valid means:
DSL_LISTOFDECISIONS The expected utility of each of the choices is known
DSL_BELIEFVECTOR The marginal probabilities of the node are known
DSL_EXPECTEDUTILITY The expected utility of this node is known
DSL_MAUEXPECTEDUTILITY The expected utility of this node is known



  • int IsRealEvidence(void)

Returns a non-zero value if the state of the node has been directly observed by the user.


  • int IsPropagatedEvidence(void)

Returns a non-zero value if the state of the node has been deduced from evidence in other nodes.


  • int IsEvidence(void)

Returns a non-zero value if the state of the node has been directly observed or has been deduced from the evidence in other nodes (i.e., returns if IsRealEvidence or IsPropagatedEvidence returns true).


  • DSL_network *Network(void)

Returns a pointer to the network that we are part of.


  • int SetEvidence(int theEvidence)

Sets theEvidence as the observed state of the node. Normally, checks will be performed to guarantee that theEvidence is consistent with other evidence in the network. To know more about these checks, read the section about propagation of evidence. A return value that is not DSL_OKAY means, in general, that the evidence is not compatible with the current definition and/or state of the world.

Error return values: DSL_OUT_OF_RANGE (the observation is not a valid state for the node), DSL_CONFLICTING_EVIDENCE (the observation is not consistent with the observations of other nodes in the network).


  • int SetValue(DSL_Dmatrix &withThis)

These functions set the value of the different types of nodes. They usually perform no checking so be careful when using them. To find what each of these functions will do to each of the node types, just look at the table given for GetValue. For example, if we call the SetValue method of a DSL_BELIEFVECTOR value type, we will be setting the marginal probabilities of the node.

Personal tools