本文整理汇总了C++中VNode::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ VNode::Size方法的具体用法?C++ VNode::Size怎么用?C++ VNode::Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VNode
的用法示例。
在下文中一共展示了VNode::Size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructTree
VNode* DESPOT::ConstructTree(vector<State*>& particles, RandomStreams& streams,
ScenarioLowerBound* lower_bound, ScenarioUpperBound* upper_bound,
const DSPOMDP* model, History& history, double timeout,
SearchStatistics* statistics) {
if (statistics != NULL) {
statistics->num_particles_before_search = model->NumActiveParticles();
}
for (int i = 0; i < particles.size(); i++) {
particles[i]->scenario_id = i;
}
VNode* root = new VNode(particles);
logd
<< "[DESPOT::ConstructTree] START - Initializing lower and upper bounds at the root node.";
InitBounds(root, lower_bound, upper_bound, streams, history);
logd
<< "[DESPOT::ConstructTree] END - Initializing lower and upper bounds at the root node.";
if (statistics != NULL) {
statistics->initial_lb = root->lower_bound();
statistics->initial_ub = root->upper_bound();
}
double used_time = 0;
int num_trials = 0;
do {
double start = clock();
VNode* cur = Trial(root, streams, lower_bound, upper_bound, model, history, statistics);
used_time += double(clock() - start) / CLOCKS_PER_SEC;
start = clock();
Backup(cur);
if (statistics != NULL) {
statistics->time_backup += double(clock() - start) / CLOCKS_PER_SEC;
}
used_time += double(clock() - start) / CLOCKS_PER_SEC;
num_trials++;
} while (used_time * (num_trials + 1.0) / num_trials < timeout
&& (root->upper_bound() - root->lower_bound()) > 1e-6);
if (statistics != NULL) {
statistics->num_particles_after_search = model->NumActiveParticles();
statistics->num_policy_nodes = root->PolicyTreeSize();
statistics->num_tree_nodes = root->Size();
statistics->final_lb = root->lower_bound();
statistics->final_ub = root->upper_bound();
statistics->time_search = used_time;
statistics->num_trials = num_trials;
}
return root;
}