Download FaCiLe - La Recherche
Transcript
4.4 Module Cstr : Posting Constraints and Building New Ones 4.4 47 Module Cstr : Posting Constraints and Building New Ones Overview This module defines the type t of constraints and functions to create and post constraints: mainly a create function which allows to build new constraints from scratch (this function is not needed when using standard FaCiLe predefined constraints) and the mostly useful post function which must be called to actually add a constraint to the constraint store. 4.4.1 Basic exception DontKnow Exception raised by the check function of a reified constraint when it is not known whether the constraint is satisfied or violated. type priority Type of waking priority. val immediate : priority val normal : priority val later : priority Available priorities: • immediate: as soon as possible, for quick updates; • normal: standard priority; • later: for time consuming constraints (e.g. Gcc.cstr, Alldiff.cstr. . .). type t The type of constraints. val create : ?name:string -> ?nb_wakings:int -> ?fprint:(Pervasives.out_channel -> unit) -> ?priority:priority -> ?init:(unit -> unit) -> ?check:(unit -> bool) -> ?not:(unit -> t) -> (int -> bool) -> (t -> unit) -> t create ?name ?nb wakings ?fprint ?priority ?init ?check ?not update delay builds a new constraint: • name is a describing string for the constraint. Default value is "anonymous". • nb wakings is the number of calls to Var.delay with distinct ”waking id” arguments (see 4.16.4) within the constraint own delay function (see below). Default value is 1. Beware that if nb wakings is greater than 1 and the optional init argument is not provided, init default behaviour is to do nothing (i.e. the update function will not be called). • fprint should print the constraint on an output channel taken as its only argument. Default value is to print the name string.