void Discharge(int v) { for (int i = 0; excess[v] > 0 && i < G[v].size(); i++) Push(G[v][i]); if (excess[v] > 0) { if (count[dist[v]] == 1) Gap(dist[v]); else Relabel(v); } }
// Can pass root as an argument, but will not affect performance much double DESPOT::WEU(VNode* vnode, double xi) { VNode* root = vnode; while (root->parent() != NULL) { root = root->parent()->parent(); } return Gap(vnode) - xi * vnode->Weight() * Gap(root); }
void ParseHexEscapeSequence() { if (Gap() > 1) { int hex = ParseHex(Next()); if (hex >= 0) { Advance(); ++lastSourceToken.length; int total = hex; hex = ParseHex(Next()); while (hex >= 0 && Gap() > 1) { Advance(); ++lastSourceToken.length; total = total * 0x10 + hex; hex = ParseHex(Next()); } if (total > 255) { errorPosition = lastSourceToken.textPosition; errorMessage = "escape sequence hex value out of range"; } else { buffer += (char)total; } } else { errorPosition = lastSourceToken.textPosition; errorMessage = "expected at least one hex digit ("; errorMessage += Next(); errorMessage += ") ["; errorMessage += buffer; errorMessage += "]"; } } else { errorPosition = lastSourceToken.textPosition; errorMessage = "found EOF; expected hex value"; } }
VNode* DESPOT::Trial(VNode* root, RandomStreams& streams, ScenarioLowerBound* lower_bound, ScenarioUpperBound* upper_bound, const DSPOMDP* model, History& history, SearchStatistics* statistics) { VNode* cur = root; int hist_size = history.Size(); do { if (statistics != NULL && cur->depth() > statistics->longest_trial_length) { statistics->longest_trial_length = cur->depth(); } ExploitBlockers(cur); if (Gap(cur) == 0) { break; } if (cur->IsLeaf()) { double start = clock(); Expand(cur, lower_bound, upper_bound, model, streams, history); if (statistics != NULL) { statistics->time_node_expansion += (double) (clock() - start) / CLOCKS_PER_SEC; statistics->num_expanded_nodes++; statistics->num_tree_particles += cur->particles().size(); } } double start = clock(); QNode* qstar = SelectBestUpperBoundNode(cur); VNode* next = SelectBestWEUNode(qstar); if (statistics != NULL) { statistics->time_path += (clock() - start) / CLOCKS_PER_SEC; } if (next == NULL) { break; } cur = next; history.Add(qstar->edge(), cur->edge()); } while (cur->depth() < Globals::config.search_depth && WEU(cur) > 0); history.Truncate(hist_size); return cur; }
Vector<std::pair<int, int>> BasicBlockLocation::getExecutedRanges() const { Vector<Gap> result; Vector<Gap> gaps = m_gaps; int nextRangeStart = m_startOffset; while (gaps.size()) { Gap minGap(INT_MAX, 0); unsigned minIdx = std::numeric_limits<unsigned>::max(); for (unsigned idx = 0; idx < gaps.size(); idx++) { // Because we know that the Gaps inside m_gaps aren't enclosed within one another, it suffices to just check the first element to test ordering. if (gaps[idx].first < minGap.first) { minGap = gaps[idx]; minIdx = idx; } } result.append(Gap(nextRangeStart, minGap.first - 1)); nextRangeStart = minGap.second + 1; gaps.remove(minIdx); } result.append(Gap(nextRangeStart, m_endOffset)); return result; }
void Bar::ToolGap(int size) { if(IsToolBar()) Gap(size); }
void Bar::MenuGap(int size) { if(IsMenuBar()) Gap(size); }