Brief Introduction to Some Simple Classes: Finding the best policy
The algorithm described in 2.14 solves the whole decision tree, exploring all the possible combinations of decision nodes and observations. It also calculates the posterior distribution of all the change nodes in the network for each of those combinations. A lot of information is calculated but it also takes a long time. All this information is not necessary for some systems, in which it is enough to find out what is the best choice for the next decision to make. SMILE can calculate this best choice much faster than when solving the whole tree.
To use this algorithm, set the default ID algorithm to DSL_ALG_ID_SHACHTER and call UpdateBeliefs. This algorithm will only calculate the best choice for the first undecided decision node. Once the network is updated, the best choice for the first undecided decision node will be the one containing a "1" in the node value. The rest of the choices will contain 0. The following example shows how to find the best choice:
// get best policy int firstDecision = FindFirstDecision(); // implementation dependant&ldots; DSL_node *theNode = theNetwork.GetNode(firstDecision); DSL_listOfDecisions *theUtils = (DSL_listOfDecisions *) theNode->Value(); // get internal matrix (should have just one dimension&ldots;) DSL_Dmatrix *thePolicyValues; theUtils->GetValue(&thePolicyValues); // now find the best policy for (int x=0; x<thePolicyValues->GetSize(); x++) if ((*thePolicyValues)[x] == 1.0) // Found: x is the best choice!
This algorithm can solve networks containing multiple utility nodes and multi-attribute utility nodes. The only limitation is that the first undecided decision node must not have undecided or unobserved parents.