title: Constraint Satisfaction Problems with solvers VS Systematic Search
body: <p>We have to solve a difficult problem where we need to check a lot of complex rules from multiple sources against a system in order to decide if the system satisfy those rules or how it should be changed to satisfy them.</p>
  
  <p>We initially started using Constraint Satisfaction Problems algorithms (using <a href="http://www.choco-solver.org/" rel="noreferrer">Choco</a>) to try to solve it but since the number of rules and variables would be smaller than anticipated, we are looking to build a list of all possibles configurations on a database and using multiple requests based on the rules to filter this list and find the solutions this way.</p>
  
  <p>Is there limitations or disadvantages of doing a systematic search compared to using a CSP solver algorithms for a reasonable number of rules and variables? Will it impact performances significantly? Will it reduce the kind of constraints we can implement?</p>
  
  <p><strong>As examples</strong> :</p>
  
  <p>You have to imagine it with a much bigger number of variables, much bigger domains of definition (but always discrete) and bigger number of rules (and some much more complex) but instead of describing the problem as :</p>
  
  <pre><code>x in (1,6,9)
  y in (2,7)
  z in (1,6)
  y = x + 1
  z = x if x &lt; 5 OR z = y if x &gt; 5
  </code></pre>
  
  <p>And giving it to a solver we would build a table :</p>
  
  <pre><code>X | Y | Z
  1   2   1
  6   2   1
  9   2   1
  1   7   1
  6   7   1
  9   7   1
  1   2   6
  6   2   6
  9   2   6
  1   7   6
  6   7   6
  9   7   6
  </code></pre>
  
  <p>And use queries like (this is just an example to help understand, actually we would use SPARQL against a semantic database) :</p>
  
  <pre><code>SELECT X, Y, Z WHERE Y = X + 1 
  INTERSECT 
  SELECT X, Y, Z WHERE (Z = X AND X &lt; 5) OR (Z = Y AND X &gt; 5)
  </code></pre>