Public
Constraints.USUAL_CONSTRAINTS
— ConstantUSUAL_CONSTRAINTS::Dict
Dictionary that contains all the usual constraints defined in Constraint.jl. It is based on XCSP3-core specifications available at https://arxiv.org/abs/2009.00514
Adding a new constraint is as simple as
@usual name p a sym₁ sym₂
where
name
: constraint namep
: the length of the parameters (0 means no parameters)a
: the length of the arguments/variables (0 means any length is possible).symᵢ
: a sequence of symmetries (can be left empty)
Both a
alone, or p
and a
together are optional.
Note that concept_name
needs to be defined. Unless both error_name
and icn_error_name
are defined, a default error function will be computed. Please (re-)define error_name
for a hand_made error function.
Constraints.USUAL_SYMMETRIES
— ConstantUSUAL_SYMMETRIES
A Dictionary that contains the function to apply for each symmetry to avoid searching a whole space.
Constraints.Constraint
— TypeConstraint
Parametric stucture with the following fields.
concept
: a Boolean function that, given an assignmentx
, outputstrue
ifx
satisfies the constraint, andfalse
otherwise.error
: a positive function that works as preferences over invalid assignements. Return0.0
if the constraint is satisfied, and a strictly positive real otherwise.
Constraints.args
— Methodargs(c::Constraint)
Return the expected length restriction of the arguments in a constraint c
. The value nothing
indicates that any strictly positive number of value is accepted.
Constraints.concept
— Methodconcept(c::Constraint)
Return the concept (function) of constraint c
. concept(c::Constraint, x...; param = nothing) Apply the concept of c
to values x
and optionally param
.
Constraints.error_f
— Methoderror_f(c::Constraint)
Return the error function of constraint c
. error_f(c::Constraint, x; param = nothing) Apply the error function of c
to values x
and optionally param
.
Constraints.params_length
— Methodparams_length(c::Constraint)
Return the expected length restriction of the arguments in a constraint c
. The value nothing
indicates that any strictly positive number of parameters is accepted.
Constraints.symmetries
— Methodsymmetries(c::Constraint)
Return the list of symmetries of c
.