Skip to content

Performance improvement qpt.cpp #5

@Rupsbant

Description

@Rupsbant

Notation: au(b,pv) is the antagonistic update of a progress measure b with priority pv. pm(w) is the current progress measure of w and pr(v) is the priority of v.

If I understood the paper by Fearnley et al. then au(b, pv) is monotonic in b. It should follow that max{au(pm(w), pr(v)) | (v,w) in E} is equal to au(max{pm(w) | (v,w) in E}, pr(v)). The same for min. Applying this to the lift function in qpt.cpp should allow to reduce the number of expensive calls to au:

oink/src/qpt.cpp

Lines 272 to 300 in 2d12471

for (int to : out[v]) {
if (disabled[to]) continue;
au(tmp, pm_nodes + k*to, pr, k, max, maxo, pl);
if (pm_val(tmp, k, pl) > goal) tmp[0] = max; // goal reached, lift to Top
#ifndef NDEBUG
if (trace >= 2) {
logger << "to successor " << label_vertex(to) << ":";
pm_stream(logger, tmp, k);
logger << std::endl;
}
#endif
if (first) {
first = false;
for (int i=0; i<k; i++) res[i] = tmp[i];
strategy[v] = to;
} else if (owner[v] == pl) {
// we want the max
if (pm_less(res, tmp, k, pl)) {
for (int i=0; i<k; i++) res[i] = tmp[i];
strategy[v] = to;
}
} else {
// we want the min
if (pm_less(tmp, res, k, pl)) {
for (int i=0; i<k; i++) res[i] = tmp[i];
strategy[v] = to;
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions