Fuzzy Logic for Social Simulation using NetLogo UNIVERSITY OF BURGOS UNIVERSITY OF VALLADOLID UNIVERSITY OF WESTERN AUSTRALIA Marcos Almendres, Luis R. Izquierdo & Segismundo S. Izquierdo, Doina Olaru, Sharon Purchase & Geoffrey N. Soutar
Introduction to Fuzzy Logic An illustration of how to combine Agent-based modelling and Fuzzy Logic Discussion: Is this useful at all? Questions & Comments OUTLINE
Note our tolerance for imprecision: A tall, blonde, middle-aged guy with long hair who dresses casually is waiting for you at the lobby FIND a tall, blonde, middle-aged guy with long hair who dresses casually in the lobby FIND a TALL, BLONDE, MIDDLE-AGED guy with LONG hair who dresses CASUALLY Possible approach: Hard Thresholds. A person is considered TALL If and only if her height is at least x cm Motivation Clearly unsatisfactory
A CRISP set is one such that any element (in the universe of discourse) either belongs to the set, or it doesn’t, e.g. Set A = “People who have a height of 177 cm or more” Membership Person of Height 165 cm0 (NO) Person of Height 170 cm0 (NO) Person of Height 175 cm0 (NO) Person of Height 180 cm1 (YES) Person of Height 185 cm1 (YES) Person of Height 190 cm1 (YES) 177 Height (cm) Membership function of A (CRISP) Any particular person either belongs to the set A or not. 1 0 IF Height ≥ 177 cm THENyou belong to the set A, ELSE you do NOT belong to the set A Crisp sets vs. Fuzzy sets
TALL is a FUZZY concept and is best represented as a FUZZY SET. Fuzzy sets are generalisations of classical (crisp) sets. The degree to which x is a member of A is called the degree of membership of x in A. Membership Person of Height 165 cm0.2 Person of Height 170 cm0.5 Person of Height 175 cm0.7 Person of Height 180 cm0.8 Person of Height 185 cm0.9 Person of Height 190 cm Height (cm) Membership function of TALL (FUZZY) 1 0 Crisp sets vs. Fuzzy sets
a TALL, BLONDE, MIDDLE-AGED guy with LONG hair who dresses CASUALLY 177 Height (cm) TALL Brown Hair Colour BLONDE Yellow 50 Age (years) MIDDLE AGED 10 Length (cm) LONG HAIR Tailcoat Dress CASUAL Shorts Crisp sets vs. Fuzzy sets
50 Age (years) MIDDLE AGED 1 OLDYOUNG FUZZY SETS CAN OVERLAP Fuzzy sets
The degree of membership of x in A can be interpreted as the truth value of the proposition “x is a member of A” (and, for some concepts, “x is A”) 177 Height (cm) Membership function of TALL (FUZZY) 1 0 Fuzzy Set Theory Fuzzy Logic Degree of membership of x in TALL TRUTH( “x is TALL”) Partial membership Partial truth Fuzzy Set Theory Fuzzy Logic
Membership Function of NOT “YOUNG” = 1 - Membership Function “YOUNG” 50 Age (years) NOT “YOUNG” 1 OLD YOUNG Fuzzy Logic: Logical operators; NOT
To what extent is a 25-year-old guy with a height of 180 cm “Tall AND middle-aged”? 177 Height (cm) TALL 50 Age (years) MIDDLE AGED TRUTH( “x is Tall AND middle-aged” ) = MIN ( TRUTH(“x is Tall”), TRUTH(“x middle-aged”) ) = MIN (0.8, 0.4) = 0.4 Operators other than MIN can be legitimally used (as long as they satisfy some common-sense requirements, i.e. T-norms) Fuzzy Logic: Logical operators; AND
To what extent is a 25-year-old guy with a height of 180 cm “Tall OR middle-aged”? 177 Height (cm) TALL 50 Age (years) MIDDLE AGED Operators other than MAX can be legitimally used (as long as they satisfy some common-sense requirements, i.e. T-conorms) Fuzzy Logic: Logical operators; OR TRUTH( “x is Tall OR middle-aged” ) = MAX ( TRUTH(“x is Tall”), TRUTH(“x middle-aged”) ) = MAX (0.8, 0.4) = 0.4
RULE 1: IF (Tall AND Young) THEN (suitability for the University Basketball team is High) To what extent the consequent of this rule applies to a 25-year-old guy with a height of 180 cm? 177 Height (cm) TALL 50 Age (years) YOUNG Suitability HIGH AND THEN IF Operators other than TRUNCATE can be legitimally used The interpolation method: IF-THEN rules
RULE 2: IF (Short OR Old) THEN (suitability for the University Basketball team is Low) To what extent the consequent of this rule applies to a 25-year-old guy with a height of 180 cm? 177 Height (cm) SHORT 50 Age (years) OLD Suitability OR THEN IF LOW Other operators other than TRUNCATE can be legitimally used The interpolation method: IF-THEN rules
To what extent a 25-year-old guy with a height of 180 cm is suitable for the job, given the knowledge base composed by RULE 1 and RULE 2? 177 Height (cm) SHORT 50 Age (years) OLD Suitability OR THEN IF 177 Height (cm) TALL 50 Age (years) YOUNG Suitability AND THEN IF Suitability RULE AGGREGATION: MAX (Upper Envelope) Other aggregation operators other than MAX can be legitimally used The interpolation method: Rule aggregation
To what extent a 25-year-old guy with a height of 180 cm is suitable for the job, given the knowledge base composed by RULE 1 and RULE 2? 177 Height (cm) SHORT 50 Age (years) OLD Suitability OR THEN IF 177 Height (cm) TALL 50 Age (years) YOUNG Suitability AND THEN IF Suitability DEFUZZIFICATION: Centre of Gravitiy RULE AGGREGATION: MAX (Upper Envelope) 8.9 Other defuzzification operators other than CoG can be legitimally used The interpolation method: Defuzzification
To what extent a 25-year-old guy with a height of 180 cm is suitable for the job, given the knowledge base composed by RULE 1 and RULE 2? 177 Height (cm) SHORT 50 Age (years) OLD 180 cm 25 years Suitability OR THEN IF 177 Height (cm) TALL 50 Age (years) YOUNG Suitability AND THEN IF Suitability DEFUZZIFICATION: Centre of Gravitiy RULE AGGREGATION: MAX (Upper Envelope) 8.9 RESHAPING OF CONSEQUENTS AGGREGATION AND DEFUZZIFICATION CONSISTENCY BTW FACTS AND ANTECEDENTS Suitability Score The interpolation method: The whole thing
To what extent a 25-year-old guy with a height of 180 cm is suitable for the job, given the knowledge base composed by RULE 1 and RULE 2? 180 cm 25 years 8.9 RESHAPING OF CONSEQUENTS Suitability Score RULE 1: IF (Tall AND Young) THEN (suitability for the job is High) RULE 2: IF (Short OR Old) THEN (suitability for the job is Low) AGGREGATION AND DEFUZZIFICATION CONSISTENCY BTW FACTS AND ANTECEDENTS The interpolation method: The whole thing Height Age Suitability
Introduction to Fuzzy Logic An illustration of how to combine Agent-based modelling and Fuzzy Logic Discussion: Is this useful at all? Questions & Comments OUTLINE
1. THE TOUR TEMPERATURE PRICE t = 0
1. THE TOUR TEMPERATURE PRICE 2. EVALUATION OF THE TOUR t = 0
To what extent would you recommend the tour, given the knowledge base? 0.72 Probability I will recommend IF (Temperature is nice AND Price is cheap), THEN it is likely that I will recommend. IF (Temperature is OK AND Price is reasonable), THEN I may or may not recommend. IF (Temperature is extreme AND Price is expensive), THEN it is unlikely that I will recommend. THE TOUR The interpolation method: The whole thing RESHAPING OF CONSEQUENTS AGGREGATION AND DEFUZZIFICATION CONSISTENCY BETWEEN FACTS AND ANTECEDENTS
1. THE TOUR Visitors at time t TEMPERATURE PRICE 2. EVALUATION OF THE TOUR (Attendants to the last n tours)... POTENTIAL RECOMMENDERS t = 0
1. THE TOUR Visitors at time t TEMPERATURE PRICE 2. EVALUATION OF THE TOUR 3. RECOMMENDATIONS (maximum 1 per person at a time) (Attendants to the last n tours)... POTENTIAL RECOMMENDERS t = 0
1. THE TOUR 4. RECOMMENDED AGENTS Visitors at time t TEMPERATURE PRICE 2. EVALUATION OF THE TOUR 3. RECOMMENDATIONS (maximum 1 per person at a time) (Attendants to the last n tours)... POTENTIAL RECOMMENDERS t = 0
1. THE TOUR 4. RECOMMENDED AGENTS Visitors at time t Maximum group size TEMPERATURE PRICE 2. EVALUATION OF THE TOUR 3. RECOMMENDATIONS (maximum 1 per person at a time) (Attendants to the last n tours)... POTENTIAL RECOMMENDERS t = 0
1. THE TOUR 4. RECOMMENDED AGENTS Visitors at time t Visitors at time t – 1 Maximum group size TEMPERATURE PRICE 2. EVALUATION OF THE TOUR 3. RECOMMENDATIONS (maximum 1 per person at a time) (Attendants to the last n tours)... POTENTIAL RECOMMENDERS t = 1...
1. THE TOUR 4. RECOMMENDED AGENTS Visitors at time t... Visitors at time t – 1 Maximum group size TEMPERATURE PRICE 2. EVALUATION OF THE TOUR RECOMMENDATIONS (maximum 1 per person at a time) Visitors at time t – n + 1 (Attendants to the last n tours)... POTENTIAL RECOMMENDERS Out t = n...
Introduction to Fuzzy Logic An illustration of how to combine Agent-based modelling and Fuzzy Logic Discussion: Is this useful at all? Questions & Comments OUTLINE
It can be..., if done rigorously. Both modelling approaches help to formalise models expressed in natural language. ABM: Individual characteristics and interactions FL: Imprecise concepts expressed in natural language. ABM + FL: Individuals may operate according to their own fuzzy concepts and fuzzy rules Potential uses: Robustness and heterogeneity. Careful! The interpolation method is not logical deductive inference! Is this useful?
QUESTIONS AND COMMENTS Thank you! Q & A Acknowledgements: Part of the “Modelling Network Innovation Performance Capability: A Multidisciplinary Approach” – DP