Skip to content

Commit 71449c0

Browse files
authored
Excluding merged inits (#25)
* Add an EvaluationParameters option to include/exclude inits that merged with another init (exclude by default) * Update PostTagSearcher.rangeOfTagStates test to set includeMergedStates = true
1 parent 99b0ead commit 71449c0

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

libPostTagSystem/PostTagSearcher.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ class PostTagSearcher::Implementation {
8484
default:
8585
result.conclusionReason = ConclusionReason::InvalidInput;
8686
}
87-
if (result.conclusionReason != ConclusionReason::NotEvaluated || parameters.includeUnevaluatedStates) {
87+
if ((result.conclusionReason != ConclusionReason::NotEvaluated || parameters.includeUnevaluatedStates) &&
88+
(result.conclusionReason != ConclusionReason::MergedWithAnotherInit || parameters.includeMergedStates)) {
8889
results.push_back(result);
8990
}
9091
}

libPostTagSystem/PostTagSearcher.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class PostTagSearcher {
5252
int64_t groupTimeConstraintNs = std::numeric_limits<int64_t>::max();
5353
Checkpoints checkpoints = {};
5454
bool includeUnevaluatedStates = false;
55+
bool includeMergedStates = false;
5556
};
5657

5758
// The functions below use two tries. One for the input checkpoints which is shared among all of them. The other trie

libPostTagSystem/test/PostTagSearcher_test.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,12 @@ void compareResults(const TagState& init,
5858

5959
TEST(PostTagSearcher, rangeOfTagStates) {
6060
PostTagSearcher searcher;
61-
const auto result = searcher.evaluateRange({{0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1}, 0},
62-
{{0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 1},
63-
PostTagSearcher::EvaluationParameters());
61+
62+
PostTagSearcher::EvaluationParameters evalParams;
63+
evalParams.includeMergedStates = true;
64+
65+
const auto result = searcher.evaluateRange(
66+
{{0, 0, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1}, 0}, {{0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0}, 1}, evalParams);
6467
ASSERT_EQ(result.size(), 106);
6568

6669
compareResults(TagState({0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1}, 0), result[48]);

0 commit comments

Comments
 (0)