SlideShare a Scribd company logo
CLIPS: Expert System Shell Motaz K. Saad College of IT – CS Dept.
What is expert system? AN EXPERT SYSTEM (ES) IS  A COMPUTER PROGRAM DESIGNED TO SIMULATE THE PROBLEM-SOLVING BEHAVIOR OF AN EXPERT IN A NARROW DOMAIN OR DISCIPLINE.
What is expert system? ARTIFICIAL INTELLIGENCE PROGRAMS Exhibit intelligent behavior by skillful application of heuristics make domain knowledge explicit and separate from the rest of the system KNOWLEDGE-BASED SYSTEMS Apply expert knowledge to difficult, real world problems EXPERT SYSTEMS
The structure of an expert system KNOWLEDGE BASE  Domain Knowledge  INFERENCE ENGINE  General  problem-solving  knowledge FACTS RULES INTERPRETER SCHEDULER
Facts and Rules A fact is a piece of information such as (color green) Facts on their own are of only limited use. The application of rules is necessary to develop a program capable of some useful function.
Rules A rule is a formal way of specifying a recommendation, directive, or advice A rule is expressed as  IF  premise  THEN  conclusion or IF  condition  THEN  action
Drawing inferences from rules Forward chaining In forward chaining, the reasoning proceeds from the IF part of the rule to the THEN part. Backward chaining In backward chaining, the reasoning proceeds from the THEN part to the IF part.
Expert system building tool Programming language An expert system can be implemented using a general purpose programming language. However, the programming languages LISP and PROLOG are typically used in expert systems implementation,  in particular Artificial Intelligence applications. This is due to their capabilities in handling symbolic data efficiently. Shells A shell consists mainly of an inference engine and an editor to assist developers in building their knowledge base.
Shells vs. Programming languages
Shells vs. Programming languages
CLIPS: Expert System Shell Rule-based expert systems are often known as  production systems  (CLIPS actually stands for C Language Integrated Production System).
The CLIPS Programming Tool History of CLIPS Influenced by OPS5 and ART Implemented in C for efficiency and portability Developed by NASA, distributed & supported by COSMIC Runs on PC, Mac, also under UNIX and VAX VMS CLIPS provides mechanisms for expert systems A top-level interpreter Production rule interpreter Object oriented programming language LISP-like procedural language
Components of CLIPS Rule-Based Language Can create a fact list Can create a rule set An inference engine matches facts against rules Object-Oriented Language Can define classes Can create different sets of instances Special forms allow you to interface rules and objects
Defining Facts Facts can be asserted CLIPS> (assert (today is sunday)) <Fact-0> Facts can be listed CLIPS> (facts) f-0 (today is sunday) Facts can be retracted CLIPS>  (retract 0) CLIPS> (facts)
Managing Facts Clearing all facts CLIPS> (clear) CLIPS> (facts) Grouping facts - typically in a file (“today.clp”) (deffacts today ; can be cleared with (undeffacts today) (today is sunday) (weather is warm) ) After loading facts, assert with (reset)
Defining Rules Rules have the following structure (defrule rule-name optional-comment optional-declaration condition ... condition => action ... action )
An Example CLIPS Rule (defrule sunday “Things to do on Sunday” (salience 0) ; salience in the interval [-10000, 10000] (today is Sunday) (weather is sunny) => (assert (chore wash car)) (assert (chore chop wood)) ) So, if fact list contains conditions, add assertions
Getting the Rules Started The reset command creates a special fact CLIPS> (load “today.clp”) CLIPS> (facts) CLIPS> (reset) CLIPS> (facts) f-0 (initial-fact) ... (defrule start (initial-fact) => (printout t “hello”) )
Tracing & Recording Things Watch command can watch facts (and rules) CLIPS> (watch facts) CLIPS> (reset) ==> f-0 (initial-fact) CLIPS> (retract 0) <== f-0 (initial-fact) Contents of dialog window can be sent to file CLIPS> (dribble-on “dribble.clp”) ; any file name will do ... CLIPS> (dribble-off “dribble.clp”)
Variables & Pattern Matching Variables make rules more applicable (defrule pick-a-chore (today is ?day) (chore is ?job) => (assert (do ?job on ?day)) ) If conditions are matched, then bindings are used
Retracting Facts from a Rule (defrule do-a-chore (today is ?day) ; ?day must have a consistent binding ?chore <- (do ?job on ?day) => (printout t ?job “ done”) (retract ?chore) ) We must assign a variable to item for retraction
Pattern Matching Details One-to-one matching (do ?job on ?day) (do washing on monday) Use of wild cards (do ? ? monday) (do ? on ?) (do ? ? ?day) (do $?) (do $? monday) (do ?chore $?when)
Using Templates (deftemplate student “a student record” (slot name (type STRING)) (slot age (type NUMBER) (default 18))) CLIPS> (assert (student (name fred))) (defrule print-a-student (student (name ?name) (age ?age)) => (printout t name? “ is “ ?age) )
Defining Functions in CLIPS Uses a LISP or Scheme-like syntax (deffunction function-name (arg ... arg) action ... action) (deffunction hypotenuse (?a ?b) (sqrt (+ (* ?a ?a) (* ?b ?b)))) (deffunction initialize () (clear) (assert (today is sunday)))
Defining Classes & Instances Defining the class CAR (defclass car (is-a user) (name) (made-by)) Defining an instance of CAR (make-instance corvette of car (made-by chevrolet))
Concrete & Abstract Classes Some classes only exist for inheritance purposes Person Man Woman Jack Jill
Managing Instances Commands to display instances CLIPS> (instances) [corvette] of car CLIPS> (send [corvette] print) [corvette] of car (made-by chevrolet) Command to group instances (in a file) (definstances (corvette of car (made-by chevrolet)) (thunderbird of car (made-by ford)))
Clearing & Resetting Instances Deleting an instance CLIPS> (send [corvette] delete) Deleting all instances CLIPS> (unmake-instance *) Resetting creates an initial object CLIPS> (reset) CLIPS> (instances) [initial-object] of INITIAL-OBJECT
Message Passing The SEND function (send [instance] message arg ... arg) Converting from symbols to names CLIPS> (symbol-to-instance-name corvette) [corvette] This is useful when SENDing from inside a rule
Limitations of CLIPS Single level rule sets in LOOPS, you could arrange rule sets in a hierarchy, embedding one rule set inside another Loose coupling of rules and objects rules can communicate with objects via message passing rules cannot easily be embedded in objects, as in Centaur CLIPS has no explicit agenda mechanism the basic control flow is forward chaining to implement other kinds of reasoning you have to manipulate tokens in working memory
Alternatives to CLIPS Eclipse has same syntax as CLIPS (both are based on ART) supports goal-driven (i.e., backwards) reasoning has a truth maintenance facility for checking consistency can be integrated with C++ and dBase new extension RETE++ can generate C++ header files NEXPERT OBJECT another rule- and object-based system has facilities for designing graphical interfaces has a ‘script language’ for designing user front-end written in C, runs on many platforms, highly portable
The End! http://motaz.saad.googlepages.com

