diff options
author | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-23 00:10:52 +0000 |
---|---|---|
committer | graehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-09-23 00:10:52 +0000 |
commit | f8915e0bd1627167b72ca350b82ad31f8cb1fdeb (patch) | |
tree | e7ca29aa771db26630cc02f2bd61c2441c475f38 /utils/agenda.h | |
parent | 46c1d1c56535cdaf71e920b12f1cbdcbd1bd9d4f (diff) |
pausing earley best-first fsa work
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@656 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils/agenda.h')
-rwxr-xr-x | utils/agenda.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/utils/agenda.h b/utils/agenda.h index 1dbcd7bb..d4f13696 100755 --- a/utils/agenda.h +++ b/utils/agenda.h @@ -107,14 +107,27 @@ struct Agenda : intern_pool<Item,KeyF,HashKey,EqKey,Pool> { } // no need to destroy the canon. item because we want to remember the best cost and reject more expensive ways of using it). ItemC pop() { - DBG_AGENDA(assert(!empty())); ItemC r=q.top(); q.pop(); return r; } + void pop_discard() { + q.pop(); + } + + ItemC top() { + DBG_AGENDA(assert(!empty())); + return q.top(); + } + agenda_best_t best() const { - return priomap[q.top()]; //TODO: cache/track the global best? + return q.best(); //TODO: cache/track the global best? } + + agenda_best_t second_best() const { + return q.second_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; |