ConstraintDomains
ConstraintDomains.AbstractDomain
ConstraintDomains.BoolParameterDomain
ConstraintDomains.ContinuousDomain
ConstraintDomains.DimParameterDomain
ConstraintDomains.DiscreteDomain
ConstraintDomains.EmptyDomain
ConstraintDomains.ExploreSettings
ConstraintDomains.FakeAutomaton
ConstraintDomains.IdParameterDomain
ConstraintDomains.Intervals
ConstraintDomains.LanguageParameterDomain
ConstraintDomains.OpParameterDomain
ConstraintDomains.PairVarsParameterDomain
ConstraintDomains.RangeDomain
ConstraintDomains.SetDomain
ConstraintDomains.ValParameterDomain
ConstraintDomains.ValsParameterDomain
Base.convert
Base.delete!
Base.eltype
Base.in
Base.in
Base.in
Base.isempty
Base.length
Base.length
Base.length
Base.rand
Base.rand
Base.rand
Base.rand
Base.string
ConstraintCommons.accept
ConstraintDomains.ArbitraryDomain
ConstraintDomains._explore
ConstraintDomains.add!
ConstraintDomains.domain
ConstraintDomains.domain
ConstraintDomains.domain
ConstraintDomains.domain_size
ConstraintDomains.domain_size
ConstraintDomains.domain_size
ConstraintDomains.explore
ConstraintDomains.fake_automaton
ConstraintDomains.generate_parameters
ConstraintDomains.get_domain
ConstraintDomains.intersect_domains
ConstraintDomains.intersect_domains!
ConstraintDomains.merge_domains
ConstraintDomains.size
ConstraintDomains.to_domains
ConstraintDomains.AbstractDomain
— TypeAbstractDomain
An abstract super type for any domain type. A domain type D <: AbstractDomain
must implement the following methods to properly interface AbstractDomain
.
Base.∈(val, ::D)
Base.rand(::D)
Base.length(::D)
that is the number of elements in a discrete domain, and the distance between bounds or similar for a continuous domain
Addtionally, if the domain is used in a dynamic context, it can extend
add!(::D, args)
delete!(::D, args)
where args
depends on D
's structure
ConstraintDomains.BoolParameterDomain
— TypeBoolParameterDomain <: AbstractDomain
A domain to store boolean values. It is used to generate random parameters.
ConstraintDomains.ContinuousDomain
— TypeContinuousDomain{T <: Real} <: AbstractDomain
An abstract supertype for all continuous domains.
ConstraintDomains.DimParameterDomain
— TypeDimParameterDomain <: AbstractDomain
A domain to store dimensions. It is used to generate random parameters.
ConstraintDomains.DiscreteDomain
— TypeDiscreteDomain{T <: Number} <: AbstractDomain
An abstract supertype for discrete domains (set, range).
ConstraintDomains.EmptyDomain
— TypeEmptyDomain
A struct to handle yet to be defined domains.
ConstraintDomains.ExploreSettings
— MethodExploreSettings(
domains;
complete_search_limit = 10^6,
max_samplings = sum(domain_size, domains),
search = :flexible,
solutions_limit = floor(Int, sqrt(max_samplings)),
)
Settings for the exploration of a search space composed by a collection of domains.
ConstraintDomains.FakeAutomaton
— TypeFakeAutomaton{T} <: ConstraintCommons.AbstractAutomaton
A structure to generate pseudo automaton enough for parameter exploration.
ConstraintDomains.IdParameterDomain
— TypeIdParameterDomain <: AbstractDomain
A domain to store ids. It is used to generate random parameters.
ConstraintDomains.Intervals
— TypeIntervals{T <: Real} <: ContinuousDomain{T}
An encapsuler to store a vector of PatternFolds.Interval
. Dynamic changes to Intervals
are not handled yet.
ConstraintDomains.LanguageParameterDomain
— TypeLanguageParameterDomain <: AbstractDomain
A domain to store languages. It is used to generate random parameters.
ConstraintDomains.OpParameterDomain
— TypeOpParameterDomain{T} <: AbstractDomain
A domain to store operators. It is used to generate random parameters.
ConstraintDomains.PairVarsParameterDomain
— TypePairVarsParameterDomain{T} <: AbstractDomain
A domain to store values paired with variables. It is used to generate random parameters.
ConstraintDomains.RangeDomain
— TypeRangeDomain
A discrete domain defined by a range <: AbstractRange{Real}
. As ranges are immutable in Julia, changes in RangeDomain
must use set_domain!
.
ConstraintDomains.SetDomain
— TypeSetDomain{T <: Number} <: DiscreteDomain{T}
Domain that stores discrete values as a set of (unordered) points.
ConstraintDomains.ValParameterDomain
— TypeValParameterDomain{T} <: AbstractDomain
A domain to store one value. It is used to generate random parameters.
ConstraintDomains.ValsParameterDomain
— TypeValsParameterDomain{T} <: AbstractDomain
A domain to store values. It is used to generate random parameters.
Base.convert
— MethodBase.convert(::Type{Union{Intervals, RangeDomain}}, d::Union{Intervals, RangeDomain})
Extends Base.convert
for domains.
Base.delete!
— MethodBase.delete!(d::SetDomain, value)(d::SetDomain, value)
Delete value
from the list of points in d
.
Base.eltype
— MethodBase.eltype(::AbstractDomain)
Extend eltype
for domains.
Base.in
— MethodBase.in(x, itv::Intervals)
Return true
if x ∈ I
for any 'I ∈ itv, false otherwise.
x ∈ I` is equivalent to
a < x < b
ifI = (a, b)
a < x ≤ b
ifI = (a, b]
a ≤ x < b
ifI = [a, b)
a ≤ x ≤ b
ifI = [a, b]
Base.in
— MethodBase.in(value, d <: AbstractDomain)
Fallback method for value ∈ d
that returns false
.
Base.in
— MethodBase.in(value, d::D) where D <: DiscreteDomain
Return true
if value
is a point of d
.
Base.isempty
— MethodBase.isempty(d <: AbstractDomain)
Fallback method for isempty(d)
that return length(d) == 0
which default to 0
.
Base.length
— MethodBase.length(itv::Intervals)
Return the sum of the length of each interval in itv
.
Base.length
— MethodBase.rand(d <: AbstractDomain)
Fallback method for length(d)
that return 0
.
Base.length
— MethodBase.length(d::D) where D <: DiscreteDomain
Return the number of points in d
.
Base.rand
— MethodBase.rand(d::Union{Vector{D},Set{D}, D}) where {D<:AbstractDomain}
Extends Base.rand
to (a collection of) domains.
Base.rand
— MethodBase.rand(fa::FakeAutomaton)
Extends Base.rand
. Currently simply returns fa
.
Base.rand
— MethodBase.rand(itv::Intervals)
Base.rand(itv::Intervals, i)
Return a random value from itv
, specifically from the i
th interval if i
is specified.
Base.rand
— MethodBase.rand(d::D) where D <: DiscreteDomain
Draw randomly a point in d
.
Base.string
— MethodBase.string(D::Vector{<:AbstractDomain})
Base.string(d<:AbstractDomain)
Extends the string
method to (a vector of) domains.
ConstraintCommons.accept
— MethodConstraintCommons.accept(fa::FakeAutomaton, word)
Implement the accept
methods for FakeAutomaton
.
ConstraintDomains.ArbitraryDomain
— MethodArbitraryDomain{T} <: DiscreteDomain{T}
A domain type that stores arbitrary values, possibly non numeric, of type T
.
ConstraintDomains._explore
— Method_explore(args...)
Internals of the explore
function. Behavior is automatically adjusted on the kind of exploration: :flexible
, :complete
, :partial
.
ConstraintDomains.add!
— Methodadd!(d::SetDomain, value)
Add value
to the list of points in d
.
ConstraintDomains.domain
— Methoddomain(values)
domain(range::R) where {T <: Real, R <: AbstractRange{T}}
Construct either a SetDomain
or a RangeDomain
`.
d1 = domain(1:5)
d2 = domain([53.69, 89.2, 0.12])
d3 = domain([2//3, 89//123])
d4 = domain(4.3)
d5 = domain(1,42,86.9)
ConstraintDomains.domain
— Methoddomain()
Construct an EmptyDomain
.
ConstraintDomains.domain
— Methoddomain(a::Tuple{T, Bool}, b::Tuple{T, Bool}) where {T <: Real}
domain(intervals::Vector{Tuple{Tuple{T, Bool},Tuple{T, Bool}}}) where {T <: Real}
Construct a domain of continuous interval(s).
ConstraintDomains.domain_size
— Methoddomain_size(itv::Intervals)
Return the difference between the highest and lowest values in itv
.
ConstraintDomains.domain_size
— Methoddomain_size(d <: AbstractDomain)
Fallback method for domain_size(d)
that return length(d)
.
ConstraintDomains.domain_size
— Methoddomain_size(d::D) where D <: DiscreteDomain
Return the maximum distance between two points in d
.
ConstraintDomains.explore
— Methodexplore(domains, concept, param = nothing; search_limit = 1000, solutions_limit = 100)
Search (a part of) a search space and returns a pair of vector of configurations: (solutions, non_solutions)
. If the search space size is over search_limit
, then both solutions
and non_solutions
are limited to solutions_limit
.
Beware that if the density of the solutions in the search space is low, solutions_limit
needs to be reduced. This process will be automatic in the future (simple reinforcement learning).
Arguments:
domains
: a collection of domainsconcept
: the concept of the targeted constraintparam
: an optional parameter of the constraintsol_number
: the required number of solutions (half of the number of configurations), default to100
ConstraintDomains.fake_automaton
— Methodfake_automaton(d)
Construct a FakeAutomaton
.
ConstraintDomains.generate_parameters
— Methodgenerate_parameters(d<:AbstractDomain, param)
Generates random parameters based on the domain d
and the kind of parameters param
.
ConstraintDomains.get_domain
— Methodget_domain(::AbstractDomain)
Access the internal structure of any domain type.
ConstraintDomains.intersect_domains!
— Methodintersect_domains!(is, i, new_itvls)
Compute the intersections of a domain with an interval and store the results in new_itvls
.
Arguments
is::IS
: a collection of intervals.i::I
: an interval.new_itvls::Vector{I}
: a vector to store the results.
ConstraintDomains.intersect_domains
— Methodintersect_domains(d₁, d₂)
Compute the intersections of two domains.
ConstraintDomains.merge_domains
— Methodmerge_domains(d₁::AbstractDomain, d₂::AbstractDomain)
Merge two domains of same nature (discrete/contiuous).
ConstraintDomains.size
— MethodBase.size(i::I) where {I <: Interval}
Defines the size of an interval as its span
.
ConstraintDomains.to_domains
— Methodto_domains(args...)
Convert various arguments into valid domains format.