More Related Content

PPTX
PDF
5. probabilidad conjunta ejercicios resueltos
PDF
Expert System With Python -1
PPT
Media Mediana Y Moda de Datos Agrupados
PPTX
Fuzzy Logic and Neural Network
PPTX
daa-unit-3-greedy method
PDF
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
PDF
Data Science Introduction
5. probabilidad conjunta ejercicios resueltos
Expert System With Python -1
Media Mediana Y Moda de Datos Agrupados
Fuzzy Logic and Neural Network
daa-unit-3-greedy method
Unit 2,3,4 _ Internet of Things A Hands-On Approach (Arshdeep Bahga, Vijay Ma...
Data Science Introduction

What's hot (20)

PPTX
Unit1 principle of programming language
PPT
Predicate logic_2(Artificial Intelligence)
PPTX
Branching statements
PDF
Logic programming (1)
PPT
Asymptotic notation
PPTX
HCI Models of System
PPTX
5. phases of nlp
PPTX
Syntax Analysis in Compiler Design
PPTX
Introduction TO Finite Automata
PPT
Algorithm analysis
PPTX
Turing machine
PDF
Oops concepts || Object Oriented Programming Concepts in Java
PPT
Unit 3 principles of programming language
PPTX
Introduction to oop
PDF
Algorithms Lecture 2: Analysis of Algorithms I
PPTX
System call
PPTX
Context free grammar
PPTX
Chapter-7 Relational Calculus
PPT
Dbms ii mca-ch5-ch6-relational algebra-2013
Unit1 principle of programming language
Predicate logic_2(Artificial Intelligence)
Branching statements
Logic programming (1)
Asymptotic notation
HCI Models of System
5. phases of nlp
Syntax Analysis in Compiler Design
Introduction TO Finite Automata
Algorithm analysis
Turing machine
Oops concepts || Object Oriented Programming Concepts in Java
Unit 3 principles of programming language
Introduction to oop
Algorithms Lecture 2: Analysis of Algorithms I
System call
Context free grammar
Chapter-7 Relational Calculus
Dbms ii mca-ch5-ch6-relational algebra-2013
Ad

Viewers also liked (20)

PPTX
Ai lecture 07 inference engine
PPTX
Inference engine
PPT
The Role Of Ontology In Modern Expert Systems Dallas 2008
PDF
CLIPS Basic Student Guide
PPTX
Expert System - Automated Traffic Light Control Based on Road Congestion
PPT
Introduction To Mycin Expert System
PDF
Expert system neural fuzzy system
PPT
EXPERT SYSTEM FOR LOAN BY BANK
PPT
Intel 64bit Architecture
PDF
مقدمة في تكنواوجيا المعلومات
PDF
Hewahi, saad 2006 - class outliers mining distance-based approach
PPT
3.7 outlier analysis
PPT
Assembly Language Lecture 5
PDF
Browsing The Source Code of Linux Packages
PDF
Cross Language Concept Mining
PDF
Class Outlier Mining
PPT
Knowledge discovery thru data mining
PPT
OS Lab: Introduction to Linux
PDF
Browsing Linux Kernel Source
PDF
Open Source Business Models
Ai lecture 07 inference engine
Inference engine
The Role Of Ontology In Modern Expert Systems Dallas 2008
CLIPS Basic Student Guide
Expert System - Automated Traffic Light Control Based on Road Congestion
Introduction To Mycin Expert System
Expert system neural fuzzy system
EXPERT SYSTEM FOR LOAN BY BANK
Intel 64bit Architecture
مقدمة في تكنواوجيا المعلومات
Hewahi, saad 2006 - class outliers mining distance-based approach
3.7 outlier analysis
Assembly Language Lecture 5
Browsing The Source Code of Linux Packages
Cross Language Concept Mining
Class Outlier Mining
Knowledge discovery thru data mining
OS Lab: Introduction to Linux
Browsing Linux Kernel Source
Open Source Business Models
Ad

Similar to Introduction to CLIPS Expert System (20)

PDF
L04 Software Design Examples
PPT
SystemVerilog OOP Ovm Features Summary
ODP
Patterns in Python
 
PDF
Twins: Object Oriented Programming and Functional Programming
PDF
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
PPTX
ScalaDays 2013 Keynote Speech by Martin Odersky
PPTX
A brief overview of java frameworks
PPT
Threaded Programming
PPT
Groovy Introduction - JAX Germany - 2008
PPT
Linq To The Enterprise
PPT
Linq 1224887336792847 9
ODP
Practical catalyst
PDF
TWINS: OOP and FP - Warburton
PPTX
Clojure And Swing
PPT
PPT
r,rstats,r language,r packages
PPT
닷넷 개발자를 위한 패턴이야기
PPTX
Eclipse Modeling Framework
PDF
Beyond Breakpoints: A Tour of Dynamic Analysis
PDF
You Might Just be a Functional Programmer Now
L04 Software Design Examples
SystemVerilog OOP Ovm Features Summary
Patterns in Python
 
Twins: Object Oriented Programming and Functional Programming
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
ScalaDays 2013 Keynote Speech by Martin Odersky
A brief overview of java frameworks
Threaded Programming
Groovy Introduction - JAX Germany - 2008
Linq To The Enterprise
Linq 1224887336792847 9
Practical catalyst
TWINS: OOP and FP - Warburton
Clojure And Swing
r,rstats,r language,r packages
닷넷 개발자를 위한 패턴이야기
Eclipse Modeling Framework
Beyond Breakpoints: A Tour of Dynamic Analysis
You Might Just be a Functional Programmer Now

More from Motaz Saad (8)

PPTX
Structured Vs, Object Oriented Analysis and Design
PPT
The x86 Family
PPT
Assembly Language Lecture 4
PPT
Assembly Language Lecture 3
PPT
Assembly Language Lecture 2
PPT
Assembly Language Lecture 1
PPT
Introduction to Assembly Language
PDF
Data Mining and Business Intelligence Tools
Structured Vs, Object Oriented Analysis and Design
The x86 Family
Assembly Language Lecture 4
Assembly Language Lecture 3
Assembly Language Lecture 2
Assembly Language Lecture 1
Introduction to Assembly Language
Data Mining and Business Intelligence Tools

Recently uploaded (20)

PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
KodekX | Application Modernization Development
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Electronic commerce courselecture one. Pdf
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Programs and apps: productivity, graphics, security and other tools
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation_ Review paper, used for researhc scholars
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
KodekX | Application Modernization Development
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
Electronic commerce courselecture one. Pdf
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Network Security Unit 5.pdf for BCA BBA.
MYSQL Presentation for SQL database connectivity
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf

Introduction to CLIPS Expert System

  • 1. CLIPS: Expert System Shell Motaz K. Saad College of IT – CS Dept.
  • 2. What is expert system? AN EXPERT SYSTEM (ES) IS A COMPUTER PROGRAM DESIGNED TO SIMULATE THE PROBLEM-SOLVING BEHAVIOR OF AN EXPERT IN A NARROW DOMAIN OR DISCIPLINE.
  • 3. What is expert system? ARTIFICIAL INTELLIGENCE PROGRAMS Exhibit intelligent behavior by skillful application of heuristics make domain knowledge explicit and separate from the rest of the system KNOWLEDGE-BASED SYSTEMS Apply expert knowledge to difficult, real world problems EXPERT SYSTEMS
  • 4. The structure of an expert system KNOWLEDGE BASE Domain Knowledge INFERENCE ENGINE General problem-solving knowledge FACTS RULES INTERPRETER SCHEDULER
  • 5. Facts and Rules A fact is a piece of information such as (color green) Facts on their own are of only limited use. The application of rules is necessary to develop a program capable of some useful function.
  • 6. Rules A rule is a formal way of specifying a recommendation, directive, or advice A rule is expressed as IF premise THEN conclusion or IF condition THEN action
  • 7. Drawing inferences from rules Forward chaining In forward chaining, the reasoning proceeds from the IF part of the rule to the THEN part. Backward chaining In backward chaining, the reasoning proceeds from the THEN part to the IF part.
  • 8. Expert system building tool Programming language An expert system can be implemented using a general purpose programming language. However, the programming languages LISP and PROLOG are typically used in expert systems implementation, in particular Artificial Intelligence applications. This is due to their capabilities in handling symbolic data efficiently. Shells A shell consists mainly of an inference engine and an editor to assist developers in building their knowledge base.
  • 11. CLIPS: Expert System Shell Rule-based expert systems are often known as production systems (CLIPS actually stands for C Language Integrated Production System).
  • 12. The CLIPS Programming Tool History of CLIPS Influenced by OPS5 and ART Implemented in C for efficiency and portability Developed by NASA, distributed & supported by COSMIC Runs on PC, Mac, also under UNIX and VAX VMS CLIPS provides mechanisms for expert systems A top-level interpreter Production rule interpreter Object oriented programming language LISP-like procedural language
  • 13. Components of CLIPS Rule-Based Language Can create a fact list Can create a rule set An inference engine matches facts against rules Object-Oriented Language Can define classes Can create different sets of instances Special forms allow you to interface rules and objects
  • 14. Defining Facts Facts can be asserted CLIPS> (assert (today is sunday)) <Fact-0> Facts can be listed CLIPS> (facts) f-0 (today is sunday) Facts can be retracted CLIPS> (retract 0) CLIPS> (facts)
  • 15. Managing Facts Clearing all facts CLIPS> (clear) CLIPS> (facts) Grouping facts - typically in a file (“today.clp”) (deffacts today ; can be cleared with (undeffacts today) (today is sunday) (weather is warm) ) After loading facts, assert with (reset)
  • 16. Defining Rules Rules have the following structure (defrule rule-name optional-comment optional-declaration condition ... condition => action ... action )
  • 17. An Example CLIPS Rule (defrule sunday “Things to do on Sunday” (salience 0) ; salience in the interval [-10000, 10000] (today is Sunday) (weather is sunny) => (assert (chore wash car)) (assert (chore chop wood)) ) So, if fact list contains conditions, add assertions
  • 18. Getting the Rules Started The reset command creates a special fact CLIPS> (load “today.clp”) CLIPS> (facts) CLIPS> (reset) CLIPS> (facts) f-0 (initial-fact) ... (defrule start (initial-fact) => (printout t “hello”) )
  • 19. Tracing & Recording Things Watch command can watch facts (and rules) CLIPS> (watch facts) CLIPS> (reset) ==> f-0 (initial-fact) CLIPS> (retract 0) <== f-0 (initial-fact) Contents of dialog window can be sent to file CLIPS> (dribble-on “dribble.clp”) ; any file name will do ... CLIPS> (dribble-off “dribble.clp”)
  • 20. Variables & Pattern Matching Variables make rules more applicable (defrule pick-a-chore (today is ?day) (chore is ?job) => (assert (do ?job on ?day)) ) If conditions are matched, then bindings are used
  • 21. Retracting Facts from a Rule (defrule do-a-chore (today is ?day) ; ?day must have a consistent binding ?chore <- (do ?job on ?day) => (printout t ?job “ done”) (retract ?chore) ) We must assign a variable to item for retraction
  • 22. Pattern Matching Details One-to-one matching (do ?job on ?day) (do washing on monday) Use of wild cards (do ? ? monday) (do ? on ?) (do ? ? ?day) (do $?) (do $? monday) (do ?chore $?when)
  • 23. Using Templates (deftemplate student “a student record” (slot name (type STRING)) (slot age (type NUMBER) (default 18))) CLIPS> (assert (student (name fred))) (defrule print-a-student (student (name ?name) (age ?age)) => (printout t name? “ is “ ?age) )
  • 24. Defining Functions in CLIPS Uses a LISP or Scheme-like syntax (deffunction function-name (arg ... arg) action ... action) (deffunction hypotenuse (?a ?b) (sqrt (+ (* ?a ?a) (* ?b ?b)))) (deffunction initialize () (clear) (assert (today is sunday)))
  • 25. Defining Classes & Instances Defining the class CAR (defclass car (is-a user) (name) (made-by)) Defining an instance of CAR (make-instance corvette of car (made-by chevrolet))
  • 26. Concrete & Abstract Classes Some classes only exist for inheritance purposes Person Man Woman Jack Jill
  • 27. Managing Instances Commands to display instances CLIPS> (instances) [corvette] of car CLIPS> (send [corvette] print) [corvette] of car (made-by chevrolet) Command to group instances (in a file) (definstances (corvette of car (made-by chevrolet)) (thunderbird of car (made-by ford)))
  • 28. Clearing & Resetting Instances Deleting an instance CLIPS> (send [corvette] delete) Deleting all instances CLIPS> (unmake-instance *) Resetting creates an initial object CLIPS> (reset) CLIPS> (instances) [initial-object] of INITIAL-OBJECT
  • 29. Message Passing The SEND function (send [instance] message arg ... arg) Converting from symbols to names CLIPS> (symbol-to-instance-name corvette) [corvette] This is useful when SENDing from inside a rule
  • 30. Limitations of CLIPS Single level rule sets in LOOPS, you could arrange rule sets in a hierarchy, embedding one rule set inside another Loose coupling of rules and objects rules can communicate with objects via message passing rules cannot easily be embedded in objects, as in Centaur CLIPS has no explicit agenda mechanism the basic control flow is forward chaining to implement other kinds of reasoning you have to manipulate tokens in working memory
  • 31. Alternatives to CLIPS Eclipse has same syntax as CLIPS (both are based on ART) supports goal-driven (i.e., backwards) reasoning has a truth maintenance facility for checking consistency can be integrated with C++ and dBase new extension RETE++ can generate C++ header files NEXPERT OBJECT another rule- and object-based system has facilities for designing graphical interfaces has a ‘script language’ for designing user front-end written in C, runs on many platforms, highly portable