module Fcl_invariant:sig..end
Backtrackable Invariant References
This module provides types and functions to create and handle Backtrackable Invariant References (noted BIR in the sequel). BIRs are single-valued variables whose values are restored upon backtracks and which are linked by "one-way" constraints. They maintain functional dependencies between "source" setable BIRs (initialized with their creation value) and unsetable BIRs built upon them. BIRs may be convenient to automatically handle heuristic criteria or the data structures of local search algorithms . Note that circular dependencies are not allowed by the typing policy.
type ('a, 'b) t
type setable
type unsetable
type'asetable_t =('a, setable) t
type'aunsetable_t =('a, unsetable) t
Type of BIRs. Parameter 'a stands for the
type of the value of the BIR. Parameter 'b is setable if the BIR
can be assigned, unsetable if not. setable_t and unsetable_t are
shortcuts.
val create : ?name:string -> 'a -> 'a setable_tcreate ~name:"" v returns a setable BIR with initial content v.
An optional string can be given to name the BIR.
val constant : ?name:string -> 'a -> 'a unsetable_tconstant ~name:"" cst returns an unsetable BIR with initial
content cst. An optional string can be given to name the BIR.
val set : 'a setable_t -> 'a -> unitAssignment of a setable BIR.
val get : ('a, 'b) t -> 'aAccess to the content of a BIR.
val id : ('a, 'b) t -> intid r returns a unique integer associated to BIR r.
val name : ('a, 'b) t -> stringname r returns the name (specified or generated) of BIR r.
val fprint : Stdlib.out_channel ->
?printer:(Stdlib.out_channel -> 'a -> unit) ->
('a, 'b) t -> unitfprint c ~printer:(fun _ _ -> ()) r prints BIR r on channel c.
An optional custom printer can be given to display the value of r.
val unary : ?name:string ->
('a -> 'b) -> ('a, 'c) t -> 'b unsetable_tunary ~name:"Invariant.unary" f wraps the unary function f into
an operator on BIRs. An optional string can be given to name the
operator.
val binary : ?name:string ->
('a -> 'b -> 'c) ->
('a, 'd) t ->
('b, 'e) t -> 'c unsetable_tbinary ~name:"Invariant.binary" f wraps the binary function f
into an operator on BIRs.
An optional string can be given to name the operator.
val ternary : ?name:string ->
('a -> 'b -> 'c -> 'd) ->
('a, 'e) t ->
('b, 'f) t ->
('c, 'g) t -> 'd unsetable_tternary ~name:"Invariant.ternary" f wraps the ternary function f
into an operator on BIRs.
An optional string can be given to name the operator.
val sum : (int, 'a) t array -> int unsetable_tsum a returns a BIR equal to the sum of elements of a.
val prod : (int, 'a) t array -> int unsetable_tsum a returns a BIR equal to the product of elements of a.
module Array:sig..end
module type FD =sig..end
Generic signature.
module Fd:FDwith type fd = Fcl_var.Fd.t and type elt = Fcl_var.Fd.elt
Module for accessing finite integer domain variables with BIRs.
module SetFd:FDwith type fd = Fcl_var.SetFd.t and type elt = Fcl_var.SetFd.elt
Module for accessing set domain variables with BIRs.