1 / 16

Intelligent systems

Intelligent systems. Lecture 9 Main concepts of fuzzy logic and linguistic variables, LISP. Fuzzy logic is based on fuzzy sets. B. A. In classical set theory any element can to be member of set or not. Is(a, A) = 1 or 0, true or false. 0. 1. 1. 0. 0.5. In fuzzy set theory

tori
Télécharger la présentation

Intelligent systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intelligent systems Lecture 9 Main concepts of fuzzy logic and linguistic variables, LISP

  2. Fuzzy logic is based on fuzzy sets B A In classical set theory any element can to be member of set or not. Is(a, A) = 1 or 0, true or false 0 1 1 0 0.5 In fuzzy set theory any element can to be member of set with any uncertainty or confidence Is(a,A) = 0 or 1 or 0.5 or 0.126 or … from interval (0,1) This uncertainty is determined by membership function 0≤μA(a)≤1 1

  3. Main logical operations in fuzzy logic • Conjunction - μA&B(x) = min(μA(x), μB(y)) • Disjunction - μA/\B(x) = max(μA(x), μB(y)) • Negation – μ¬A(x) = 1 - μA(x)

  4. Linguistic variable Definition of linguistic variable When we consider a variable, in general, it takes numbers as its value. If the variable takes linguistic terms, it is called “linguistic variable”. • Definition(Linguistic variable) The linguistic variable is defined by • the following quintuple. • Linguistic variable = (x, T(x), U, G, M) x: • x - name of variable • T(x): set of linguistic terms which can be a value of the variable • U: set of universe of discourse which defines the characteristics of the • Variable • G: syntactic grammar which produces terms in T(x) • M: semantic rules which map terms in T(x) to fuzzy sets in U

  5. Example of linguistic variable

  6. Example of linguistic variable

  7. During inference it is needed to execute • two operations: • Fuzzification • Transformation from number to symbol • value of linguistic variable and • corresponding value of membership • function • 2. Defuzzification • Transformation from symbol value to number

  8. Features of fuzzy logic • In fuzzy logic, exact reasoning is viewed as a limiting case of approximate reasoning • In fuzzy logic, everything is a matter of degree • In fuzzy logic, knowledge is interpreted a collection of elastic or, equivalently, fuzzy constraint on a collection of variables • Inference is viewed as a process of propagation of elastic constraints • Any logical system can be fuzzified

  9. Features of language LISP • Program – S-expression and consists of S-expressions, e.g. (A (B C …) (S (G H …) K)) • The basic elements of s-expressions are lists and atoms. • S-expression may be interpreted as list (data structure) • Or function with arguments, e.g. (ADD (SUB 4 3) 6) return 7. S-expression may be evaluated and return value. • Some Info About Lisp Primitives • Atoms: evaluate to themselves. • Symbols: they are just names. They can evaluate to other values, Function arguments. • Lists: evaluate to a function call Predicates • Predicates are functions • Predicates return T or NIL (generally) • NIL is considered false

  10. Main functions for processing of lists • (CAR L) returns first element of list L • (CAR ‘(a b c)) returns atom a • (CDR L) returns tail of list L • (CDR ‘(a b c)) returns list (b c) • (CONS L1 L2) returns list including as first element L1 and tail L2 • (CONS ‘a ‘(b c)) returns (a b c) • (CONS ‘(a b) ‘(c d)) returns ((a b) c d) • (LIST a1 a2 …) returns list from a1, a2 … • (list ‘a 1 (+ 2 3)) returns (a 1 5)

  11. Similar to case of: Execution of sequence of operations: > (prog1 (setq x 2) (setq x (* x 2)) (setq x (* x 2)) (setq x (* x 2))) 2 > (prog2 (setq x 2) (setq x (* x 2)) (setq x (* x 2)) (setq x (* x 2))) 4 > (progn (setq x 2) (setq x (* x 2)) (setq x (* x 2)) (setq x (* x 2))) 16

  12. Example – calculation of sum from 0 to n Description of function: >(defun count (n) (do ((result n)) ;;initial value ((= n 0) result) ;;condition of finishing of loop (setq n (- n 1)) (setq result (+ result n)) ) ) COUNT Call: >(count 5) 15

  13. Example – recursive program of copy of list Description of function: >(defun listcopy (list) (cond ((null list) nil) ;;Condition of finishing of recursion (t (cons (car list) (listcopy (cdr list)))))) ;;recursion LISTCOPY Call: >(listcopy ‘(a b c)) (A B C)

  14. Trace >(trace listcopy) (LISTCOPY) >(listcopy '(a b)) Entering: LISTCOPY, Argument list: ((A B)) Entering: LISTCOPY, Argument list: ((B)) Entering: LISTCOPY, Argument list: (NIL) Exiting: LISTCOPY, Value: NIL Exiting: LISTCOPY, Value: (B) Exiting: LISTCOPY, Value: (A B) (A B)

  15. (defun play() ;{{{ (init) (setq hm-comment "\n") (setq hmstr "No shots") (ships) (do () ((or (= (car (aref ships 0)) 0) (= (cadr (aref ships 0)) 0))) (cls) (show) (princ "\n") (princ "Your shot: ") (princ hmstr) (princ "\n") (princ hm-comment)(princ "\n") (if (not hit) (if (hm-shot) () (progn (setq hm-comment '"That's wrong!\n") (setq kill t) ) ) (progn (setq hit nil) (princ "You are skipping this turn.") (get-key) ) ) (if (not hit)(al-shot)(setq hit nil)) ) (cls) (show) (if (= (car (aref ships 0)) 0) (princ "You're winner!!!") (princ "You're loser!!!") ) t );}}}

More Related