|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--edu.vt.marian.search.PriQueueSequencer
A PriQueueSequencer is a Sequencer designed for large numbers of component sets. It is presumed that the sets are all proper WtdObjSets (that they all have varying weights among their elements) and that they are added with similar scaling weights, so that we are unlikely to be able to ignore any one set for long. (If this consequence is violated, we should be using a WtdObjSetSequencer (q.v.)).
Since the number of sets is large, we need an O(k) search for the next highest element. Back in the old days, somebody would build a heap and use it to implement a priority queue of component sets where the key is the (optinally weighted) top unused element in the set. But this is Java. Is there a PirorityQueue class in the library?
By the way, the reasoning below indicates that we want to keep all the sets but the current one on the PriQueue until elements from the current set fall below the top weight in thePriQueue.
We expect the weights in any WtdObjSet to drop off, not smoothly, but as a stairstep function. Thus instead of searching for the top element among the (scaled) component sets, we begin be searching for the top two sets, and search only when the top weight in the second set exceeds that in the top set.
Sequencer,
Enumeration| Constructor Summary | |
PriQueueSequencer(int ExpectedNumSets,
long classSize,
edu.vt.marian.common.Debug d)
Create a merging sequencer for an expected number of sets. |
|
PriQueueSequencer(long classSize,
edu.vt.marian.common.Debug d)
Create a merging sequencer for an unknown number of sets. |
|
| Method Summary | |
int |
addSet(WtdObjSet set)
Add a new component set to the Sequencer with no scaling constant. |
int |
expectedNumElts()
Return the expected number of unique elements in the result sequence. |
boolean |
hasMoreElements()
|
int |
maxNumElts()
Return the maximum number of unique elements in the result sequence. |
java.lang.Object |
nextElement()
|
java.lang.String |
profile()
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public PriQueueSequencer(long classSize,
edu.vt.marian.common.Debug d)
public PriQueueSequencer(int ExpectedNumSets,
long classSize,
edu.vt.marian.common.Debug d)
expectedNumSets - As many sets as we expect to add. Does not
need to be perfectly accurate.| Method Detail |
public int addSet(WtdObjSet set)
set - a component weighted object set.public int expectedNumElts()
public int maxNumElts()
public java.lang.Object nextElement()
public boolean hasMoreElements()
public java.lang.String toString()
public java.lang.String profile()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||