|
| | Result_Tracker_Dupless (const IDXTYPE capacity_limit=0) |
|
| Result_Tracker_Dupless (const Result_Tracker_Dupless &rtd) |
| | copies the configuration (margin, cardinality restriction, capacity limit) only; the results list is NOT copied (starts empty) – this constructor backs stateless_clone() (CLONE_DEEP), which by contract does not replicate exact object state
|
| virtual bool | add (const RETURNTYPE value, const PSubset sub) override |
| | Offers one (value, subset) result for inclusion; sub is copied, the caller keeps ownership of its own object.
|
| virtual void | clear () override |
| | discards all recorded results
|
| virtual std::size_t | size () const override |
| | number of results currently held (std::size_t rather than 'long': on LLP64 platforms 'long' is 32 bits and would narrow the container's own size type)
|
|
virtual std::size_t | size (const RETURNTYPE margin) const |
| | number of currently held results whose value is within margin of the best (first, highest-value) held result
|
| virtual bool | get_first (PResultRec &r) override |
| | starts iteration at the best held result; false if nothing is held. The returned pointer refers into this tracker's own storage and is invalidated by add(), join() and clear()
|
| virtual bool | get_next (PResultRec &r) override |
| | hands out the next result in descending-value order; false when the iteration is exhausted. There is one shared cursor per tracker, so nested or concurrent iterations of the same tracker interfere
|
| virtual void | join (Result_Tracker< RETURNTYPE, SUBSET > &src) override |
| | merges the results held by src into this tracker, keeping the ordering and skipping duplicates exactly as add() does, then re-applies the capacity limit and the margin to the merged list. Consumes src's iteration cursor; src itself is left unchanged
|
|
void | set_inclusion_margin (const RETURNTYPE margin=0) |
| | restrict adding to only subsets with criterion value within given distance (margin) from best known
|
|
void | set_inclusion_cardinality_restriction (const DIMTYPE d) |
| | for d>0 restricts adding only to subsets of size d, for d=0 subset size restriction is removed
|
| virtual std::ostream & | print (std::ostream &os) const override |
| | writes a human-readable identification of the object; base default writes nothing
|
|
RESULTSITER | begin () |
| | iterator to the best (first) held result
|
|
RESULTSITER | end () |
| | iterator past the last held result
|
| Result_Tracker< RETURNTYPE, SUBSET > * | clone () const override |
| | dispatches to the DEEP_KIND mechanism (default CLONE_DEEP: Derived's copy-constructor)
|
| Result_Tracker< RETURNTYPE, SUBSET > * | sharing_clone () const override |
| | dispatches to the SHARING_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
|
| Result_Tracker< RETURNTYPE, SUBSET > * | stateless_clone () const override |
| | dispatches to the STATELESS_KIND mechanism (default CLONE_INHERIT: defers to Base, which throws by family convention)
|
|
| Result_Tracker (const Result_Tracker &rt) |
| | copies the output-detail setting only – concrete trackers copy their own collected results separately
|
| Result_Tracker * | clone () const override |
| Result_Tracker * | sharing_clone () const override |
|
void | set_output_detail (OutputDetail detail) |
| | sets the amount of information that is logged to output stream throughout the course of search
|
|
OutputDetail | get_output_detail () const |
| | the currently configured output detail level
|
|
bool | output_normal () const |
| | true unless output detail is SILENT
|
|
bool | output_detailed () const |
| | true only at the DETAILED output level
|
| bool | is_clone () const |
|
bool | is_sharing () const |
| | true if this instance is a sharing_clone() result (referencing, not owning, the source's structures)
|
|
bool | is_sharing_clone () const |
| | true if this instance is BOTH a clone and sharing – i.e. specifically a sharing_clone() result, not a clone()/stateless_clone() one
|
template<class RETURNTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET>
class FST::Result_Tracker_Dupless< RETURNTYPE, IDXTYPE, DIMTYPE, SUBSET >
Collects multiple results, avoiding duplicates.
See Result_Tracker description why this is needed. Upon adding, sorts results descending according to value, in case of ties smaller subset is considered better.
template<class RETURNTYPE, typename IDXTYPE, typename DIMTYPE, class SUBSET>
Offers one (value, subset) result for inclusion; sub is copied, the caller keeps ownership of its own object.
The result is declined (false is returned) when
- a cardinality restriction is in effect and sub->get_d() differs from it (see set_inclusion_cardinality_restriction()),
- a margin is in effect and
value falls more than the margin below the best value held so far (see set_inclusion_margin()),
- an equivalent subset of the same value and the same cardinality is already held (duplicates are looked for only among results with exactly that value and cardinality - results differing in value are never compared feature-wise).
Otherwise the result is sorted into the list, which stays ordered by descending value, and among equal values by ascending cardinality (the smaller subset counts as the better one). A result that becomes the new best additionally trims the tail of results that thereby fell outside the margin. Finally, a nonzero capacity limit trims the worst-valued results away - which may discard the just inserted result itself if it ended up at the tail; true only reports that the result was accepted for insertion.
Implements FST::Result_Tracker< RETURNTYPE, SUBSET >.