artificial intelligence lecture no 17 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Artificial Intelligence Lecture No. 17 PowerPoint Presentation
Download Presentation
Artificial Intelligence Lecture No. 17

Loading in 2 Seconds...

play fullscreen
1 / 29

Artificial Intelligence Lecture No. 17 - PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on

Artificial Intelligence Lecture No. 17 . Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science,  COMSATS Institute of Information Technology (CIIT) Islamabad, Pakistan. Summary of Previous Lecture. Types of inference engines Forward chaining and backward chaining

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Artificial Intelligence Lecture No. 17' - cleo


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
artificial intelligence lecture no 17

Artificial IntelligenceLecture No. 17

Dr. Asad Ali Safi

Assistant Professor,

Department of Computer Science, 

COMSATS Institute of Information Technology (CIIT) Islamabad, Pakistan.

summary of previous lecture
Summary of Previous Lecture
  • Types of inference engines
  • Forward chaining and backward chaining
  • Conflict resolution
  • Advantages/disadvantages of rule-based expert systems
today s lecture
Today’s Lecture
  • What is CLIPS?
  • CLIPS difference
  • Interacting with clips
clips
CLIPS
  • CLIPS is a public domain software tool for building expert systems.
  • The name is an acronym for "C Language Integrated Production System."
  • The first versions of CLIPS were developed starting in 1985 at NASA-Johnson Space Center, until the mid-1990s when the development group's responsibilities ceased to focus on expert system technology.
  • The original name of the project was NASA's AI Language (NAIL).
clips1
CLIPS
  • Source
  • Installation
  • GUI
clips2
CLIPS

CLIPS is a type of computer language designed for writing applications called expert systems.

CLIPS is called an expert system tool because it is a complete environment for developing expert systems which includes features such as an integrated editor and a debugging tool.

what is clips
What is CLIPS?
  • CLIPS is a multiparadigm programming language that provides support for:
    • Rule-based
    • Object-oriented
    • Procedural programming
  • Syntactically, CLIPS resembles:
    • Eclipse
    • CLIPS/R2
    • JESS
other clips characteristics
Other CLIPS Characteristics
  • CLIPS supports only forward-chaining rules.
  • The OOP capabilities of CLIPS are referred to as CLIPS Object-Oriented Language (COOL).
  • The procedural language capabilities of CLIPS are similar to languages such as:
    • C
    • C++
    • Pascal
    • Lisp
slide9

Knowledge

Base

(contains rules)

Inference

Engine

(controls execution)

Fact List

(contains data)

program
Program

A program written in CLIPS may consist of rules, facts, and objects. The inference engine decides which rules should be executed and when.

A rule-based expert system written in CLIPS is a data-driven program

Where the facts, and objects if desired, are the data that stimulate execution via the inference engine.

clips difference
CLIPS difference
  • This is one example of how CLIPS differs from procedural languages such as Java, BASIC, FORTRAN, and C.
  • In procedural languages, execution can proceed without data. That is, the statements are sufficient in those languages to cause execution.
    • For example, a statement such as PRINT 2 + 2 could be immediately executed in BASIC. This is a complete statement that does not require any additional data to cause its execution.
    • However, in CLIPS, data are required to cause the execution of rules.
interacting with clips
Interacting with clips
  • CLIPS expert systems may be executed in three ways:
    • interactively using a simple, text-oriented, command prompt interface;
    • interactively using a window/menu/mouse interface on certain machines;
    • or as embedded expert systems in which the user provides a main program and controls execution of the expert system.
slide13

The generic CLIPS interface is a simple, interactive, text-oriented, command prompt interface for high portability.

  • The standard usage is to create or edit a knowledge base using any standard text editor, save the knowledge base as one or more text files, exit the editor and execute CLIPS, then load the knowledge base into CLIPS.
  • The interface provides commands for viewing the current state of the system, tracing execution, adding or removing information, and clearing CLIPS.
top level commands
Top Level Commands
  • When the “CLIPS>” prompt is printed, a command may be entered for evaluation. Commands may be function calls, constructs, local or global variables, or constants.
  • If a function call is entered, that function is evaluated and its return value is printed.
  • Function calls in CLIPS use a prefix notation—the operands to a function always appear after the function name. Entering a construct definition at the CLIPS prompt creates a new construct of the appropriate type.
  • CLIPS> (+ 3 4)
  • 7
slide15

CLIPS> (bind ?a 5)

  • 5
  • CLIPS> (+ ?a 3)
  • 8
  • CLIPS> (reset)
  • CLIPS> ?a
  • [EVALUATN1] Variable a is unbound
  • FALSE
  • CLIPS>
data types
Data Types
  • CLIPS provides eight primitive data types for representing information. These types are float, integer, symbol, string, external-address, fact-address, instance-name and instance-address.
  • Numeric information can be represented using floats and integers. Symbolic information can be represented using symbols and strings. A number consists only of digits (0-9), a decimal point (.), a sign (+ or -), and, optionally, an (e) for exponential notation with its corresponding sign.
slide17

A number is either stored as a float or an integer. Any number consisting of an optional sign followed by only digits is stored as an integer (represented internally by CLIPS as a C long integer). All other numbers are stored as floats (represented internally by CLIPS as a C double-precision float).

  • Some examples of integers are
  • 237 15 +12 -32
  • Some examples of floats are
  • 237e3 15.09 +12.0 -32.3e-7
