<html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <link rel="Start" href="index.html"> <link rel="previous" href="Var.ATTR.html"> <link rel="next" href="Var.FD.html"> <link rel="Up" href="Var.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Index of module types" rel=Appendix href="index_module_types.html"> <link title="Domain" rel="Chapter" href="Domain.html"> <link title="SetDomain" rel="Chapter" href="SetDomain.html"> <link title="Stak" rel="Chapter" href="Stak.html"> <link title="Data" rel="Chapter" href="Data.html"> <link title="Cstr" rel="Chapter" href="Cstr.html"> <link title="Var" rel="Chapter" href="Var.html"> <link title="Invariant" rel="Chapter" href="Invariant.html"> <link title="Reify" rel="Chapter" href="Reify.html"> <link title="Arith" rel="Chapter" href="Arith.html"> <link title="Conjunto" rel="Chapter" href="Conjunto.html"> <link title="Goals" rel="Chapter" href="Goals.html"> <link title="FdArray" rel="Chapter" href="FdArray.html"> <link title="Gcc" rel="Chapter" href="Gcc.html"> <link title="Alldiff" rel="Chapter" href="Alldiff.html"> <link title="Sorting" rel="Chapter" href="Sorting.html"> <link title="Interval" rel="Chapter" href="Interval.html"><link title="Creation" rel="Section" href="#2_Creation"> <link title="Access" rel="Section" href="#2_Access"> <link title="Refinement" rel="Section" href="#2_Refinement"> <link title="Events and suspending" rel="Section" href="#2_Eventsandsuspending"> <title>Var.BASICFD</title> </head> <body> <div class="navbar"><a href="Var.ATTR.html">Previous</a> <a href="Var.html">Up</a> <a href="Var.FD.html">Next</a> </div> <center><h1>Module type <a href="type_Var.BASICFD.html">Var.BASICFD</a></h1></center> <br> <pre><span class="keyword">module type</span> BASICFD = <code class="code">sig</code> <a href="Var.BASICFD.html">..</a> <code class="code">end</code></pre>Common variables module signature.<br> <hr width="100%"> <pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> <div class="info"> Type of finite domain variable.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEattr"></a><code class="type"></code>attr </pre> <div class="info"> Type of attributes.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEdomain"></a><code class="type"></code>domain </pre> <div class="info"> Type of domains.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEelt"></a><code class="type"></code>elt </pre> <div class="info"> Type of elements of domains.<br> </div> <pre><span class="keyword">type</span> <a name="TYPEevent"></a><code class="type"></code>event </pre> <div class="info"> Type of domain reduction events.<br> </div> <br> <a name="2_Creation"></a> <h2>Creation</h2><br> <pre><span class="keyword">val</span> <a name="VALcreate"></a>create : <code class="type">?name:string -> <a href="Var.BASICFD.html#TYPEdomain">domain</a> -> <a href="Var.BASICFD.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">create ?name d</code> returns a new variable with domain <code class="code">d</code>. If provided, <code class="code">name</code> will be used by the pretty printer.<br> </div> <pre><span class="keyword">val</span> <a name="VALinterval"></a>interval : <code class="type">?name:string -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">interval ?name inf sup</code> returns a new variable with domain <code class="code">[inf..sup]</code>. If provided, <code class="code">name</code> will be used by the pretty printer.<br> </div> <pre><span class="keyword">val</span> <a name="VALarray"></a>array : <code class="type">?name:string -><br> int -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEt">t</a> array</code></pre><div class="info"> <code class="code">array n inf sup</code> returns an array of <code class="code">n</code> new variables with domain <code class="code">[inf..sup]</code>. If provided, <code class="code">name</code> (suffixed with the index of the element) will be used by the pretty printer.<br> </div> <pre><span class="keyword">val</span> <a name="VALelt"></a>elt : <code class="type"><a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">int n</code> returns a new variable instantiated to integer value <code class="code">n</code>.<br> </div> <br> <a name="2_Access"></a> <h2>Access</h2><br> <pre><span class="keyword">val</span> <a name="VALis_var"></a>is_var : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> bool</code></pre><div class="info"> <code class="code">is_var v</code> returns <code class="code">true</code> if <code class="code">v</code> is not instantiated and <code class="code">false</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALis_bound"></a>is_bound : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> bool</code></pre><div class="info"> <code class="code">is_bound v</code> returns <code class="code">true</code> if <code class="code">v</code> is instantiated and <code class="code">false</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALvalue"></a>value : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> (<a href="Var.BASICFD.html#TYPEattr">attr</a>, <a href="Var.BASICFD.html#TYPEelt">elt</a>) <a href="Var.html#TYPEconcrete">Var.concrete</a></code></pre><div class="info"> <code class="code">value v</code> returns <code class="code">Val n</code> if <code class="code">v</code> is instantiated to <code class="code">n</code>, <code class="code">Unk a</code> otherwise where <code class="code">a</code> is the attribute of <code class="code">v</code>. Should always be used in a matching: <code class="code">match value v with Val n -> ... | Unk a -> ...</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALmin"></a>min : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a></code></pre><div class="info"> <code class="code">min v</code> returns the lower bound of <code class="code">v</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALmax"></a>max : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a></code></pre><div class="info"> <code class="code">max v</code> returns the upper bound of <code class="code">v</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALmin_max"></a>min_max : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> * <a href="Var.BASICFD.html#TYPEelt">elt</a></code></pre><div class="info"> <code class="code">min_max v</code> returns both the lower and upper bounds of <code class="code">v</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALelt_value"></a>elt_value : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a></code></pre><div class="info"> <code class="code">int_value v</code> returns the value of <code class="code">v</code> if it is instantiated and raises a <code class="code">Failure</code> exception otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALint_value"></a>int_value : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a></code></pre><pre><span class="keyword">val</span> <a name="VALsize"></a>size : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> int</code></pre><div class="info"> <code class="code">size v</code> returns the number of integer values in the domain of <code class="code">v</code> (<code class="code">1</code> if <code class="code">v</code> is instantiated).<br> </div> <pre><span class="keyword">val</span> <a name="VALmember"></a>member : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> bool</code></pre><div class="info"> <code class="code">member v n</code> returns <code class="code">true</code> if <code class="code">n</code> belongs to the domain of <code class="code">v</code> and <code class="code">false</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALid"></a>id : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> int</code></pre><div class="info"> <code class="code">id v</code> returns a unique integer identifying the attribute associated with <code class="code">v</code>. Must be called only on non ground variable, raise <code class="code">Failure</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALname"></a>name : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> string</code></pre><div class="info"> <code class="code">name v</code> returns the name of variable <code class="code">v</code> (the empty string if it was not provided while created). Must be called only on non ground variable, raise <code class="code">Failure</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALcompare"></a>compare : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEt">t</a> -> int</code></pre><div class="info"> Compares two variables. Values (bound variables) are smaller than unknowns (unbound variables). Unknowns are sorted according to their attribute <code class="code">id</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALequal"></a>equal : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEt">t</a> -> bool</code></pre><div class="info"> Tests if two variables are equal with respect to <code class="code">compare</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALfprint"></a>fprint : <code class="type">Pervasives.out_channel -> <a href="Var.BASICFD.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">fprint chan v</code> prints variable <code class="code">v</code> on channel <code class="code">chan</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALfprint_array"></a>fprint_array : <code class="type">Pervasives.out_channel -> <a href="Var.BASICFD.html#TYPEt">t</a> array -> unit</code></pre><div class="info"> <code class="code">fprint_array chan vs</code> prints array of variables <code class="code">vs</code> on channel <code class="code">chan</code>.<br> </div> <br> <a name="2_Refinement"></a> <h2>Refinement</h2><br> <pre><span class="keyword">val</span> <a name="VALunify"></a>unify : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> unit</code></pre><div class="info"> <code class="code">unify v n</code> instantiates variable <code class="code">v</code> with integer value <code class="code">n</code>. Raises <code class="code">Stak.Fail</code> in case of failure. <code class="code">unify</code> may be called either on unbound variables or on instantiated variables.<br> </div> <pre><span class="keyword">val</span> <a name="VALrefine"></a>refine : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEdomain">domain</a> -> unit</code></pre><div class="info"> <code class="code">refine v d</code> reduces the domain of <code class="code">v</code> with domain <code class="code">d</code>. <code class="code">d</code> must be included in the domain of <code class="code">v</code>, otherwise the behaviour is unspecified (corrupted system or exception raised).<br> </div> <pre><span class="keyword">val</span> <a name="VALrefine_low"></a>refine_low : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> unit</code></pre><div class="info"> <code class="code">refine_low v inf</code> reduces the domain of <code class="code">v</code> by cutting all values strictly less than <code class="code">inf</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALrefine_up"></a>refine_up : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> unit</code></pre><div class="info"> <code class="code">refine_up v sup</code> reduces the domain of <code class="code">v</code> by cutting all values strictly greater than <code class="code">sup</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALrefine_low_up"></a>refine_low_up : <code class="type"><a href="Var.BASICFD.html#TYPEt">t</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> <a href="Var.BASICFD.html#TYPEelt">elt</a> -> unit</code></pre><div class="info"> <code class="code">refine_low_up v inf sup</code> reduces the domain of <code class="code">v</code> by cutting all values strictly less than <code class="code">inf</code> and greater than <code class="code">sup</code>. Robust even if <code class="code">v</code> is already bound (checks that <code class="code">inf</code> <= <code class="code">v</code> <= <code class="code">sup</code>, otherwise fails).<br> </div> <br> <a name="2_Eventsandsuspending"></a> <h2>Events and suspending</h2><br> <pre><span class="keyword">val</span> <a name="VALon_refine"></a>on_refine : <code class="type"><a href="Var.BASICFD.html#TYPEevent">event</a></code></pre><div class="info"> Event occuring when a variable is changed, i.e. its domain modified.<br> </div> <pre><span class="keyword">val</span> <a name="VALon_subst"></a>on_subst : <code class="type"><a href="Var.BASICFD.html#TYPEevent">event</a></code></pre><div class="info"> Event occuring when a variable is instantiated.<br> </div> <pre><span class="keyword">val</span> <a name="VALon_min"></a>on_min : <code class="type"><a href="Var.BASICFD.html#TYPEevent">event</a></code></pre><pre><span class="keyword">val</span> <a name="VALon_max"></a>on_max : <code class="type"><a href="Var.BASICFD.html#TYPEevent">event</a></code></pre><div class="info"> Event occuring when the lower (resp. upper) bound of a variable decreases.<br> </div> <pre><span class="keyword">val</span> <a name="VALdelay"></a>delay : <code class="type"><a href="Var.BASICFD.html#TYPEevent">event</a> list -> <a href="Var.BASICFD.html#TYPEt">t</a> -> ?waking_id:int -> <a href="Cstr.html#TYPEt">Cstr.t</a> -> unit</code></pre><div class="info"> <code class="code">delay event_list v ~waking_id:id c</code> suspends constraint <code class="code">c</code> on all the events in <code class="code">event_list</code> occurring on <code class="code">v</code>. An optional integer <code class="code">id</code> may be associated to the wakening: it must be unique and range from 0 to <code class="code">nb_wakings-1</code>, <code class="code">nb_wakings</code> being the argument of <code class="code">Cstr.create</code> specifying the number of calls to <code class="code">delay</code> with distinct <code class="code">waking_id</code> arguments. These integers are arguments to the "update" function of constraints and aim at discriminating waking events to fire the appropriate propagation rule. <code class="code">waking_id</code> default value is 0. This function has no effect on instantiated variables (as no event could occur on a ground variable).<br> </div> </body></html>