**Note**: This is an excerpt from a draft of my thesis, *A Computer Model of National Behavior*. The introduction and table of contents

are also available

**3.3 Fuzzy Logic**

The field of Fuzzy Logic was invented by Lotfi Zadeh at the University of California at Berkeley in the 1960s in order to model languages, according to Kantowitz. Specifically, according to Kaehler, fuzzy logic was used â€œas a way of processing data by allowing partial set membership rather than crisp set membership or non-membership.â€ Below a general outline of fuzzy logic is given, and then the reasons why this approach fits modeling national behavior are explained.

In standard logic, a value exists on one and only one point on a number line. This is especially easy to visualize when working with discrete integers. For example, take the value â€œtwo.â€ In standard mathematics, this is identical to the concept of â€œtwo-ness.â€ Two has complete â€œtwo-ness,â€ and every other number has no â€œtwo-ness.â€ Graphically,

*Graphic 2. Non-Fuzzy Logic*
Non-fuzzy math works especially well in discrete situations with a small number of possible values. However, what if the concept of partial set membership, or something being â€œsomewhat two-like,â€ is allowed? In a situation like that, where 1.9 is â€œvery two-likeâ€ and 1.1 is â€œbarely two-like,â€ a graphical visualization might look like:

*Graphic 3. Fuzzy Logic*
As in statistics, the area in the chart sums up to one. In this example the fuzziness forms as a triangle.

Fuzzy logic is especially useful when describing nations for several

reasons.

First, Fuzzy Logic overlaps nicely with the concept of nationality. Nations can exist to a lesser or greater extent in a place. The allegiance of people to a nation is fuzzy. For example, the â€œFrenchâ€ nation exists very strongly in Paris while less strongly in Lorraine and Provence. However, Paris is a cosmopolitan city where many languages are spoken, while Lorraine and Provence have their own sense of nationhood or national identity . In other words the allegiance or identification of people to a nation if fuzzy. It would make little sense to say that France is not in Lorraine or Provence, but nor is it fully there. Fuzzy Logic provides a way to model this.

Second, Fuzzy Logic has been used successfully in similar situations. MartÃnez-Miranda, Aldea, and BaÃ±ares-AlcÃ¡ntara modeled work teams as a collection of agents with attributes modeled by fuzzy logic. While in MartÃnez-Miranda, et al, the objective is to select employees for engineering, both scenarios rely on independent agents in a complex system.

Third, Fuzzy Logic also complements the system by making up for one of the drawbacks of the model. In another published paper on fuzzy logic, Benedicenti and others note the vexing problem that often â€œonly subjective measures are available. Subjective measures are the most error prone.â€ However, in the same document it is realized that â€œ[i]t is necessary to accept the possibilities of errors, and to find a way to minimize their effects on the model.â€ Benedicenti’s words on the advantages of fuzzy logic in ambiguous situations should be quoted in full:

The application of fuzzy logic has two advantages. First, it allows inaccuracy in measurements. Second, it can effectively cope with uncertain quantities, often expressed by means of linguistic terms such as â€œlittle,â€ â€œsome,â€ or â€œa few.â€ By choosing appropriate rules, moreover, the modeler can incorporate in the model data coming from subjective sources without compromising the validity of the model.â€

Fuzziness logic is very similar to probability. Bezdek et al describe the difference especially vividly. Imagine a thirsty traveler comes across twobottles, â€œKâ€ and â€œM.â€ The liquid in K is â€œfuzzyâ€ — the potability of the water is .91. The liquid in â€œMâ€ is not, but the probability that its water is potable is .91. Which one should the wonderer drink?

The solution lies in the definition of fuzziness and probability. A fuzzy potability of .91 means it is .91 â€œfit to drink. In other words, it is 100% likely that very fit to drink but it is not perfectly so. Alternatively, a probability of .91 means something very different. In 91% of situations the water will be fit to drink. That is, in almost all situations it will have a potability of 1. But in the rest it will have a potability of zero.

K is swamp-water.

It is 91% likely that M is pure water, but 9% likely that it is

hydrochloric acid. The wise traveler would drink from K.

Given the similarity between fuzzy logic and probability, how is the distinction kept in the simulation? Fuzzy logic is used in a couple different ways. First, is is used to define categories. Then, it is used to evaluate the nature of attributes.

Fuzzy categories are defined using standard deviations. Once each simulation years many entity attributes are calculated for this use. These include fuzzy concepts such as nation aggressiveness and state incoherence. For each such attribute different five fuzzy categories are defined. These are labeled â€œVery High,â€ â€œHigh,â€ â€œMedium,â€ â€œLow,â€ and â€œVery Low.â€ Pseudocode for this process is below.

The first task is to calculate the count, sum of values, and sum of values squared. In pseudocode it may be presented as,

foreach entity_type

foreach entity_type.fuzzy_attribute

foreach entity_type.member

with entity_type.fuzzy_attribute

.count

:= .count + 1

.sum

:= .sum + entity_type.member.value.fuzzy_attribute

.sumsq

:= .sumsq + entity_type.member.value.fuzzy_attribute ** 2

end with

next

next

next

This information will be used to calculate the standard deviation, and from there to create the fuzzy objects. The fuzzy categories for each fuzzy attribute are defined by a center point and a deviation. The more moderate, the closer to the center point and the less the deviation. This reflects the stabilization affect of moderation and the erratic nature of extremism. In pseudocode it may be written as,

foreach entity_type

foreach entity_type.fuzzy_attribute

with entity_type.fuzzy_attribute

center

:= .sum / .count

stddev

:= sqrt(.sumsq / .count – ( .sum / .count) ** 2 ) )

.VLow

:= new fuzzyCategory(center – stddev * 2 , stddev * 2.0)

.Low

:= new fuzzyCategory(center – stddev , stddev * 1.5)

.Moderate

:= new fuzzyCategory(center , stddev )

.VHigh

:= new fuzzyCategory(center – stddev , stddev * 1.5)

.High

:= new fuzzyCategory(center + stddev * 2 , stddev * 2.0)

end with

next

next

The constructor simple defines the center and deviation for each fuzzy category.

Perl lacks a solid publicly available fuzzy logic module. This required more coding than with other languages, and made code less abstracted that would be preferable. In particular comparison functions had be to written to implement fuzzy comparison.

Attributes of objects are compared against these fuzzy categories. For example, take the following example of testing to see whether a nation disintegrates. The pseudocode is,

foreach nation

if

nation’s polarization is greater than “very high polarization”

and

nation’s health is less than “very low health”

splinter nation

end if

next

In the above example, disintegration occurs when a nation is polarized between extremes and very unhealthy. These are both fuzzy concepts â€“polarization and and health both in a continuum. Both the categories and entity attributes are fuzzy, and cannot be given any one precise value. Physically, the numbers are compared using the mean and deviation declared. Abstracted, a fuzzy, or â€œsubjectiveâ€ objective, judgment is made comparison the nation’s health with the category of very high health.

Fuzzy logic proved invaluable as a method of working with values that are not definite. The use of a language with a fully supported fuzzy logic component would assist this project even more.

**Computer Science Thesis Index**