The difference with fuzzy rules is that unlike conventional rules where the
consequent either fires or not, in fuzzy systems the consequent can fire to a
matter of degree. Here are some examples of fuzzy rules:
IF Target_isFarRight THEN Turn_QuicklyToRight
IF VERY(Enemy_BadlyInjured) THEN Behavior_Aggressive
IF Target_isFarAway AND Allegiance_isEnemy THEN
IF Ball_isCloseToHole AND Green_isLevel THEN HitBall_Gently
IF (Bend_HairpinLeft OR Bend_HairpinRight ) AND Track_SlightlyWet
The antecedent, then, can be a single fuzzy term or the set that is the result
of a combination of several fuzzy terms. The degree of membership of the
antecedent defines the degree to which the consequent fires. A fuzzy infer-
ence system is typically comprised of many such rules, the number of
which is proportional to the number of FLVs required for the problem
domain and the number of membership sets those FLVs contain. Each time
a fuzzy system iterates through its rule set it combines the consequents that
have fired and defuzzifies the result to give a crisp value. More on the
details of this in a moment but first, before we delve deeper, let’s design
some FLVs we can use to solve a real-world problem. Given a practical
example you can sink your teeth into, I’m sure you’ll find it much easier to
see how all this stuff works together.
Designing FLVs for Weapon Selection
Because the rules a human player uses to decide when to change weapons
can easily be described using linguistic terms, weapon selection is a good
candidate for the application of fuzzy logic. Let’s see how this idea can be
applied to Raven.
To keep the example simple, we’ll say the desirability of selecting a par
ticular weapon from the inventory is dependent on two factors: the distance
to the target and the amount of ammo. Each weapon class owns an instance
of a fuzzy module, and each module is initialized with FLVs representing
the linguistic terms Distance to Target, Ammo Status (antecedents), and
Desirability (consequent), and also with rules pertinent to that weapon.
The rules infer how desirable that weapon is for any given scenario,
enabling a bot to select the weapon with the highest desirability score to be
the current weapon.
The FLVs Distance to Target and Desirability are defined identically
for each weapon type. Ammo Status and the rule set are custom built. The
examples given in this chapter will focus on designing the FLVs and rule
set for the rocket launcher.
Fuzzy Logic | 425