24 condition action analysis and event condition action
play

24) Condition-Action-Analysis and Event-Condition-Action-Based - PowerPoint PPT Presentation

Fakultt Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie Prof. Amann - Softwaretechnologie II 24) Condition-Action-Analysis and Event-Condition-Action-Based Design Prof. Dr. U. Amann 1. Structured decisions:


  1. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 24) Condition-Action-Analysis and Event-Condition-Action-Based Design Prof. Dr. U. Aßmann 1. Structured decisions: decision diagrams and decision tables) Technische Universität Dresden 2. Binary decision diagrams (BDD) Institut für Software- und And Ordered DD Multimediatechnik 3. Model Checking Gruppe Softwaretechnologie 4. Variability of CA http://st.inf.tu- dresden.de/teaching/swt2 5. Event-Condition Action Design Version 16-1.1, 14.01.17 6. Extensibility of ECA Prof. U. Aßmann 1

  2. Obligatory Reading Softwaretechnologie II 2 Balzert, Kapitel über Entscheidungstabellen ► Ghezzi 6.3 Decision-table based testing ► Pfleeger 4.4, 5.6 ► Stankovski, V., Trnkoczy, J. Application of decision trees to smart homes. In Ø Designing Smart Homes - The Role of Artificial Intelligence, J. C. Augusto and C. D. Nugent, Eds., Lecture Notes in Artificial Intelligence, vol. 4008, Springer Verlag, 2006, 132–145. Randal E. Bryant. Graph-based algorithms for Boolean function Ø manipulation. IEEE Transactions on Computers, C-35:677-691, 1986. Red Hat. JBoss Enterprise BRMS Platform 5: JBoss Rules 5 Reference Guide. Ø (lots of examples for ECA Drools) • http://docs.redhat.com/docs/en- US/JBoss_Enterprise_BRMS_Platform/5/pdf/JBoss_Rules_5_Reference_Guide/JBos s_Enterprise_BRMS_Platform-5-JBoss_Rules_5_Reference_Guide-en-US.pdf Prof. U. Aßmann

  3. References Softwaretechnologie II 3 Decision algebra: ► Danylenko, Antonina, Lundberg, Jonas, Löwe, Welf. Decisions: Algebra and ► Implementation. In Machine Learning and Data Mining in Pattern Recognition. Perner, Petra(ed.) Lecture Notes in Computer Science, 6871, Springer 2011. http://dx.doi.org/10.1007/978-3-642-23199-5_3 ECA state of the art ► REWERSE-DEL-2004-I5-D1 ► José Júlio Alferes, James Bailey, Mikael Berndtsson, François Bry, Jens Dietrich, Alex Kozlenkov, Wolfgang May, Paula-Lavinia P ă trânjan, Alexandre Miguel Pinto, Michael Schroeder, and Gerd Wagner: Wolfgang May (editor): State-of-the-art on evolution and reactivity. http://rewerse.net/publications/rewerse-publications.html#REWERSE-DEL-2004- I5-D1 http://en.wikipedia.org/wiki/Complex_event_processing ► ECA Engines ► Websphere Jrules engine http://www-01.ibm.com/software/integration/business- ► rule-management/decision-server/ Prof. U. Aßmann JBOSS Rules http://www.jboss.org/drools ► http://docs.redhat.com/docs/de-DE/JBoss_Enterprise_BRMS_Platform/index.html ►

  4. Goal Softwaretechnologie II 4 Ø Decision analysis (Condition analysis) is a very important method to analyze complex decisions Ø Understand that several views on a decision tree exist (tables, BDD, OBDD) Ø Condition-action analysis can also be employed for requirements analysis Ø Understand how to describe the control-flow of methods and procedures and their actions on the state of a program Ø Event-condition-action-based design (ECA-based design) relies on condition-action analysis Ø Understand that model checking is a technology with future Prof. U. Aßmann

  5. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 24.1 DECISION ANALYSIS WITH DECISION TREES AND TABLES (CONDITION-ACTION ANALYSIS) Prof. U. Aßmann 5

  6. A House-Selling Expert System Softwaretechnologie II 6 Ok, I do not like bungalows, but my wife does not like that the car stands in Ø free space in winter. Hmm... I rather would like to have the half double house... But we need anyway 2 floors, because I need this space for my hobbies. My wife also would like a garden…. How does the system analyze the customers requirements and derive ► appropriate proposals? Prof. U. Aßmann

  7. Decision Analysis (Condition-Action Analysis) Softwaretechnologie II 7 Ø Decision analysis is necessary when complex, intertwined decisions should be made • In requirements analysis and elicitation • In complex business cases, described with business rules • In testing, for specification of complex test cases Ø Decision analysis can be made in a decision algebra • Boolean functions and their representations (implementations): § Truth tables, decision trees, decision tables § Binary decision diagrams (BDD), ordered BDD (OBDD) • Static single assigment form (SSA) (not treated here) • Lattice theory, such as formal concept analysis (FCA) (not treated here) Ø Decision trees and tables collect actions based on conditions Ø Condition action analysis is a decision analysis that results in actions Ø A simple form of event-condition-action (ECA) rules Ø However, without events, only conditions Prof. U. Aßmann Design Question: Which conditions provoke which actions?

  8. Decision Trees Softwaretechnologie II 8 Ø Decisions can be analyzed with a decision tree , a simple form of a decision algebra Ø A trie (Präfixbaum) is a tree which has an edge marking Ø Every path in the trie assembles a word from a language of the marking Ø A trie on lB = {0,1} is called decision tree Ø Paths denote sequences of decisions (a set of vectors over lB). A path corresponds to a vector over lB Ø A set of actions, each for one sequence of decisions Ø Sequences of decisions can be represented in a path in the decision tree e 1 0 0 1 1 0 1 0 00 01 10 11 Prof. U. Aßmann 1 A4 A5 0 A3 000 001 A1 A2

  9. Decision Trees with Code Actions Softwaretechnologie II 9 The action may be code ► The inner nodes of same tree layer correspond to a condition E[i] ► Then, a Trie is isomorphic to an If-then-else cascade ► e E0 if (E0) then // case E0 === true 1 0 if (E1) then E1 0 1 if(E2) then A5 1 0 1 0 else A4 E2 else // case E0 === false 00 01 10 11 1 if (E1) then 0 A4 A5 A3 E3 if(E2) then A3 000 001 else A1 A2 Prof. U. Aßmann if (E3) then A2 else A1

  10. Extensibility of Decision Trees Softwaretechnologie II 10 Decision Trees can be completed by new alternatives Ø Decision Trees can be extended by new decisions (variables) Ø e E0 1 0 E1 0 1 1 0 1 0 E2 00 01 10 11 1 1 1 1 0 0 0 0 E3 (complete) 110 111 000 001 011 101 010 101 1 1 0 0 New E4 A41 A4 A42 A4 A5 A53 A3 A31 A1 A1 A2 A2 (incomplete) 0110 0111 1100 1101 Prof. U. Aßmann A5 A51 A5 A52 A32 A3 A3 A33 Extensibility Question: Which further conditions provoke which further actions?

  11. Decision Tables Softwaretechnologie II 11 An alternative representation of decision trees are decision tables ► Conditions and actions can be entered in a table ► Boolean Condition E0 yes yes no no cross product Condition E1 yes no yes no Multiple choice Action A1 X X quadrant Action A2 X X e E0 1 0 E1 0 1 1 0 1 0 Prof. U. Aßmann 00 01 10 11 A2 A1 A2 A1

  12. Process: How to Construct A Decision Table Softwaretechnologie II 12 1) Elaborate decisions 2) Elaborate actions 3) Enter into table 4) Elaborate : Construct a cross boolean product as upper right quadrant (set of boolean vectors) 5) Elaborate: Construct a multiple choice quadrant (lower right) by associating actions to boolean vectors 6) Consolidate Coalesce yes/no to “doesn’t matter” ■ Introduce Else rule ■ Prof. U. Aßmann

  13. What Students Should Do to Professors After Exams Softwaretechnologie II 13 Points <= 30 yes yes yes yes No No No no > 50 < Points yes yes no no yes yes no no St. Francophil? yes no yes no yes no yes No Student pays a X X Bordeaux Professor pays a X Bordeaux Professor pays a X beer Student pays a X Prof. U. Aßmann beer Professor drinks a X X X beer 13

  14. Common Columns Can Be Folded Softwaretechnologie II 14 Points <= 30 yes - yes no no no > 50 < Points yes no no yes yes no St. Francophil? - yes no yes no no Student pays a X Bordeaux Professor pays a X Bordeaux Professor pays a X beer Student pays a X beer Professor drinks a X X beer Prof. U. Aßmann 14

  15. Or Abbreviated to Else Action (Consolidated Decision Table) Softwaretechnologie II 15 Points <= 30 - yes No No Else > 50 < Points no no yes yes Francophil? yes no yes no Student pays a X Bordeaux Professor pays a X Bordeaux Professor pays a X beer Student pays a X beer Professor drinks a X Prof. U. Aßmann beer 15

  16. Applications of Decision Tables and Trees Softwaretechnologie II 16 Ø Requirements analysis: • Deciding (decision analysis, case analysis) • Complex case distinctions (more than 2 decisions) Ø Design: • Describing the behavior of methods • Describing business rules Ø Before programming if-cascades, better make first a nice decision tree or table Ø Formal design methods Ø CASE tools can generate code automatically Ø Configuration management of product families: Ø Decisions correspond here to configuration variants Ø Processor=i486? Ø System=linux? Ø Same application as #ifdefs in C preprocessor Prof. U. Aßmann

  17. Fakultät Informatik - Institut Software- und Multimediatechnik - Softwaretechnologie – Prof. Aßmann - Softwaretechnologie II 24.2 NORMALIZING CONTROL FLOW WITH NORMALIZED BDD Prof. U. Aßmann 17

Recommend


More recommend