Fuzzy RulesGiven the variables just defined, we're ready to create the behaviors as a set of rules. To achieve this, we'll use the case studies from Chapter 29, "Analysis and Specification." Using DoorsThe set of rules required to move through a door is that we need to press the button first, and then move through the door when it's ready. The rules, displayed in Table 31.1, reflect the simplicity of the task, involving only four fuzzy terms.
It's important to note that this set of fuzzy rules relies on being interrupted once the door is crossed. The higher-level AI identifies this is the case, and stops calling this fuzzy behavior. The problem is that the animat will continue to try to get through the door again (backwards) once the door has been used. Preventing this problem would require another few symbols and additional rules, thereby complicating the system. It's is certainly feasible—and even desirable—to only let these rules handle the door scenario, and nothing else. In brief, the behavior does need to specify to stop turning toward the button; in rule 1, the membership value of the action will drop toward 0 when the button is pressed. The same applies for the movement. Using LaddersLadders are equally simple to deal with by using fuzzy rules. The hardest work has been done by the time the rules are written. To climb a ladder, the animat must first move toward it and grab hold of it (handled automatically). Then, it must look up and press forward until the top of the ladder is reached, at which point the animat can look ahead to dismount. Table 31.2 lists the fuzzy rules that express this.
Once again, we'll assume that these fuzzy rules are no longer called by the higher-level AI after the animat has dismounted from the ladder. These fuzzy rules are only expected to be applied to their intended domain. Using PlatformsThe use of platforms involves more actions in the sequence than the previous two behaviors. Consequently, the rulebase is slightly more complex, but the principles remain the same. The animat presses the button and gets onto the platform (see Table 31.3).
Again, we assume the behavior is disengaged after the platform has been dismounted. By making the rules as specific as possible, we can also avoid having to specify behaviors such as "stop looking toward the platform." |