title: Constraint Satisfaction: Choosing real numbers with certain characteristics
body: <p>I have a set of n real numbers. I also have a set of functions, </p>
  
  <pre><code>f_1, f_2, ..., f_m.
  </code></pre>
  
  <p>Each of these functions takes a list of numbers as its argument.  I also have a set of m ranges, </p>
  
  <pre><code>[l_1, u_1], [l_2, u_2], ..., [l_m, u_m].
  </code></pre>
  
  <p>I want to <strong>repeatedly</strong> choose a subset {r_1, r_2, ..., r_k} of k elements such that</p>
  
  <pre><code>l_i &lt;= f_i({r_1, r_2, ..., r_k}) &lt;= u_i for 1 &lt;= i &lt;= m.
  </code></pre>
  
  <p>Note that the functions are smooth. Changing one element in {r_1, r_2, ..., r_k} will not change f_i({r_1, r_2, ..., r_k}) by much.  average and variance are two f_i that are commonly used. </p>
  
  <p>These are the m constraints that I need to satisfy.</p>
  
  <p>Moreover I want to do this so that the set of subsets I choose is uniformly distributed over the set of all subsets of size k that satisfy these m constraints. Not only that, but I want to do this in an efficient manner. How quickly it runs will depend on the density of solutions within the space of all possible solutions (if this is 0.0, then the algorithm can run forever).  (Assume that f_i (for any i) can be computed in a constant amount of time.)</p>
  
  <p>Note that n is large enough that I cannot brute-force the problem. That is, I cannot just iterate through all k-element subsets and find which ones satisfy the m constraints.</p>
  
  <p>Is there a way to do this?</p>
  
  <p>What sorts of techniques are commonly used for a CSP like this?  Can someone point me in the direction of good books or articles that talk about problems like this (not just CSPs in general, but CSPs involving continuous, as opposed to discrete values)?</p>