title: Optimization with discrete parameters in Matlab
body: <p>I have 12 sets of vectors (about 10-20 vectors each) and i want to pick one vector of each set so that a function f that takes the sum of these vectors as argument is maximized. In addition i have constraints for some components of that sum.  </p>
  
  <p>Example:  </p>
  
  <pre><code>a_1 = [3 2 0 5], a_2 = [3 0 0 2], a_3 = [6 0 1 1], ... , a_20 = [2 12 4 3]
  b_1 = [4 0 4 -2], b_2 = [0 0 1 0], b_3 = [2 0 0 4], ... , b_16 = [0 9 2 3]
  ...
  l_1 = [4 0 2 0], l_2 = [0 1 -2 0], l_3 = [4 4 0 1], ... , l_19 = [3 0 9 0]
  
  s = [s_1 s_2 s_3 s_4] = a_x + b_y + ... + l_z
  </code></pre>
  
  <p>Constraints:</p>
  
  <pre><code>s_1 &gt; 40
  s_2 &lt; 100
  s_4 &gt; -20
  </code></pre>
  
  <p>Target: Chose x, y, ... , z to maximize f(s):</p>
  
  <pre><code>f(s) -&gt; max
  </code></pre>
  
  <p>Where f is a nonlinear function that takes the vector s and returns a scalar.</p>
  
  <p>Bruteforcing takes too long because there are about 5.9 trillion combinations, and since i need the maximum (or even better the top 10 combinations) i can not use any of the greedy algorithms that came to my mind.</p>
  
  <p>The vectors are quite sparse, about 70-90% are zeros. If that is helping somehow ...?</p>
  
  <p>The Matlab Optimization toolbox didnt help either since it doesnt much support for discrete optimization.</p>