1 / 11

Artificial Intelligence Lecture No. 20

Artificial Intelligence Lecture No. 20 . Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science,  COMSATS Institute of Information Technology (CIIT) Islamabad, Pakistan. Summary of Previous Lecture. Reopen Rule Print out Variables . Today’s Lecture. Be Assertive

micah
Download Presentation

Artificial Intelligence Lecture No. 20

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. Artificial IntelligenceLecture No. 20 Dr. Asad Ali Safi ​ Assistant Professor, Department of Computer Science,  COMSATS Institute of Information Technology (CIIT) Islamabad, Pakistan.

  2. Summary of Previous Lecture • Reopen • Rule • Print out • Variables

  3. Today’s Lecture • Be Assertive • variable more than once • Retraction • single-field wildcard

  4. Be Assertive • One common use of variables is to match a value on the LHS and then assert this bound variable on the RHS. For example, enter (defrule make-quack (duck-sound ?sound) => (assert (sound-is ?sound)))

  5. variable more than once • Be sure to do a (reset) and assert (duck-sound quack) again. (defrule make-quack (duck-sound ?sound) => (assert (sound-is ?sound ?sound))) • When the rule fires, it will produce (sound-is quack quack) since the variable ?sound is used twice.

  6. (duckshoot ?hunter ?who) CLIPS> (clear) CLIPS> (defrulewhohunt (duckshoot ?hunter ?who) => (printout t ?hunter " shot " ?who crlf)) (assert (duckshoot Brian duck))

  7. Retraction • Retraction is very useful in expert systems and usually done on the RHS rather than at the top-level. Before a fact can be retracted, it must be specified to CLIPS. To retract a fact from a rule, the fact-address first must be bound to a variable on the LHS.

  8. However, if you want to remove the fact whose contents are, you must first tell CLIPS the address of the fact to be retracted. • The fact-address is specified using the left arrow, "<-". To create this, just type a "<“ symbol followed by a "-"

  9. (defrule get-married ?Ad <- (bachelor Ali) => (printout t “Ali is now happily married " ?Ad crlf) (retract ?Ad)) (assert (bachelor Ali)) (run)

  10. (defrule marriage ?Ad<- (bachelor ?name) => (printout t ?name " is now happily married" crlf) (retract ?Ad) (deffacts good-prospects (bachelor Ali) (bachelor Aslam) (bachelor Abid)) (reset) (run)

  11. Summery of Today’s Lecture • Be Assertive • variable more than once • Retraction • single-field wildcard

More Related