void QNODE::DisplayValue(HISTORY& history, int maxDepth, ostream& ostr, const double *qvalue) const { history.Display(ostr); if (qvalue) { ostr << "q=" << *qvalue; } ImmediateReward.Print(": r=", ostr); Observation.Print(", o=", ostr); ostr << std::endl; for (int observation = 0; observation < NumChildren; observation++) { if (Children[observation]) { std::stringstream ss; ss << "\t\t\t#" << observation; // Children[observation]->GetCumulativeReward().Print(ss.str().c_str(), ostr); } } if (history.Size() >= maxDepth) return; for (int observation = 0; observation < NumChildren; observation++) { if (Children[observation]) { history.Back().Observation = observation; Children[observation]->DisplayValue(history, maxDepth, ostr); } } }
void QNODE::DisplayPolicy(HISTORY& history, int maxDepth, ostream& ostr) const { history.Display(ostr); ostr << ": " << Value.GetValue() << " (" << Value.GetCount() << ")\n"; if (history.Size() >= (uint) maxDepth) return; for (int observation = 0; observation < NumChildren; observation++) { if (Children[observation]) { history.Back().Observation = observation; Children[observation]->DisplayPolicy(history, maxDepth, ostr); } } }
void QNODE::DisplayPolicy(HISTORY& history, int maxDepth, ostream& ostr) const { history.Display(ostr); ImmediateReward.Print("r=", ostr); Observation.Print(", o=", ostr); ostr << std::endl; if (history.Size() >= maxDepth) return; for (int observation = 0; observation < NumChildren; observation++) { if (Children[observation]) { history.Back().Observation = observation; Children[observation]->DisplayPolicy(history, maxDepth, ostr); } } }