Download FaCiLe - La Recherche

Transcript
52
Modules
iter f a iterates f on each integer in dom a.
val member : t -> int -> bool
member a n tests if n belongs to dom a.
val id : t -> int
id a returns a unique integer identifying the attribute a.
val constraints_number : t -> int
constraints number a returns the number of different constraints attached
to a.
end
A Domain Variable
type concrete_fd = Unk of Attr.t | Val of int
Type of the value of a Fd variable.
module Fd : sig
Finite domain variable
type t
Type of Fd variable.
Creation
val create : ?name:string -> Domain.t -> t
create ?name d returns a new variable with domain d. If provided, name
will be used by the pretty printer.
val interval : ?name:string -> int -> int -> t
interval ?name inf sup returns a new variable with domain [inf..sup].
If provided, name will be used by the pretty printer.
val array : ?name:string -> int -> int -> int -> t array
array n inf sup returns an array of n new variables with domain [inf..sup].
If provided, name (suffixed with the index of the element) will be used by
the pretty printer.
val int : int -> t
int n returns a new variable instantiated to integer value n.
Access
val is_var : t -> bool
is var v returns true if v is not instantiated and false otherwise.
val value : t -> concrete_fd
value v returns Val n if v is instantiated to n, Unk a otherwise where a is
the attribute of v. Should always be used in a matching: match value v
with Val n -> ... | Unk a -> ....