Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Multiple fields in AI

Functional
  • Let's reconsider the problem of designing an expert system to help a robot cross a street. One rule that you would have follows.
             (defrule green-light
              (light green)
               =>
             (printout t "Walk" crlf))
  • Another rule would cover the case of a red light.
          (defrule red-light
           (light red)
           =>
          (printout t "Don't walk" crlf))
  • A third rule would cover the case in which a walk-sign said not to walk. This would take precedence over a green light.
            (defrule walk-sign
            (walk-sign-says dont-walk)
            =>
           (printout t "Don't walk" crlf) )

not allow
  • The previous rules are simplified and don't cover all cases such as the breakdown of the traffic-light. For example, what does the robot do if the light is red or yellow and the walk-sign walk?
  • A way of handling this case is to use a field constrains to restrict the values that a patterns may have on the LHS. The field constraint acts like constraints on patterns.
  • One type of field constraint is called a connective constraints. There are three types of connective constraints. The first is called a ~ constraint. Its symbol is the tilde "~".
  • The ~ constraint acts on the one value that immediately follows it and will not allow that value.
        (defrule walk
        (light ~green)
         =>
        (printout t "Don't walk" crlf))
  • By using the ~constraint, this one rule does the work of many other rules that required specifying each light condition.
Bar constraint
  • The second connective constraint is the bar constraint, "|". The "|" connective constraint is used to allow any of a group of values to match.
  • For example, suppose you wanted a rule that printed out "Be cautions" if the light was yellow or blinking yellow. The following example shows it's done using the "|" constraint.

No comments:

Post a Comment

Popular Posts