1 / 34

Theme 2-3 Knowledge Information Processing

Theme 2-3 Knowledge Information Processing. Subject. Learning how to develop knowledge bases or problem solving systems using OPS5 production system. Learning how to develop problem solving systems using C language

aileensmith
Télécharger la présentation

Theme 2-3 Knowledge Information Processing

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. Theme 2-3Knowledge Information Processing

  2. Subject • Learning how to develop knowledge bases or problem solving systems using OPS5 production system. • Learning how to develop problem solving systems using C language • Learning about a difference between concepts of declarative programming and concepts of procedural programming.

  3. About OPS5 • For constructing production systems. • Production system is the tool for constructing expert systems, that is a substitute of experts. • The first coming of ops5 is 1970s. • The feature of ops5 is very poor. • Declarative programming language.

  4. Declarative Programming ant. Procedural Programming • Procedural Programming: • Process sequential processes in order. • Such as C, Basic, etc. • DeclarativeProgramming: • User will declare rules to solve a problem. • This concept is familiar with the knowledge used in A.I. • It has been used in the research field of AI.

  5. Image Procedual • Process commands in order Declarative • Each rules are independent. • When rule’s conditions are satisfied, the rule • The order is not defined. command1 rule1 command2 rule2 command3 rule3

  6. OPS5’s archtecture • OPS5consists of 3 parts. Match WM and PM, then execute the rule. Inference Engine (Matching & Rule Execution) Working Memory (Store Variables or status, temporary) Production Memory(Store Rules) It corresponds to human’s long-term memory It corresponds to human’s short-term memory

  7. Operation of OPS5 • OPS5 repeats following operations until the goal status is satisfied. • Matching WM and PM, then select rules which conditions are satisfied.(Condition Matching) • Choose only one rule from rules selected in above process. (Conflict Resolution) • Execute the rule. After execution, status or values in WM will be changed. Then, back to 1.(Execution)

  8. Let’s try to execute a sample. • Please refer chap.6 and chap.7 of the textbook. • 第6章「コンパイラの設定」 • Read the chapter and setup the ops5 compiler. • 第7章「例題1」 • Input the sample program and compile, then execute.

  9. Image of Example.1 Ball is comming Watching… If ball is red colored, Paint it blue. Watching… Watching… If ball is blue colored, Paint it white If ball is white colored, It is a goal.

  10. Grammar of OPS5

  11. Knowledge Expression • Rules(in Production Memory) • Represents Knowledge • Data(in Working Memory) • Represents variable factors

  12. Data expression • Data consists of “Class Name” and pairs of “Attribute Name” and “Attribute Value”. • Class Name:Name of the data • (Like as a structure name of C) • Attribute Nam:Name of the parameter • (A member name of a structure) • Attribute Value:Value of the parameter • (A value of member ) • Format: • (ClassName ^attr1value1 • ^attr2value2 • …….          )

  13. Examples of data (Weather ^placeKanazawa ^wethrain ^temp 18 ^hum80) Ex.1 Data related weather: It represents weather, temperature and humidity in Kanazawa. Ex.2 (Weather ^place Tokyo ^wethclear ^temp 22 ^hum30) Data related weather: It represents weather, temperature and humidity in Tokyo.

  14. Rule Expression • Rules are represented in IF〜THEN… structure. Format of rule: (p rulename ー> ) Condition part Command part Describe conditions and commands in before and after a arrow (-->).

  15. Condition description • Condition part consists of condition elements. • Condition element describes conditions to be satisfied by data in Working Memory. • Format is like as data format. (ClassName ^attrpredicate ^attrpredicate ………………) Replace “value” by “predicate” in data format. “Predicate” means a condition for value to satisfy.

  16. Example of condition element • (Weather ^place <P> ^weatclear       ^temp{ >= 18 <= 22} ^hum{<H> < 80} ) • Describe a condition to be satisfied by attribute value, such as “clear”. (Constant) • Multiple conditions are represented putting “{” and “}” around conditions. All conditions must be satisfied. (Conjunction) • A letter surrounded “<” and “>” is condition variable, such as <P>, <H>. Any values satisfy the condition. Meanings of the condition element above. Is there the data in the WM which ClassName is “Weather” and, the value of attribute “place” is arbitrary, the value of attribute “weat” is “clear”, the value of attribute “temp” is more than or equal to 18 and less than or equal 22, the value of attribute “hum” is arbitrary and less than 80

  17. Example of condition element (2) (Student ^name <N>       ^class << 1 2 >>      ^score > 80 ) The meaning of the condition element. Is there the data in the WM which ClassName is “Student” and, the value of attribute “name” is arbitrary, the value of attribute “class” is “1” or “2” (disjunction) the value of attribute “score” is more than 80.

  18. Command Part • In the command part, commands executed when all condition elements in the condition part are satisfied is described. • OPS5 has some kinds of command, we should combine these command. (The number of command is only 6 or 7.) • Mainly, commands are make, reduce and modify data, and print texts.

  19. Examples of command • Make data(Make new data and store it in WM)  例:(make weather ^place <P> ^weat clear ^temp 15 ^hum <H>) • Remove data(remove the data that satisfies condition element)  例:(remove 3) • Modify data(modifythe data that satisfies condition element)  例:(modify 2 ^temp (accept) ^hum 50) • Calculation  例:(compute <H> + 1)

  20. Example of a Rule (p sample-rule  (Weather ^place <X>^weat clear ^hum >20)  (Sight^place <X>^famous <Y>^visitno) -->  (make Plan ^go <X> ^subject <Y>)  (write |Go to| <Y> |in|<X> (crlf)) ) • Caution • In the condition part, same variables must be same values. • ー>Variable restriction • In the command part, value of variable is inherited the value in the condition part. • The scope of variable is in one rule.

  21. Description of OPS5 program • The program consists of 3 part. • Declaration part Classes are declared in this part. (literalize ClassNameAttrNameAttrName …) • Startup Rule(Initialize) The rule executed at first. This rule is used for initializetion. • Rule Describe user’s rules. Please refer sample programs for details.

  22. Others • An extention of program is “.l” • How to compile, cmd filename (.l is not needed) • After completion of compile, an executable file which name is “filename” is created. • How to execute, ./filename

  23. Example 2 • There are 5 parts, size of them are different. • Make a product using 3 parts of 5 kinds of parts. • Smaller parts can put on bigger parts, but it is impossible bigger one on the smaller one. • Which parts should be used to make a product.

  24. Operation in the example 2 Rule to decide parts1 execution Executable rules Rule for parts2

  25. Operation in the example 2 Rule for parts1 Rule for parts2 Rule for part3

  26. Operation in the example 2 Rule for parts1 backtrack Rule for parts2 Execute the rule that is executable and not executed backtrack Rule for parts3 backtrack Repeat when no rule can be executed. It is dead-end.

  27. Example 3 • In the example 3, please complement rules.(Not all rule are described in the textbook, it is not enough to solve the problem. ) • Please refer the textbook.

  28. Image of ex.3 Red or white ball will be passed to someone, A-E. A B E Persons will pass the ball to next person. If the color is red, pass it to right side person, otherwise to left side person. C D

  29. Image of ex.3 A B E C D

  30. Image of ex.3 A B E C D

  31. Image of ex.3 A B E C D

  32. Image of ex.3 A B E C D

  33. Image of ex.3 A If it is 2nd time to get the ball, put the ball on the table. B E C D

  34. Image of ex.3 A B E C D It is finished when the ball is on the table.

More Related