void VNODE::DisplayValue(HISTORY& history, int maxDepth, ostream& ostr) const { if (history.Size() >= (uint) maxDepth) return; for (int action = 0; action < NumChildren; action++) { history.Add(action,-1); Children[action].DisplayValue(history, maxDepth, ostr); history.Pop(); } }
void VNODE::DisplayValue(HISTORY& history, int maxDepth, ostream& ostr, const std::vector<double> *qvalues) const { if (history.Size() >= maxDepth) return; for (int action = 0; action < NumChildren; action++) { history.Add(action); const QNODE &qnode = Children[action]; if (qnode.Applicable()) { ostr << "n=" << qnode.GetCount() << " "; if (qvalues) { qnode.DisplayValue(history, maxDepth, ostr, &(qvalues->at(action))); } else { qnode.DisplayValue(history, maxDepth, ostr); } } history.Pop(); } }
void VNODE::DisplayPolicy(HISTORY& history, int maxDepth, ostream& ostr) const { if (history.Size() >= (uint) maxDepth) return; double bestq = -Infinity; int besta = -1; for (int action = 0; action < NumChildren; action++) { if (Children[action].Value.GetValue() > bestq) { besta = action; bestq = Children[action].Value.GetValue(); } } if (besta != -1) { history.Add((uint)besta,0); Children[besta].DisplayPolicy(history, maxDepth, ostr); history.Pop(); } }
void VNODE::DisplayPolicy(HISTORY& history, int maxDepth, ostream& ostr) const { if (history.Size() >= maxDepth) return; // double bestq = -Infinity; int besta = -1; for (int action = 0; action < NumChildren; action++) { // if (Children[action].Dirichlet.GetValue() > bestq) //XXX // { // besta = action; // bestq = Children[action].Dirichlet.GetValue(); // } } if (besta != -1) { history.Add(besta); Children[besta].DisplayPolicy(history, maxDepth, ostr); history.Pop(); } }