Download FaCiLe - La Recherche

Transcript
4.4 Module Domain: Domain Operations
DontKnow when it is not known. check must not change the domains of the variables
involved in the constraint. Default: Failure exception raised.
- not must be specified if the constraint is reifiable (as well as check). not () should
return a constraint which is the negation of the constraint being defined. When the
constraint is reified, it is called to post the negation of the constraint whenever check
() return false, i.e. it is entailed by the constraint store. Default: Failure exception
raised.
- update computes the domain reductions of the constraint. update () should return
true when the constraint becomes solved, false if it is not yet entailed by the constraint store and raise Stak.Fail whenever a failure occurs. update is a mandatory
argument.
- delay schedules the awakening of the constraint ct (which is taken as its only argument), i.e. the execution of its update function. If update () should be called (because
it may reduce variables domains) when one of the events contained in the events list
es occurred on variable v, then Var.delay es v ct should be called within the body
of the delay function. delay is a mandatory argument.
val post : t -> unit
post c posts the constraint c to the constraint store.
val one : t
val zero : t
The constraint which succeeds (resp. fails) immediately.
Access
val id : t -> int
id c returns a unique integer identifying the constraint c.
val name : t -> string
name c returns the name of the constraint c.
val fprint : out_channel -> t -> unit
fprint chan c prints the constraint c on channel chan. Calls the fprint function
passed to create.
val active_store : unit -> t list
active store () returns the list of all active constraints, i.e. whose update functions
have returned false.
4.4
Module Domain: Domain Operations
This module provides all necessary functions (and more) to create and handle domains,
which are needed to create variables and perform propagation (i.e. domain reduction
or filtering).
type t
Type of finite domains of integers (functional: no in place modifications, domains can
be shared). Standard equality and comparison can be used on type domain.
41