`Constraints.USUAL_CONSTRAINTS`

— Constant`USUAL_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 name`p`

: 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`

— Constant`USUAL_SYMMETRIES`

A Dictionary that contains the function to apply for each symmetry to avoid searching a whole space.

`Constraints.Constraint`

— Type`Constraint`

Parametric stucture with the following fields.

`concept`

: a Boolean function that, given an assignment`x`

, outputs`true`

if`x`

satisfies the constraint, and`false`

otherwise.`error`

: a positive function that works as preferences over invalid assignements. Return`0.0`

if the constraint is satisfied, and a strictly positive real otherwise.

`Constraints.args`

— Method`args(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`

— Method`concept(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`

— Method`error_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`

— Method`params_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.shrink_concept`

— Method`shrink_concept(s)`

Simply delete the `concept_`

part of symbol or string starting with it. TODO: add a check with a warning if `s`

starts with something different.

`Constraints.symmetries`

— Method`symmetries(c::Constraint)`

Return the list of symmetries of `c`

.

`Constraints.xcsp_intension`

— Method`xcsp_intension(list, predicate)`

An intensional constraint is usually defined from a `predicate`

over `x`

. As such it encompass any generic constraint.