title: Which Rule engine to use?
body: <p>I have a requirement for handling multiple rules and select a value as per the matching criteria.</p>
  
  <p>The rule could be </p>
  
  <p>case-1</p>
  
  <pre><code>----------------------------------------
  | A  | B  | C  | D  | priority | value |
  ----------------------------------------
  | a1 | b1 |    | c1   |  1       | 250 |
  ----------------------------------------
  |      | b2 | c2 | d2 |  3       | 200 |
  ----------------------------------------
  | a3   | b3 | c3 | d3 |  2       | 100 |
  ----------------------------------------
  </code></pre>
  
  <p>As per the above defined rules, we look for highest number of matching criteria first, and select the value of that rule, (i.e rule with value "100")</p>
  
  <p>case-2</p>
  
  <pre><code>----------------------------------------
  | A  | B  | C  | D  | priority | value |
  ----------------------------------------
  | a1 | b1 |    | c1 |  1       | 100   |
  ----------------------------------------
  |    | b2 | c2 | d2 |  2       | 200   |
  ----------------------------------------
  </code></pre>
  
  <p>If two conflicting rules found with same number of matching criteria, then look for priority, and select rule with highest priority. In this case (Rule with value "100".</p>
  
  <p>case-3</p>
  
  <pre><code>----------------------------------------
  | A  | B  | C  | D  | priority | value |
  ----------------------------------------
  | a1 | b1 |    | c1 |  3       | 100   |
  ----------------------------------------
  |    | b2 | c2 | d2 |  2       | 200   |
  ----------------------------------------
  | a3 | b3 | c3 | d3 |  1       | 300   |
  ----------------------------------------
  | a4 | b4 | c4 | d4 |  1       | 400   |
  ----------------------------------------
  </code></pre>
  
  <p>In this case, if more than one rule with same number of matching criteria found and with same priority then select the rule with highest value (i.e Rule4 with value 400).</p>
  
  <p>I know it looks very specific, but i tried to google but couldn't came across any rule engine which can be used in this case.
  Please help me out with some pointers and ideas to start with.</p>