symbol
Symbol
  • A symbol in CLIPS is any sequence of characters that starts with any printable ASCII character and is followed by zero or more printable ASCII characters. When a delimiter is found, the symbol is ended. The following characters act as delimiters: any non-printable ASCII character (including spaces, tabs, carriage returns, and line feeds), a double quote, opening and closing parentheses “(” and “)”, an ampersand “&”, a vertical bar “|”, a less than “<”, and a tilde “~”.
  • A semicolon “;” starts a CLIPS comment and also acts as a delimiter.
slide19

Delimiters may not be included in symbols with the exception of the “<“ character which may be the first character in a symbol. In addition, a symbol may not begin with either the “?” character or the “$?” sequence of characters (although a symbol may contain these characters). These characters are reserved for variables

  • CLIPS is case sensitive (i.e. uppercase letters will match only uppercase letters). Note that numbers are a special case of symbols
  • Some simple examples of symbols are
  • foo Hello B76-HI bad_value
  • 127A 456-93-039 @+=-% 2each
string
String
  • A string is a set of characters that starts with a double quote (") and is followed by zero or more printable characters.
  • A string ends with double quotes. Double quotes may be embedded within a string by placing a backslash (\) in front of the character.
  • A backslash may be embedded by placing two consecutive backslash characters in the string.
  • Some examples are
    • "foo" "a and b" "1 number" "a\"quote"
  • Note that the string “abcd" is not the same as the symbol abcd. They both contain the same characters, but are of different types.
slide21
Fact
  • A fact is a list of atomic values that are either referenced positionally (ordered facts) or by name (non-ordered or template facts).
  • Facts are referred to by index or address;
  • The printed format of a fact-address is:
  • <Fact-XXX>
  • where XXX is the fact-index.
instance
Instance
  • An instance is an object that is an instantiation or specific example of a class. Objects in CLIPS are defined to be floats, integers, symbols, strings, multifield values, external-addresses, fact-addresses or instances of a user-defined class.
  • A user-defined class is created using the defclass construct.
  • An instance of a user-defined class is created with the make-instance function, and such an instance can be referred to uniquely by address or uniquely referred to by name.
  • An instance-name is formed by enclosing a symbol within left and right brackets. Thus, pure symbols may not be surrounded by brackets.
  • Some examples of instance-names are:
    • [pump-1] [foo] [+++] [123-890]
slide23

Note that the brackets are not part of the name of the instance; they merely indicate that the enclosed symbol is an instance-name.

  • An instance-address can only be obtained by binding the
  • return value of a function called instance-address or by binding a variable to an instance matching an object pattern on the LHS of a rule
  • A reference to an instance of a user-defined class can either be by name or address; instance-addresses should only be used when speed is critical.
  • Within CLIPS, the printed representation of an instance-address is <Instance-XXX>
  • where XXX is the name of the instance.
function
Function
  • A function in CLIPS is a piece of executable code identified by a specific name which returns a useful value or performs a useful side effect (such as displaying information).
  • There are several types of functions. User defined functions and system defined functions
  • System defined functions are those functions that have been defined internally by the CLIPS environment. User defined functions are functions that have been defined externally of the CLIPS environment.
slide25

Function calls in CLIPS use a prefix notation – the arguments to a function always appear after the function name.

  • Function calls begin with a left parenthesis, followed by the name of the function, then the arguments to the function follow (each argument separated by one or more spaces).
  • Arguments to a function can be primitive data types, variables, or another function call. The function call is then closed with a right parenthesis.
  • Some examples of function calls using the addition (+) and multiplication (*) functions are shown following.
    • (+ 3 4 5)
    • (* 5 6.0 2)
    • (+ 3 (* 8 9) 4)
    • (* 8 (+ 3 (* 2 3 4) 9) (* 3 4))
    • CLIPS> (+ 2 3(- 10 5))
    • 10
    • CLIPS> (+ 2 3(- 5 10))
    • 0
    • CLIPS> (+ 2 3(- 5 15))
    • ?
facts
Facts
  • Facts are one of the basic high-level forms for representing information in a CLIPS system. Each fact represents a piece of information which has been placed in the current list of facts, called the fact-list.
  • Facts are the fundamental unit of data used by rules
slide27

Facts may be added to the fact-list (using the assert command), removed from the fact-list (using the retract command), modified (using the modify command), or duplicated (using the duplicate command) through explicit user interaction or as a CLIPS program executes.

  • The number of facts in the fact-list and the amount of information that can be stored in a fact is limited only by the amount of memory in the computer.
  • If a fact is asserted into the fact-list that exactly matches an already existing fact, the new assertion will be ignored (however, this behavior can be changed,
slide28

Some commands, such as the retract, modify, and duplicate commands, require a fact to be specified.

  • A fact can be specified either by fact-index or fact-address. Whenever a fact is added (or modified) it is given a unique integer index called a fact-index.
  • Fact-indices start at zero and are incremented by one for each new or changed fact. Whenever a reset or clear command is given, the fact-indices restart at zero.
  • A fact may also be specified through the use of a fact-address.
summery of today s lecture
Summery of Today’s Lecture
  • What is CLIPS?
  • CLIPS difference
  • Interacting with clips