USE OF FUZZY LOGIC IN SOFTWARE ENGINEERING A.P.C. Sudeera Jayasekara WHAT IS FUZZY LOGIC? Fuzzy - “not clear, blurred” Fuzzy Logic is a form of approximate reasoning, that can be used to represent variation or imprecision in logic, by making use of natural language (NL) in logic. NL: If it is sunny and warm today, drive fast Traditional approach Fuzzy logic representation Fuzzification boolean sunny; boolean warm; // 70 F ° get the sunny; get the warm; if (sunny AND warm) { // speed is fast : 80mph } else { // speed is slow: 25 mph } Fuzzy sets Defuzzification 65 F° → Cool = 0.4, Warm= 0.7 Speed is 20% Slow and 70% Fast Speed = 63.8 mph (weighted mean) 25% Cover → Sunny = 0.8, Cloudy = 0.2 Rules WHAT IS SOFTWARE ENGINEERING? Software engineering is an engineering is concerned with all aspects of software production Sub disciplines in software engineering are, Project Management – the knowledge, techniques, and tools necessary to manage the development of software products Requirements Engineering – discovery , analysis, specification, and validation of requirements of software products Design – partitions the software into conceptual components and specifies their behavior Development – construction of software products through the use of programming languages Testing– checking that the software is defect free and according to requirement specification Deployment, Maintenance & Evolution – running the software and perform changes and enhancements WHY FUZZY LOGIC & SOFTWARE ENGINEERING? Topic is an area of current research Human communication 50% 50% Software engineering is communication Large number of linguistic quantifiers linguistic variables Qualitative: good, bad, best, worse Quantitative: around 20, nearly 5, below 7 Many links in the communication chain human resources analysts, developers, testers, business stakeholders, and end users Alteration thresholds, round off logical states Converted to Non linguistic variables classical two valued logic Significant loss of essential information failure most software projects fail Fuzzy logic could address the above problem because it can incorporate linguistic variables such that uncertainties can be modeled FL IN REQUIREMENT ENGINEERING & DESIGN Using FL in Object Oriented Analysis – OOA is composed of a population of interacting objects. Classes, attributes, operations are some object-oriented artifacts Rule of Candidate Class identification IF an entity in a requirement speciation is relevant AND can exist autonomously in the application domain THEN select it as a candidate class Classical OOA rules adopts only two quantization levels 0 or 1 “Software engineer needs to decide whether an entity in a requirement speciation is relevant or not ” However it can be perceived that an entity partially fulfills the relevance criterion, and conclude that the entity is substantially relevant, which cannot be represented by classical logic. Classical Formulation A quantization error occurs which is the difference between the perception of the software engineer and the quantization levels imposed by the two-valued logic-based rules. quantization error when N=2 V=1 FL IN REQUIREMENT ENGINEERING & DESIGN (cont.) Fuzzy Logic Formulation Define linguistic variables Relevance - relevance value Autonomy - autonomy value Candidate Class – candidate class relevance value Autonomy Dependent Partially dependent Fully Weakly Weakly Weakly Weakly Slightly Weakly Slightly Slightly Fairly Weakly Slightly Fairly Substantially Weakly Fairly Substantially Strongly Slightly Fairly Strongly Relevance Each element of the table represents the output value of a sub-rule, which is the relevance value of the candidate class being considered. As the quantization levels increases the quantization error decreases FUZZY LOGIC IN PROJECT MANAGEMENT Problem faced in project management is the elicitation of numerical inputs Obtaining these with any degree of confidence early in a project is not always feasible Related to this difficulty is the risk of precisely specified outputs from models leading to over promise. These problems can be seen as the collective failure of software measurements to represent the inherent uncertainties Benefit of fuzzy logic is the flexibility available in terms of the types of input and output variables Input variables can be expressed as simple fuzzy labels - a large number of entities in the data model, fuzzy numbers - about 250 entities, or using precise values - 265 entities. Similarly, the output variables can be expressed in the same way, as a label - a short development time, fuzzy number - about 400 developer-hours, or precise values - 378 developer hours. FUZZY LOGIC IN PROJECT MANAGEMENT (cont.) Fuzzy Logic could be used in size estimation which can be done in advance to make better plans, and assist in tracking progress 1. 2. 3. 4. 1 Concept of fuzzy logic in size estimation Gather size data on previously developed programs Divide the historical product size data into size ranges Compare the planned product with these prior products Based on this comparison, select the size that seems most appropriate for the new product 3 A file utility of 1,844 LOC log(1844) A file management program of 5,834 LOC log(5834) A personnel record keeping program of 6,845 LOC log(6845) A report generating package of 18,386 LOC log(18386) An inventory management program of 25,943 LOC log(25943) =3.266 =3.766 =3.835 =4.2645 =4.414 2 3.122 3.266 3.409 3.553 3.696 3.840 3.983 4.127 4.270 4.414 4.557 4 The new program is substantially more complex application than either the file management or personnel programs. It is not as complex as the inventory management program and appears to have significantly more function than the report package. conclude that the new program is in the lower end of very large or from 18 to 25 KLOC Limitations • • • • Requires a lot of data The estimators must be familiar with the historically developed programs Not useful for new program types Not useful for programs much larger or smaller than the historical data FUZZY LOGIC IN IMPLEMENTATION Fuzzy Logic could be used to evaluate reusability of Components A component is a reusable, self contained piece of software with well specified interface that is independent of any application To estimate reusability of Components, a relationship of the factors with reusability needs to be considered, the following are such factors Customizability Interface Complexity Understandability Commonality Portability These combined factors can be used to measure the reusability by using fuzzy logic CONCLUSION Uncertainty is inherent and inevitable in software development processes So, software uncertainties should be modeled and managed explicitly Fuzzy logic is well suited to a life-cycle approach to software development process with its ability to represent differing levels of uncertainty for inputs and outputs The ensuing consistency, effective communication, and economy make this an attractive modeling technique for such applications as effort estimation, requirement engineering and testing REFERENCES Shradhanand, Amarjeet Kaur, Dr. Satbir Jain Use of Fuzzy Logic In Software Development In Issues in Information Systems (Volume VIII, No. 2, 2007) pages 239-244 2007 Francesco Marcelloni, Mehmet Aksit Fuzzy logic-based object-oriented methods to reduce quantization error and contextual bias problems in software development In Fuzzy Sets and Systems (2004) pages 57–80 2004 Vidhu Bhardwaj, Dr. Rajesh Kumar Estimating Reusability of Software Components Using Fuzzy Logic MSc. Thesis 2010 QUESTIONS THANK YOU