Adds a candidate set to consider for the next DetectInclusions() call.
The argument is an index that will only be used via storage_[index] to get
the content of the candidate set.
Note that set with no element are just ignored and will never be returned
as part of an inclusion.
Arguments:
const std::function<void(int subset, int superset)>& process
Finds all subset included in a superset and call "process" on each of the
detected inclusion. The std::function argument corresponds to indices
passed to the Add*() calls.
The order of detection will be by increasing superset size. For superset
with the same size, the order will be deterministic but not specified. And
similarly, for a given superset, the order of the included subsets is
deterministic but not specified.
Note that only the candidate marked as such can be a subset/superset.
For the candidate than can be both and are duplicates (i.e. same set), only
one pair will be returned. We will also never return identity inclusion and
we always have subset != superset.
The algorithm here can detect many small set included in a big set while
only scanning the superset once. So if we do scan the superset in the
process function, we can do a lot more work. This is here to reuse the
deterministic limit mechanism.
Function that should only be used from within "process()".
Returns the bitset corresponsing to the elements of the current superset
passed to the process() function.
By default we will detect all inclusions. It is possible to make sure we
don't do more than O(work_limit) operations and eventually abort early by
setting this. Note that we don't reset it on Reset().
This is needed, because for m candidates of size n, we can have O(m ^ 2)
inclusions, each requiring O(n) work to check.
Function that should only be used from within "process()".
Stop will abort the current search. The other two will cause the
corresponding candidate set to never appear in any future inclusion.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eInclusionDetector\u003c/code\u003e class in C++ identifies subset/superset relationships within a collection of candidate sets.\u003c/p\u003e\n"],["\u003cp\u003eUsers add candidate sets and define a processing function to handle detected inclusions.\u003c/p\u003e\n"],["\u003cp\u003eThe detection process can be controlled by work limits and stopping conditions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eDetectInclusions\u003c/code\u003e method triggers the inclusion search and applies the user-defined processing function to each found inclusion.\u003c/p\u003e\n"],["\u003cp\u003eInternal methods like \u003ccode\u003eIsInSuperset\u003c/code\u003e, \u003ccode\u003eStopProcessingCurrentSubset\u003c/code\u003e, and \u003ccode\u003eStopProcessingCurrentSuperset\u003c/code\u003e allow fine-grained control during the inclusion detection process.\u003c/p\u003e\n"]]],["The `InclusionDetector` class identifies subset-superset relationships within a collection of sets. Key actions include: `AddPotentialSubset` and `AddPotentialSuperset` to register candidate sets using an index. `DetectInclusions` then finds and reports inclusions via a user-defined function. It offers `SetWorkLimit` to cap operations and `IncreaseWorkDone` to track work. `Reset` clears the state. `IsInSuperset`, `StopProcessingCurrentSubset` and `StopProcessingCurrentSuperset` are available within the user function. The current state of the detector is accessable via `num_potential_subsets`, `num_potential_supersets`, and `work_done`.\n"],null,[]]