ConstraintDomains.AbstractDomainType
AbstractDomain

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.ExploreSettingsMethod
ExploreSettings(
    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.FakeAutomatonType
FakeAutomaton{T} <: ConstraintCommons.AbstractAutomaton

A structure to generate pseudo automaton enough for parameter exploration.

ConstraintDomains.IntervalsType
Intervals{T <: Real} <: ContinuousDomain{T}

An encapsuler to store a vector of PatternFolds.Interval. Dynamic changes to Intervals are not handled yet.

ConstraintDomains.SetDomainType
SetDomain{T <: Number} <: DiscreteDomain{T}

Domain that stores discrete values as a set of (unordered) points.

Base.convertMethod
Base.convert(::Type{Union{Intervals, RangeDomain}}, d::Union{Intervals, RangeDomain})

Extends Base.convert for domains.

Base.delete!Method
Base.delete!(d::SetDomain, value)(d::SetDomain, value)

Delete value from the list of points in d.

Base.eltypeMethod
Base.eltype(::AbstractDomain)

Extend eltype for domains.

Base.inMethod
Base.in(x, itv::Intervals)

Return true if x ∈ I for any 'I ∈ itv, false otherwise.x ∈ I` is equivalent to

  • a < x < b if I = (a, b)
  • a < x ≤ b if I = (a, b]
  • a ≤ x < b if I = [a, b)
  • a ≤ x ≤ b if I = [a, b]
Base.inMethod
Base.in(value, d <: AbstractDomain)

Fallback method for value ∈ d that returns false.

Base.inMethod
Base.in(value, d::D) where D <: DiscreteDomain

Return true if value is a point of d.

Base.isemptyMethod
Base.isempty(d <: AbstractDomain)

Fallback method for isempty(d) that return length(d) == 0 which default to 0.

Base.lengthMethod
Base.length(itv::Intervals)

Return the sum of the length of each interval in itv.

Base.lengthMethod
Base.rand(d <: AbstractDomain)

Fallback method for length(d) that return 0.

Base.lengthMethod
Base.length(d::D) where D <: DiscreteDomain

Return the number of points in d.

Base.randMethod
Base.rand(d::Union{Vector{D},Set{D}, D}) where {D<:AbstractDomain}

Extends Base.rand to (a collection of) domains.

Base.randMethod
Base.rand(fa::FakeAutomaton)

Extends Base.rand. Currently simply returns fa.

Base.randMethod
Base.rand(itv::Intervals)
Base.rand(itv::Intervals, i)

Return a random value from itv, specifically from the ith interval if i is specified.

Base.randMethod
Base.rand(d::D) where D <: DiscreteDomain

Draw randomly a point in d.

Base.stringMethod
Base.string(D::Vector{<:AbstractDomain})
Base.string(d<:AbstractDomain)

Extends the string method to (a vector of) domains.

ConstraintCommons.acceptMethod
ConstraintCommons.accept(fa::FakeAutomaton, word)

Implement the accept methods for FakeAutomaton.

ConstraintDomains._exploreMethod
_explore(args...)

Internals of the explore function. Behavior is automatically adjusted on the kind of exploration: :flexible, :complete, :partial.

ConstraintDomains.domainMethod
domain(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.domainMethod
domain(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). ```julia d1 = domain((0., true), (1., false)) # d1 = [0, 1) d2 = domain([ # d2 = 0, 1) ∪ (3.5, 42, (1., false), (3.5, false), (42., true), ])

ConstraintDomains.exploreMethod
explore(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 domains
  • concept: the concept of the targeted constraint
  • param: an optional parameter of the constraint
  • sol_number: the required number of solutions (half of the number of configurations), default to 100
ConstraintDomains.sizeMethod
Base.size(i::I) where {I <: Interval}

Defines the size of an interval as its span.