Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to implement decision matrix in c#
    primarykey
    data
    text
    <p>I need to make a decision based on a rather large set of 8 co-dependent conditions. </p> <pre><code> | A | B | C | D | E | F | G | H -----------+---+---+---+---+---+---+---+--- Decision01 | 0 | 1 | - | 1 | 0 | 1 | - | 1 Decision02 | 1 | 0 | - | 0 | 0 | - | 1 | - ... Decision11 | 1 | 0 | 1 | 1 | 1 | - | 1 | 1 </code></pre> <p>Each of the conditions from A to H can be true (1), false (0) or non-relevant (-) for the decision.</p> <p>So with a given input of </p> <pre><code>A B C D E F G H 1 0 1 0 0 1 1 1 </code></pre> <p>it should evaluate to Decision02.</p> <p>The decisions are unambiguous so from any given set of input conditions it's clear which decision has to be made (and in a case that isn't covered by the decision matrix, an exception shall be thrown).</p> <p>The developer who worked before me on this project tried to implement this as a 500 line long nested-if behemoth which of course is buggy as hell and isn't maintainable.</p> <p>So I searched for the best way to implement such a piece of logic and I've come upon decision tables/lookup tables/control tables.</p> <p>I've found a lot of decision table generators, but not a single piece of code on how to implement the decision making process :(</p> <p>I can make the decision table in the underlying MSSQL database, or in code, or xml, or whatever it takes. I just need some pointers on how to implement this at all. </p> <p>What's the best practice to implement this logic? Dictionary? Multidimensional array? Something completely different?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload