1 / 34

Rule Based Systems

Rule Based Systems. Rule Based Systems - Introduction. Well formed formulae (wff) in propositional or first order logic represent assertional knowledge. Such wffs are divided into two categories. - Rules : assertions given in implicational form.

akira
Télécharger la présentation

Rule Based 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. Rule Based Systems

  2. Rule Based Systems - Introduction • Well formed formulae (wff) in propositional or first order logic represent assertional knowledge. • Such wffs are divided into two categories. - Rules : assertions given in implicational form. - Facts : assertions that represent domain specific knowledge.

  3. Rule-Based Systems • In Logic we represent knowledge in a declarative, static way - as some facts and rules that are true. • Rules in logic say what is TRUE given some conditions. • Rule-based systems are based on rules that say what to DO, given various conditions. • IF <this is the case> THEN <do this> • A special interpreter controls when rules are invoked.

  4. Rules and Logic • Simple examples are very similar to rules in logic. • However, in rule based systems we consider: • Other kinds of actions (apart from adding facts). • Degrees of certainty associated with facts. • Various different control schemes (not necessarily related to idea of logical proof).

  5. Example Rules • If it rains today the roads will be wet today Rains(today)  Wet-road (today) If Rains(today) Then Wet-road(today) If Rains (today) and Not-covered (roads) Then Wet-road (today) Which are facts? Facts are also generated

  6. Recall Modus Ponens P  Q P --------------- Q Q  R --------------- R

  7. Rule Based (Production) Systems • A system whose knowledge base is represented as a set of rules and facts is called a Rule Based System. • A rule-based system consists of a collection of IF-THEN rules, a collection of facts, and some interpreter controlling the application of the rules, given the facts.

  8. Rule Based System - Rules • Rules are represented in the following form : IF <antecedent> THEN <consequent> • When the antecedent part is NULL the Rule becomes a fact. • Rules are normally represented as Horn Clause.

  9. Rules are normally represented as Horn Clauses P  Q ¬ P V Q P  Q  R ¬ P V ¬Q V R P  Q  R V S ¬ P V ¬ Q V R V S Horn clauses can have at most one non-negative literal

  10. Rule Based Systems – Triggered and fired rules • A rule is triggered when all the antecedents evaluate to true. • A rule is fired when the action stated in the consequent part or the inference related to the consequent part is inferred / taken.

  11. Rule-based system architecture Control Scheme (Interpreter) Condition-Action Rules R1: IF hot AND smoky THEN ADD fire R2: IF alarm_beeps THEN ADD smoky R3 IF fire THEN ADD switch_on_sprinklers Database of Facts alarm_beeps hot

  12. Conflict Resolution Match Execute Goal Check Inference Machine • A machine that implements strategies to utilize the knowledge base and derive new conclusions from it. Automata of Inference machine Fact and Rule Base R’

  13. Inference Machine • The execute state fires the rules once all its antecedents match. • Essentially, the function of the execute state can be thought of as searching a path to the goal in a search space.

  14. R5 R1 Goal Node

  15. Backtracking • If the inference machine reaches a dead end ( no new rule is enabled and the goal is not met) then backtrack to the earlier node • Good conflict resolution strategy reduces backtracking.

  16. Conflict Resolution • The objective is to decide which of the triggered rules in a particular stage should be fired. • Can use various strategies :-- • FCFS (Rule Ordering) • Specificity Ordering • Fire all • Heuristic measures (distance from the goal)

  17. Conflict Resolution : Contd.. • Other strategies used for the purpose are:-- • Refractoriness: Rules once fired will not be fired later. • Meta-rules : Rules about rules embedded within the inference machine that provide the information about which of the rules apply under what conditions. • 90% of computing time is spent in the match phase, hence minimizing the same is necessary.

  18. Searching the space • Start from the given facts try to arrive at the goal • Start from the goal and try to prove the goal using the given facts

  19. Reasoning Mechanism in Rule Based Systems

  20. Forward Chaining Mechanism • Starting from the start state applying rules one by one to arrive at the goal state. • Also known as Data Driven Search. • Forward chaining may lead search to a dead-end. In such cases backtracking is necessary. • Backtracking strategies can be : • Chronological • Intelligent

  21. Forward chaining • In a forward chaining system: • Facts are held in a working memory • Condition-action rules represent actions to take when specified facts occur in working memory. IF condition THEN action. • Typically the actions involve adding or deleting facts from working memory.

  22. Forward chaining • Control cycle called recognise-act cycle. • Repeat: • Find all rules which have satisfied conditions given facts in working memory. • Choose one, using conflict resolution strategies. • Perform actions in conclusion, probably modifying working memory. • Until no rules can fire, or “halt” symbol added to working memory.

  23. Example Control Scheme (Interpreter) Condition-Action Rules R1: IF hot AND smoky THEN ADD fire R2: IF alarm_beeps THEN ADD smoky R3 IF fire THEN ADD switch_on_sprinklers Database of Facts alarm_beeps hot

  24. Example • Simple “fire” example from earlier: • Working memory initially contains: • alarm_beeps • hot • Following the algorithm: First cycle.. • Find all rules with satsified conditions : R2 • Choose one: R2 • Perform actions: ADD smoky. • Working memory now contains • alarm_beeps, hot, smoky

  25. Example continued • Next cycle: • Find all rules with conditions satisfied : R1 • Choose one and apply action: ADD fire • Working memory now contains alarm_beeps, hot, smoky, fire. • Then • Rules with conditions satisfied: R3 • apply action: ADD switch_on_sprinklers.

  26. Forward chaining applications • Forward chaining systems have been used as: • a model of human reasoning • basis for expert systems - various expert system shells based on this model, such as CLIPS. • Practical forward chaining systems support pattern matching • Example CLIPS rule:(defrule fire-alarm (temperature ?r1 hot) (environment ?r1 smoky) => (assert (fire-in ?r1)))

  27. Backward Chaining • Same rules/facts may be processed differently, using backward chaining interpreter. • This allows rather more focused style of reasoning. (Forward chaining may result in a lot of irrelevant conclusions added to working memory.) • Start with possible hypothesis. Should I switch the sprinklers on? • Set this as a goal to prove • Similar to Prolog which uses a backward chaining style of reasoning.

  28. Backward Chaining • Basic algorithm: • To prove goal G: • If G is in the initial facts, it is proven. • Otherwise, find a rule which can be used to conclude G, and try to prove each of that rule’s conditions.

  29. Control Scheme (Interpreter) Condition-Action Rules R1: IF hot AND smoky THEN ADD fire R2: IF alarm_beeps THEN ADD smoky R3 IF fire THEN ADD switch_on_sprinklers Database of Facts alarm_beeps hot

  30. Backward Chaining Example Should we switch on the sprinklers? Set as a goal. • G1: switch_on_sprinklers • Is it in initial facts? No. Is there a rule which adds this as a conclusion? Yes, R3 • Set condition of R3 as new goal to prove: • G2: fire. • Is it in initial facts? No. Rule? Yes, R1 • Set conditions as new goals: G3: hot, G4: smoky.

  31. Example continued • Try to prove G3: hot. In initial facts. • Try to prove G4: smoky. Conclusion of rule so.. • G5: alarm_beeps. • In initial facts, so all done… • Proved hypothesis switch_on_sprinklers.

  32. Examples of RBS • Available expert systems:-- • CLIPS • NEXPERT • Languages facilitating development of Rule Based Systems by incorporating within its structure certain advanced storage techniques. • PROLOG

  33. Expert Systems • Systems acting in a particular domain and behaving like human experts therein. • Normally expert systems are applied to problems for which no algorithmic solution exist. • Guided by domain specific rules and should be able to explain its actions.

  34. Expert Systems Applications • Rule Based systems have been widely used in expert systems. • E.g., medical systems, where start with set of hypotheses on possible diseases - try to prove each one, asking additional questions of user when fact is unknown.

More Related