diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-04 01:23:51 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-04 01:23:51 +0000 |
commit | 2ed61b40bd0f3f1c377a415df8af4fab58122a52 (patch) | |
tree | d59b37fc572274c502c4030e37cb7a61e07cb4ff | |
parent | 47957e0628dee7b18bf7e053d94b78bf9f3ea92e (diff) |
nothing
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@641 ec762483-ff6d-05da-a07a-a48fb63a330f
-rwxr-xr-x | utils/agenda.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/utils/agenda.h b/utils/agenda.h index a4940a00..1dbcd7bb 100755 --- a/utils/agenda.h +++ b/utils/agenda.h @@ -95,8 +95,10 @@ struct Agenda : intern_pool<Item,KeyF,HashKey,EqKey,Pool> { bool improve(ItemP i) { ItemP c=i; bool fresh=interneq(c); - if (fresh) - return add(c); + if (fresh) { + add(c); + return true; + } DBG_AGENDA(assert(q.contains(c))); return q.maybe_improve(priomap[i]); } @@ -113,6 +115,11 @@ struct Agenda : intern_pool<Item,KeyF,HashKey,EqKey,Pool> { agenda_best_t best() const { return priomap[q.top()]; //TODO: cache/track the global best? } + // add only if worse than queue current best, otherwise evaluate immediately (e.g. for early stopping w/ expensive to compute additional cost). return true if postponed (added) + bool postpone(ItemP i) { + if (better(priomap[i],best())) return false; + return improve(i); + } Agenda(unsigned reserve=1000000,LocMap const& lm=LocMap(),PrioMap const& pm=PrioMap(),EqKey const& eq=EqKey(),Better const& better=Better()) : locmap(lm), priomap(pm), better(better), q(priomap,locmap,better,reserve) { } }; |