logical operators - Boolean Expression Optimization For All AND Conditions -


i trying solve boolean expression optimization problem simple rule engine.

here trying do, lets if have following 5 conditions (where a,b,c,d,e,f complex boolean expressions)

if (a , b , c , d , e , f) do-1  if (a , b , c , d , e) do-2  if (a , b , c , d) do-3 if (a , b , c) do-4 if (a , b) do-5 

in case when execute these conditions in linear order

- evaluate "a" 5 times - evaluate "b" 5 times - evaluate "c" 4 times - evaluate "d" 3 times - evaluate "e" 2 times - evaluate "f" 1 time 

i make expression execution tree each expression (a,b,c,d,e,f) evaluated minimum number of times. perfect solution each expression evaluated once. think can achieved tree creation these conditions part of tree.

the tree may

if(a , b) do-5  {     if(c) do-4 {         if(d) do-3 {             if(e) do-2 {                 if(f) do-1              }         }     }        } 

my questions - how can make tree set of boolean expressions listed above?

related questions:

algorithm evaluating nested logical expression

converting expression conjunctive normal form twist

is useful in c# apply demorgan's theorem manually optimize boolean expressions in conditional statements (e.g. if conditions)


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -