title: Finding the maximum sum of 11 elements from 480 elements with constraints
body: <p>I have a panda dataframe with columns that look like this:</p>
  <pre><code>   ict    |constraint1|constraint2|
   float(x) |     y     |     z     |
  </code></pre>
  <p>I have 480 rows in the dataframe, which is currently sorted by <code>ict</code>. I need to find the maximum possible sum of the <code>ict</code>s of 11 elements, then check if that set fulfils a criteria (e.g. <code>constraint1</code> can only equal <code>b</code> less than 5 times). If it doesn't fulfil the criteria, I need to find the next biggest possible sum of <code>ict</code>s of 11 elements.</p>
  <p>I currently have a function <code>check_ict(list1)</code> that checks the <code>ict</code> of 11 elements that are inputted as a list of dataframe row indexes. I also have a function <code>check_constraints(list1)</code> that checks if that same input fulfils the constraints. However I'm struggling to figure out how to find the 'next biggest possible sum of <code>ict</code>s'.</p>
  <p>As the data is sorted by <code>ict</code> already, I know the best possible combination is the 0th-10th row of the dataframe. The next best combination is the 0th-9th row + the 11th row. But after that, things get tricky. There's no obvious way to know if <code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12]</code> is bigger, or <code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11]</code>. And no obvious way to know what's the biggest after that.</p>
  <p>How do I continuously find the next best possible combination? There are <code>10^21</code> possible combinations of a set of 11 elements from 480 elements, so brute forcing is definitely not an option.</p>