You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Propagators can use domain functions to check certain properties. For example:
findfirst, to get the smallest/minimum value of the domain
sum, to get the number of rules in the domain
These functions are used as if the domain was a BitVector. However, they are not intuitive for what they are supposed to do. For a StateSparseSet this is even more confusing, because sum seems like it should behave completely different.
Solution
Use a wrapper function around domains and give intuitive names to domain operations. (Like minimum and size)
abstract type AbstractDomain endstruct BitVetorDomain
domain::BitVectorendstruct StateDomain
domain::StateSparseSetend
It should support at least the following operations:
Base.minimum(::AbstractDomain). return the lowest rule index.
Base.maximum(::AbstractDomain). return the highest rule index.
Base.iterate(::AbstractDomain). iterate over all rules in the domain.
Base.size(::AbstractDomain). return the number of rules in the domain.
Base.in(::AbstractDomain). check if a rule is in the domain.
Base.findall(::AbstractDomain). return all rules in the domain.
Base.isempty(::AbstractDomain). check if the domain is empty.
remove!(::AbstractDomain, rule::Int). remove a rule from the domain.
remove_all_but!(::AbstractDomain, rule::Int). remove all but a single rule from the domain.
remove_below!(::AbstractDomain, rule::Int) remove all remove with a lower rule index from the domain.
remove_above!(::AbstractDomain, rule::Int) remove all remove with a higher rule index from the domain.
are_disjoint(::AbstractDomain, ::AbstractDomain) return true if two domains have an empty intersection.
get_intersection(::AbstractDomain, ::AbstractDomain) returns rules that are in both domains.
is_subdomain(sub::AbstractDomain, dom::AbstractDomain) check if sub sub-domain of dom.
Why is this not here yet
Adding the wrapper might cause overhead when copying over many holes during program iteration.
The text was updated successfully, but these errors were encountered:
Holes can have domains of two different types:
StateSparseSet
(for stateful holes)BitVector
(for all other holes)Propagators can use domain functions to check certain properties. For example:
findfirst
, to get the smallest/minimum value of the domainsum
, to get the number of rules in the domainThese functions are used as if the domain was a
BitVector
. However, they are not intuitive for what they are supposed to do. For aStateSparseSet
this is even more confusing, becausesum
seems like it should behave completely different.Solution
Use a wrapper function around domains and give intuitive names to domain operations. (Like
minimum
andsize
)It should support at least the following operations:
Base.minimum(::AbstractDomain)
. return the lowest rule index.Base.maximum(::AbstractDomain)
. return the highest rule index.Base.iterate(::AbstractDomain)
. iterate over all rules in the domain.Base.size(::AbstractDomain)
. return the number of rules in the domain.Base.in(::AbstractDomain)
. check if a rule is in the domain.Base.findall(::AbstractDomain)
. return all rules in the domain.Base.isempty(::AbstractDomain)
. check if the domain is empty.remove!(::AbstractDomain, rule::Int)
. remove a rule from the domain.remove_all_but!(::AbstractDomain, rule::Int)
. remove all but a single rule from the domain.remove_below!(::AbstractDomain, rule::Int)
remove all remove with a lower rule index from the domain.remove_above!(::AbstractDomain, rule::Int)
remove all remove with a higher rule index from the domain.are_disjoint(::AbstractDomain, ::AbstractDomain)
return true if two domains have an empty intersection.get_intersection(::AbstractDomain, ::AbstractDomain)
returns rules that are in both domains.is_subdomain(sub::AbstractDomain, dom::AbstractDomain)
check ifsub
sub-domain ofdom
.Why is this not here yet
Adding the wrapper might cause overhead when copying over many holes during program iteration.
The text was updated successfully, but these errors were encountered: