本文整理汇总了C++中QNode::Child方法的典型用法代码示例。如果您正苦于以下问题:C++ QNode::Child方法的具体用法?C++ QNode::Child怎么用?C++ QNode::Child使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QNode
的用法示例。
在下文中一共展示了QNode::Child方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintPolicyTree
void VNode::PrintPolicyTree(int depth, ostream& os) {
if (depth != -1 && this->depth() > depth)
return;
vector<QNode*>& qnodes = children();
if (qnodes.size() == 0) {
int astar = this->default_move().action;
os << this << "-a=" << astar << endl;
} else {
QNode* qstar = NULL;
for (int a = 0; a < qnodes.size(); a++) {
QNode* qnode = qnodes[a];
if (qstar == NULL || qnode->lower_bound() > qstar->lower_bound()) {
qstar = qnode;
}
}
os << this << "-a=" << qstar->edge() << endl;
vector<OBS_TYPE> labels;
map<OBS_TYPE, VNode*>& vnodes = qstar->children();
for (map<OBS_TYPE, VNode*>::iterator it = vnodes.begin();
it != vnodes.end(); it++) {
labels.push_back(it->first);
}
for (int i = 0; i < labels.size(); i++) {
if (depth == -1 || this->depth() + 1 <= depth) {
os << repeat("| ", this->depth()) << "| o=" << labels[i]
<< ": ";
qstar->Child(labels[i])->PrintPolicyTree(depth, os);
}
}
}
}
示例2: PrintTree
void VNode::PrintTree(int depth, ostream& os) {
if (depth != -1 && this->depth() > depth)
return;
if (this->depth() == 0) {
os << "d - default value" << endl
<< "l - lower bound" << endl
<< "u - upper bound" << endl
<< "r - totol weighted one step reward" << endl
<< "w - total particle weight" << endl;
}
os << "(" << "d:" << this->default_move().value <<
" l:" << this->lower_bound() << ", u:" << this->upper_bound()
<< ", w:" << this->Weight() << ", weu:" << DESPOT::WEU(this)
<< ")"
<< endl;
vector<QNode*>& qnodes = children();
for (int a = 0; a < qnodes.size(); a++) {
QNode* qnode = qnodes[a];
vector<OBS_TYPE> labels;
map<OBS_TYPE, VNode*>& vnodes = qnode->children();
for (map<OBS_TYPE, VNode*>::iterator it = vnodes.begin();
it != vnodes.end(); it++) {
labels.push_back(it->first);
}
os << repeat("| ", this->depth()) << "a="
<< qnode->edge() << ": "
<< "(d:" << qnode->default_value << ", l:" << qnode->lower_bound()
<< ", u:" << qnode->upper_bound()
<< ", r:" << qnode->step_reward << ")" << endl;
for (int i = 0; i < labels.size(); i++) {
if (depth == -1 || this->depth() + 1 <= depth) {
os << repeat("| ", this->depth()) << "| o=" << labels[i]
<< ": ";
qnode->Child(labels[i])->PrintTree(depth, os);
}
}
}
}