template<class A, class B, class HashA = std::hash<A>, class HashB = std::hash<B>, class CompareA = std::equal_to<A>, class CompareB = std::equal_to<B>>
class Limi::internal::antichain< A, B, HashA, HashB, CompareA, CompareB >
An Antichain of minimal elements.
An antichain constains pairs of type (a,b), where a ∈ A and b ⊆ B. So a is a single element and b a set. There is a relation defined between the elements (a1,b1) ⊑ (a2,b2) iff a1=a2 ∧ b1 ⊆ b2. The antichain as an invariant that needs to be maintained by add() as follows: ∀ a1,b1,a2,b2. ¬[(a1,b1) ⊑ (a2,b2)] ∧ ¬[(a2,b2) ⊑ (a1,b1)].
The antichain keeps for each pair (a,b) a dirty flag that tracks if this element is dirty. If it is then it is removed when the antichain_algo restarts.
- Template Parameters
-
A | The type of elements A |
B | The type of elements B |
template<class A, class B, class HashA = std::hash<A>, class HashB = std::hash<B>, class CompareA = std::equal_to<A>, class CompareB = std::equal_to<B>>
void Limi::internal::antichain< A, B, HashA, HashB, CompareA, CompareB >::add |
( |
const A & |
a, |
|
|
const pb_set & |
b, |
|
|
bool |
dirty = false |
|
) |
| |
|
inline |
Add element (a,b) to the antichain.
It preserve the antichain invariant by removing all a1,b1 (a,b) ⊑ (a1,b1) and by not adding (a,b) if there is any a1,b1 (a1,b1) ⊑ (a,b)
template<class A, class B, class HashA = std::hash<A>, class HashB = std::hash<B>, class CompareA = std::equal_to<A>, class CompareB = std::equal_to<B>>
Tests if the element (a,b) or a smaller element is already contained in the antichain.
- Returns
- True if there is any a1,b1 in the antichain, such that (a1,b1) ⊑ (a,b)