<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Csp (libabsolute.Libabsolute.Csp)</title><meta charset="utf-8"/><link rel="stylesheet" href="../../../odoc.support/odoc.css"/><meta name="generator" content="odoc 2.4.0"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../odoc.support/highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> â€“ <a href="../../index.html">libabsolute</a> &#x00BB; <a href="../index.html">Libabsolute</a> &#x00BB; Csp</nav><header class="odoc-preamble"><h1>Module <code><span>Libabsolute.Csp</span></code></h1><p>This module defines the main types used for the constraint language of AbSolute, along with the type of problems, and instance.</p></header><nav class="odoc-toc"><ul><li><a href="#types">Types</a></li><li><a href="#accessors">Accessors</a></li><li><a href="#constructors">Constructors</a></li><li><a href="#operations">Operations</a></li><li><a href="#printing">Printing</a></li></ul></nav><div class="odoc-content"><h2 id="types"><a href="#types" class="anchor"></a>Types</h2><div class="odoc-spec"><div class="spec type anchored" id="type-typ"><a href="#type-typ" class="anchor"></a><code><span><span class="keyword">type</span> typ</span><span> = </span></code><ol><li id="type-typ.Int" class="def variant constructor anchored"><a href="#type-typ.Int" class="anchor"></a><code><span>| </span><span><span class="constructor">Int</span></span></code></li><li id="type-typ.Real" class="def variant constructor anchored"><a href="#type-typ.Real" class="anchor"></a><code><span>| </span><span><span class="constructor">Real</span></span></code></li></ol></div><div class="spec-doc"><p>Types of variables</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-decl"><a href="#type-decl" class="anchor"></a><code><span><span class="keyword">type</span> decl</span><span> = <a href="#type-typ">typ</a> * string * <a href="../Dom/index.html#type-t">Dom.t</a></span></code></div><div class="spec-doc"><p>declaration</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-instance"><a href="#type-instance" class="anchor"></a><code><span><span class="keyword">type</span> instance</span><span> = <span><a href="../Q/index.html#type-t">Q.t</a> <a href="../Tools/VarMap/index.html#type-t">Tools.VarMap.t</a></span></span></code></div><div class="spec-doc"><p>the instance type</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-info"><a href="#type-info" class="anchor"></a><code><span><span class="keyword">type</span> info</span><span> = </span></code><ol><li id="type-info.Exact" class="def variant constructor anchored"><a href="#type-info.Exact" class="anchor"></a><code><span>| </span><span><span class="constructor">Exact</span> <span class="keyword">of</span> <span><a href="../Instance/index.html#type-t">Instance.t</a> list</span></span></code></li><li id="type-info.Unfeasible" class="def variant constructor anchored"><a href="#type-info.Unfeasible" class="anchor"></a><code><span>| </span><span><span class="constructor">Unfeasible</span></span></code></li><li id="type-info.Known" class="def variant constructor anchored"><a href="#type-info.Known" class="anchor"></a><code><span>| </span><span><span class="constructor">Known</span> <span class="keyword">of</span> <span><span>(<a href="../Instance/index.html#type-t">Instance.t</a> * bool)</span> list</span></span></code></li></ol></div><div class="spec-doc"><p>annotations to test the validity of the solver</p></div></div><div class="odoc-spec"><div class="spec type anchored" id="type-t"><a href="#type-t" class="anchor"></a><code><span><span class="keyword">type</span> t</span><span> = </span><span>{</span></code><ol><li id="type-t.variables" class="def record field anchored"><a href="#type-t.variables" class="anchor"></a><code><span>variables : <span><a href="#type-decl">decl</a> list</span>;</span></code></li><li id="type-t.constraints" class="def record field anchored"><a href="#type-t.constraints" class="anchor"></a><code><span>constraints : <span><a href="../Constraint/index.html#type-t">Constraint.t</a> list</span>;</span></code></li><li id="type-t.objective" class="def record field anchored"><a href="#type-t.objective" class="anchor"></a><code><span>objective : <span><a href="../Expr/index.html#type-t">Expr.t</a> option</span>;</span></code></li><li id="type-t.solutions" class="def record field anchored"><a href="#type-t.solutions" class="anchor"></a><code><span>solutions : <span><a href="#type-info">info</a> option</span>;</span></code></li></ol><code><span>}</span></code></div><div class="spec-doc"><p>type of constraint satisfaction problems</p></div></div><h2 id="accessors"><a href="#accessors" class="anchor"></a>Accessors</h2><div class="odoc-spec"><div class="spec value anchored" id="val-dimensions"><a href="#val-dimensions" class="anchor"></a><code><span><span class="keyword">val</span> dimensions : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> int</span></code></div><div class="spec-doc"><p>returns the number of variables of a csp</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-var_names"><a href="#val-var_names" class="anchor"></a><code><span><span class="keyword">val</span> var_names : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string list</span></span></code></div><div class="spec-doc"><p>returns list of all variable names</p></div></div><h2 id="constructors"><a href="#constructors" class="anchor"></a>Constructors</h2><div class="odoc-spec"><div class="spec value anchored" id="val-empty"><a href="#val-empty" class="anchor"></a><code><span><span class="keyword">val</span> empty : <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>empty problem, with no variables and no constraints</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-initialize"><a href="#val-initialize" class="anchor"></a><code><span><span class="keyword">val</span> initialize : <span><span><span>(<a href="#type-typ">typ</a> * string * <a href="../Dom/index.html#type-t">Dom.t</a>)</span> list</span> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>initalizes and unconstrained CSP</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_real_var"><a href="#val-add_real_var" class="anchor"></a><code><span><span class="keyword">val</span> add_real_var : <span>string <span class="arrow">&#45;&gt;</span></span> <span><a href="../Q/index.html#type-t">Q.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Q/index.html#type-t">Q.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>adds a real variable in the csp</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_real_var_f"><a href="#val-add_real_var_f" class="anchor"></a><code><span><span class="keyword">val</span> add_real_var_f : <span>string <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <span>float <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>adds a real variable in the csp, with float bounds</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_int_var"><a href="#val-add_int_var" class="anchor"></a><code><span><span class="keyword">val</span> add_int_var : <span>string <span class="arrow">&#45;&gt;</span></span> <span><a href="../Q/index.html#type-t">Q.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Q/index.html#type-t">Q.t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>adds an integer variable in the csp</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_int_var_i"><a href="#val-add_int_var_i" class="anchor"></a><code><span><span class="keyword">val</span> add_int_var_i : <span>string <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span>int <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>adds an integer variable in the csp with integer bounds</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_constr"><a href="#val-add_constr" class="anchor"></a><code><span><span class="keyword">val</span> add_constr : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Constraint/index.html#type-t">Constraint.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p>adds a constraint to the csp</p></div></div><h2 id="operations"><a href="#operations" class="anchor"></a>Operations</h2><div class="odoc-spec"><div class="spec value anchored" id="val-sat"><a href="#val-sat" class="anchor"></a><code><span><span class="keyword">val</span> sat : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span><a href="../Instance/index.html#type-t">Instance.t</a> <span class="arrow">&#45;&gt;</span></span> bool</span></code></div><div class="spec-doc"><p>Evaluates the CSP at the given point, i.e true iff all constraints are satisfied</p><ul class="at-tags"><li class="raises"><span class="at-tag">raises</span> <code>[Invalid_arg]</code> <p>if a division by zero occurs or if an exponentitation by a non integer exponant is made.</p></li></ul></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-fix_var"><a href="#val-fix_var" class="anchor"></a><code><span><span class="keyword">val</span> fix_var : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> <span><a href="../Q/index.html#type-t">Q.t</a> <span class="arrow">&#45;&gt;</span></span> <a href="#type-t">t</a></span></code></div><div class="spec-doc"><p><code>fix_var csp var cst</code> builds a new csp identical to the <code>csp</code> where all the occurences of the variable <code>var</code> are replaced by the constant <code>cst</code>, and where the variables <code>v</code> is removed from the csp variables.</p></div></div><h2 id="printing"><a href="#printing" class="anchor"></a>Printing</h2><div class="odoc-spec"><div class="spec value anchored" id="val-pp_typ"><a href="#val-pp_typ" class="anchor"></a><code><span><span class="keyword">val</span> pp_typ : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-typ">typ</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_decl"><a href="#val-pp_decl" class="anchor"></a><code><span><span class="keyword">val</span> pp_decl : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><span>(<a href="#type-typ">typ</a> * string * <a href="../Dom/index.html#type-t">Dom.t</a>)</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_declarations"><a href="#val-pp_declarations" class="anchor"></a><code><span><span class="keyword">val</span> pp_declarations : 
  <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span>
  <span><span><span>(<a href="#type-typ">typ</a> * string * <a href="../Dom/index.html#type-t">Dom.t</a>)</span> list</span> <span class="arrow">&#45;&gt;</span></span>
  unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pp_constraints"><a href="#val-pp_constraints" class="anchor"></a><code><span><span class="keyword">val</span> pp_constraints : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><span><a href="../Constraint/index.html#type-t">Constraint.t</a> list</span> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-print"><a href="#val-print" class="anchor"></a><code><span><span class="keyword">val</span> print : <span><span class="xref-unresolved">Stdlib</span>.Format.formatter <span class="arrow">&#45;&gt;</span></span> <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-to_graphviz"><a href="#val-to_graphviz" class="anchor"></a><code><span><span class="keyword">val</span> to_graphviz : <span><a href="#type-t">t</a> <span class="arrow">&#45;&gt;</span></span> <span>string <span class="arrow">&#45;&gt;</span></span> unit</span></code></div></div></div></body></html>
