Modeling Opinion Flow in Humans Using Boids Algorithm & Social Network Analysis

By Skip Cole

Introduction

Given the opinions and desires of a non-player character (actors), it is possible to devise a cost-benefit calculation to decide what they are likely to do. This is a common problem in Game AI and much good work has already been done on this. But this supposes a fixed set of opinions (beliefs) in the actors. We would like to allow the actors to evolve and change their opinions over time, just as real people do. We also want to replicate the fact that while the opinions people hold are often understandable, they are not always rational. In this paper we introduce a methodology to do just this.

Modeling opinion flow is a big topic. People’s opinions are understandably multi-faceted and complex. Here we are saying dash to this complexity and reducing the decisions on one particular issue (the topic at hand) to one simple number. At the end of the day in our game universe, one supports King John, supports King Richard, or doesn’t particularly support anyone. If the bulk of the population supports King John, then his troops will receive more resources – and that is an effect that can be felt by King Richard1.

To perform our calculation, we are borrowing concepts from the Boids algorithm and from Social Network Analysis. This technique makes possible new types of conflict, such as a Public Relations battle, and can make concrete the ‘battle for hearts and minds.’

People's opinions are influenced by events, but also by what they perceive to be the opinions of the people around them — people tend to believe what the people around them believe. The central analogy of this paper is that just as birds, fish, and other animals move their bodies in groups, humans move their opinions in groups2. Animals flock with their bodies. People flock in their opinions.


A bird that strays from the flock
will change its course to move
back toward the flock, even as the
flock may begin to veer toward it.
Most people feel uncomfortable if
their thinking is too far unaligned
from that of the group, and will try
(either by trying to change the
group or their own thinking) to
minimize that distance.

This technique can be applied to large populations or small populations. A large population example could be an entire population of a country and their support of a particular armed militia group. (If the player can reduce public support for the militia, its resources will decrease.) A small population example could be the actors around a key decision maker. (If the player can locate and change the opinions of the people around the decision maker, it will be possible to influence the decision maker.) Both examples will be explored here.

Brief Explanation of Boids algorithm

Boids Algorithm, with only a few simple parameters, accurately replicates the movement of flocks of birds and schools of fishes. The movement appears so realistic that it won an Academy Award in 1987 in the movie “Batman Returns.”

Highly complex behavior can be explained by the simple reactions of many independent agents all working with incomplete information. The movement of an opinion in a society may also appear to be incredibly complex, but it also the result of many independent agents making straightforward calculations with incomplete information.

In Table 1 is a mapping of the Boids Effect, and the effect on thought as modeled here.

Force

Boids Effect

Effect on Thought

Alignment

Birds steer in the general direction of the group.

People tend to give credence to an idea shared by many people. They build their picture of what the ‘group’ thinks based on information from their news sources.

Cohesion

Birds move toward their near by flock mates.

People tend toward the ideas of the people they respect.

Separation

Birds maintain a safe distance from their flock mates.

People maintain a distance from ideas held by people for whom they have contempt.

Table 1 . Boids Effect vs. Effect on Human Thought


In a sense we are applying Newton’s second law of motion (Force = mass * acceleration)
to ‘ideas’ which have no mass. Ideas do, however, have a velocity. Sometimes ideas move fast – such as 'my
Internet stock isn’t worth as much as I thought it was. I better sell.’ Sometimes ideas move slowly – such as ‘women should have the right to vote.’ Although universal suffrage may now seem like common sense to most of us, it was an idea that took centuries to become accepted.

Boids is a physical model and the Boids effects create forces, which influence the movement of the animal. For example, a bird seeing that it is falling behind will begin to accelerate until it catches up with the flock.

Our forces will provide a propensity for the opinion of an individual to move in a particular direction. If there are people close to me that hold a particular opinion, then I will be likely to hold that same opinion. If I hold a different opinion, I will have to mentally justify it to myself in some way (such as thinking I have information that they don’t have.) The brain is a muscle, and mental justifications don’t come free. So the easy thing, and the typical thing, is to just give in and accept the ‘conventional wisdom’ and to fly with the rest of the flock.

There is a separate, and quite important, consideration in the Boids algorithm. The birds only have information regarding the other birds in their field of vision. We will model this by providing all of the members of our virtual society a connectivity score to all of the other members. This type of approach is common in social network analysis, and is explained further in the next section.


Elements of Social Network Analysis that we are Using

Social Network Analysis (SNA) is a fairly new science. It is fairly intuitive. (It has to be. It is a science about us!) We all live in groups and communicate with the people around us.

From the entire SNA tool kit, below are the few elements that we will be using.






















Element 1. Actors

The basis of all social networks is the Actor. In general, Actors are people, but not always so. Our actors will be people and news sources.

The composition of the actors is an important question that the game designer will have to answer: How many actors will be prone to radicalization or will just plain not change their mind on the topic at hand?


Figure 1 . An actor can be an individual or news source.

Element 2. Connections

The idea of 'connections' between people is intuitive. Most people feel connected to the people around them; their family, friends, co-workers, etc. Measuring 'connectivity' is difficult, and relationships do not need to be symmetrical. (Jim may respect Bill, but Bill may have no respect for Jim.) But we will assume its possible to get an idea of an average number of connections that the actors have.

When considering the connectivity important for opinion flow two things will generally be important: frequency of communication and the respect the partners hold for each other in the topic at hand.

In our model, a high positive connection strength will indicate respect, and a high negative number will indicate contempt.


Figure 2. Actors have connections.

Element 3. Networks

Groups of connected individuals form a network.

In this study we won’t group the people in family units, tribal units, or other sorts of hierarchies – although that is possible to do. Instead we will take the simple approach that in the large population connections are basically random, and in a small population the game creator will dictate it.


Figure 3. Groups of actors form networks.

Force Calculation

As mentioned in the introduction, we are reducing the actor’s opinions on the topic at hand into one simple number. We will call this number the alignment score. Some people believe strongly in an idea. Others are lukewarm, or may believe in the opposite. The strength of someone’s belief influences how likely they are to transmit it to others3.

The scale selected for the alignment scores is arbitrary. One simply has to be able to indicate people who support or disagree with an opinion, and indicate how strong they are in their opinions. An example scale is shown in Table 2. On this scale +1 indicates a normal follower of King John and +3 a radical follower.

 

+3

+2

+1

0

-1

-2

-3

Strong Belief

 


 


 


 


 


Strong Disbelief


Table 2. Initial alignment scores will need to be assigned to the actors.

We will calculate the average alignment felt by the actor (weighted by the strength of their connections) and then measure the distance from that to the actor’s current alignment. If there is no difference (for example, if the people around an actor support King John, and he or she already supports King John) then they will feel no force to change their opinion.

 

Force = Average Alignment felt by Actor – Actors Alignment


Figure 4. The force pulling on the actor comes from their distance from the crowd.

We are getting the ‘crowd opinion’ from what the actor sees around him or her. There will be a component roughly analogous to each of the terms in the Boids algorithm:

Total Force = Force (alignment) + Force (cohesion) + Force (separation)

Force Alignment

Calculate the force on an actor based on what they perceive to be the majority opinion.

Force Cohesion

Calculate the average alignment on the topic at hand across all of the individuals nearby that this individual respects.

Force Separation

Calculate the average alignment on the topic at hand across all of the individuals nearby for which this individual has contempt.

Table 3. Review of forces acting on an individual.

By allowing actors to be either other individuals or news sources, we are effectively combining our forces of cohesion and alignment, respectively. Originally it was considered that the force of alignment would be the force that the nebulous ‘them’ out there have. For example, someone in the communist Soviet Union would have had know that there were millions of capitalists. That knowledge could make one reassess that the people nearby are saying ‘communism beats capitalism.’

But one has to consider that we only know about the nebulous ‘them’ from our news sources. Since some leaders seek to control news sources, knowledge of the nebulous ‘them’ may be restricted. It is better to treat these news sources, and the respect that an actor may have for them, individually.


Example Force Calculation

A simple example may help make this method seem more concrete.

We will consider the very simple universe of one college student named Charlie. He has two professors. We will focus only on the forces coming from them4.






















Charlie has two professors: Prof A and Prof B. Charlie is influenced by what they think and his relation with them. (They are not influenced by what Charlie thinks, so we show no arrow going from Charlie to them.)

In our first example, Charlie has equal respect (weight 1) for both professors. We must normalize the strength of each connection across the sum of all connections.

Sum of All Connections = 1 + 1

Normalized Strength of Prof A = 1 / (1+1) = .5
Normalized Strength of Prof B = 1 / (1+1) = .5

If both professors have an alignment score (1) toward a particular idea (say a belief in King John), then there will be a force acting on Charlie to believe similarly. In our simple construction, the total force will be:

Avg. Weighted Alignment = (.5 * 1)+(.5 * 1) = 1
Force = 1 – 0 = 1

There will be a net force pulling on Charlie to believe King John is the rightful king.

If however, one of the professors had an idea score
of -1 (say he believes King Richard should be king) then the total forces on Charlie will cancel out.

Avg. Weighted Alignment = (.5 * 1)+(.5 * -1) = 0
Force = 0 – 0 = 0

There is no force pulling on him, since the two people he respects equally have opposing views.

If Charlie finds out some disturbing information about Prof A, and his respect turns to contempt (connectivity of –1) then the forces on him will change again. Now the total forces on him will be –2. His contempt for Prof A pushes him away from the ideas held by Prof A, and his respect for Prof B, pulls him closer to the idea held by Prof B.

Avg. Weighted Alignment = (-.5 * 1)+(.5 * -1) = -1
Force = -1 – (0) = -1

Charlie is pulled in the direction of King Richard.

 


Allowing Opinions to Change

Now that we have create a way to determine the force on an actor pulling him or her in a particular direction, it is time to allow the actors to actually move in their opinions.

The force we calculated will be used to generate a probability that the individual moves in his or thinking in one way or another. The proportionality constant we use will need to be selected to provide realistic movement in the opinions in the actors.

Probability of Change of Opinion = proportionality constant * Force

We will propagate this effect through multiple rounds. Each time step we will calculate the forces on each individual, and determine if this leads them to move in their opinion5.

The ‘time step’ selected can be any one desired (daily, weekly, monthly, etc.). The probabilities to change should roughly correlate with the time scale, and the profundity of the topic at hand. It’s not likely that most individuals re-assess deeply held beliefs daily, but they may monthly or yearly. If the topic at hand is not deep (should I sell off my overvalued Internet stock) then that is a decision that can be checked more frequently.

Basic Technique

  • Create a population of ‘person’ objects.
    • May be a population of one or more types of actors.
    • You may want to enter details about the characteristics (composition) of the various actors.
  • Establish and normalize the linkages amongst the population members.
    • Create random connections between actors.
    • Randomly assign the strength of the connections. A positive number indicates that the first actor respects the second actor. A negative number indicates contempt.
    • Normalize the connections so their sum total equals 1.
  • Establish the initial alignments (the opinion regarding the topic at hand).
  • Loop over all individuals
    • For each individual, calculate the forces acting on them.
    • Based on the forces, determine randomly if the person changes in their alignment.
  • Repeat step 4 at each time step in the game.

How far an actor moves when they do change opinion is an interesting question. In real life any distance is possible. For the purpose of the game simulation, we will just say that when an actor moves, her or she will move one unit in the direction of the weighted average that they see around them.

Whether or not someone overshoots the crowd average and becomes a radical is really more a question of their composition. Are they someone who is ready to become a radical? The number of people ready for radicalization in a society can be something the game creator enters, and have these people respond differently to movements in thought - they will take things to an even higher level.

How the Player Interacts with All of This

We have created a system, like a school of fish swimming in a pool, that can move and fluctuate on its own. This is interesting, but of course the game will be in the player trying to direct that movement. King Richard wants people to accept that he is the rightful king. People advocating a particular idea, such as universal suffrage or democracy, want other people to accept that idea.

In some cases, the player may choose to interact ‘up close and personal’ with those who disagree with their point of view. A game creator could create a population of 1000 people in which 10 of these people will continually strive to thwart the player. The game could be for the player to locate and convince the spoilers (with a flame thrower or rocket propelled grenade) to stop trying to thwart him. Note: collateral damage may have adverse affects.

Other, subtler, techniques can also be made available to the player. A partial list of possibilities is given below. You may think of others.

Category

Effect

Providing Aid

Someone is more inclined to believe someone for whom they have frequent contact and respect. Providing Aid is a way of establishing a good relationship. This can fail if it is perceived as trying to ‘buy affection’ but if done correctly it can help move a population over to your side.

Disgracing Opponent

If a player can change the respect that the non-player characters have for a spoiler into contempt, then one can effectively reverse their affect. If they can destroy the credibility of their opponent, they can mitigate their influence.

Events

A specific event in characters life (for example, seeing the fall of the Berlin Wall, or seeing their parents murdered) can have profound influence on their views. But.. (and this is a very large ‘but’)
What generally matters more than an event is how that event is translated via the news services (see “News” below)

Indoctrination/Training

Courses can be used to affect the way people believe.

News

How news arrives also greatly influences its affect.
The same news (the ownership of a castle has changing hands) could presented as “The murderous and villainous forces of King Richard have via treachery taking castle x” or “King John's weak and ill-fed forces where no match to the superior might of King Richard's noble lancers.”
The player can influence which news reaches the bulk of the population. Obviously, news has to come from a respected source for it to have much weight.

Removal

Termination or Incarceration of the enemy actor.

Table 4. Methods in which the player may interact to change opinions in the population of actors.


Examples and Results

Small Population Example – Baron KingMaker
Our small population example is the network of people around the ‘King Maker’ the person who can to a large part decide who will be made king. In other games, this person could be the King, or a Prime Minister, Warlord, etc. A diagram of our network is shown in Figure 5. All connections around the Baron are positive. (He doesn’t allow people he doesn’t like into his inner circle).


Figure 5 . The people around Baron KingMaker, and how much he values their opinions.

Other than the influence on the Baron there are very few connections. Advisor 1 and Advisor 2 do not like each other, and so almost always offer opposing opinions – which is why the Baron does not pay much attention to them. The Baron’s wife’s opinion flows entirely from her hairdresser – who has a surprising amount of influence in this game world. The hairdresser’s opinion in turn could be partially derived from the average public opinion6. The player may be able during the game to discover the influence of the hairdresser, and lobby her directly.

For a network this small, it is easy to calculate the average alignment seen by the Baron. The total of all connections going to the Baron is 20, so we will sum the alignment score of each individual times the weight of their connection divided by 20.

Avg. Alignment = AlignAdvisor1 * (1 / 20) + AlignAdvisor2 * (1/20) + AlignAdvisor3 * (5/20) + AlignWife * (6/20) + AlignProtege1 * (1/20) + AlignProtege2 * (1/20) + AlignMentor * (5/20)

The average alignment around the Baron may be used to help determine his responses. For example, if the people around the Baron are pushing him in one direction, it might not take quite as much gold from the player to push him further in that direction. We have not tried this, but it may work well in open ended and non-structured games such as never ending quests.

Large Population Results – Books and Battles
John and Richard compete to convince an overwhelming majority of the public that they are the rightful heir and king. A population is set up with its opinions generally mixed. At round 50, an influential writer prints a treatise explaining why King John is the rightful king. On round 100, King Richard takes a castle (which many perceive as a Kingly thing to do.) Battles and Books don’t normally come together in the game world, but we are bringing them together in our simulated court of public opinion.

In Figure 6 is shown some example results. Each of the 5 runs shown had populations of 10,000 actors. The average number of links each actor had was around 20. The computation time to do all 150 game rounds took about 100 seconds, so during a normal game this would be a negligible amount of time. The set up of the random links did take 5 minutes for the first population and then three and half minutes thereafter. So the set up is something that we will look further into how to optimize.


Figure 6 . Five runs of populations of 10,000 people influenced by the events of King John and King Richard.

 

Large Population Results – Schism
Humans tend to self-segregate. Even in multi-cultural societies, members of one group may feel superior to members of another group, and do things to differentiate themselves. The existence of groups indicates that there will be more linkages on average inside a group than across the group boundary. In terms of ideas, this may mean that an idea generally accepted in one group may not necessarily be desirable in the other group.

For our large heterogeneous population example, we have a population of 10,000 people. Alphas make up 10% of the population. They have a high degree of contempt for the betas, and that is reciprocated7. In our example, something that was not open to discuss has suddenly became something that people can have an opinion. When only ‘Coke’ exists, one can only pick ‘Coke’. Once ‘Pepsi’ arrives, there can be revolution in the air, and people can have an opinion on which is better.

Figure 7 shows how the average alignments re-adjust when something that not a question is now open for discussion. In this example the Alphas have a vested interested in maintaining the old system. (See the section on Leadership following this article.) To help represent this in the game world, we are not letting 20 of the Alphas (because they benefit so greatly from the current system) change their opinions.


Figure 7 . Our populations of Alphas and Betas in general hold different opinions on the topic at hand.

In our small toy universe we have demonstrated the viral spread of ideas, and recreated the reformation.


Optimizing the Calculation

There are three aspects that can be optimized; the realisticness of the simulation, the speed at which the simulation runs, and the amount of memory consumed.

Realisticness

We will continue to develop this method and formulate ways to increase its realisticness. Since this method does rely upon emergent behavior, it is good to consider all of the different places it can be tweaked. These are listed below. Fortunately, we have found that it is not too hard to get the types of results shown in the ‘Results’ section above.

Areas where this method can be tweaked.

Speed

Several methods have already been used to speed up the calculations.

As we come up with more they will be posted on the web site accompanying this method, along with sample code implementing them.

Memory
Memory is highly dependent upon the number of actors, and the average number of linkages that each actor has. It is also the place much future optimization will be done. Below are some preliminary figures.


Conclusion

We have presented here a simple, but workable, model with which to model the flow of an important opinion in a population of humans. It can be used with populations small or large, homogeneous or heterogeneous.

This work is the first that I know of in which a social network is the raw substrate for a dynamic simulation. As such it represents just the beginning of study. But even in its initial form we can use it to help create realistic game worlds.

Of course, this work represents just another step toward a Matrix type complete simulation of the world of humans. We can’t yet model accurately all people and their interactions yet, so we use a simplified model (connections, assessments, alignments, etc.) Placing our players in ever more realistic game worlds promises to make the games more intuitive and instantly engaging. This trend will only continue.

For Further Information

Source Code

Software to run these types of simulations is located at http://www.skipcole.com/modeling_opinion_flow. It is covered under the GNU public license, so it is free for you to use.

It is probable that you will need to modify it for your own particular purposes. Since the code is set up as interfaces, and one can overwrite the methods that create the connections and initial alignments, going to higher levels of detail should not be difficult.

Continuing Work

On the site listed above we will continue to improve this code and more features. Future refinements may include:

  1. Allowing linkages between individuals to change over time. Linkages may even be formed as ‘like minded’ individuals come together.
  2. Improving the terms that may affect the composition of the actors. For example:
    • Demographic data may be used to help refine the percentage of the population that are likely to change their minds on topics, or be susceptible to radicalization (as under employed young men tend to be.)
    • Population dependent things such as literacy rate, education and critical thinking skills may effect the influence of written literature and how well ideas permeate from those sources into the general population.
  3. Handling the interrelatedness of ideas. If one is interested in changing opinion, sometimes it may be necessary to not tackle things, but first remove ideas that tend to support the idea that you are trying to change. This is common in argument. How to decompose ideas, at least as far as they are part of the common cultural psyche, is an interesting and potentially fruitful area of study.
  4. Input from actual members from a population. If these simulations ever grow large enough and contain real world examples, it may be possible to allow the actual participants to plug in and indicate how they feel on a topic.

References

We have eclectically cobbled together ideas from many disciplines. The references below have been essential reading.


The Missing Topics: Truth, Leadership and Expediency

Truth

The astute reader will have noticed that the inherit 'truth' of an idea has not been mentioned in this paper. While having an idea be correct may be useful when trying to spread it, correctness is not the final word. People have believed in many weird things that we now can see are incorrect, or that we disagree with on moral grounds. (Millions of people followed Hitler. Millions of people can be wrong.) The ‘truth’ may win out in the long run, but that long run may be a very long time.

Communism is a good example of this. Any economist could, in just a few minutes, explain why communism produces less that capitalism. But it took over 40 years of the Soviet Union for that lesson to come out, and it still hasn't come out in some parts of the world.

How can inherently wrong ideas have such long shelf life? Some ideas are probably just sticky. Communism, for example, sounds great at first. There are probably plenty of other reasons. Here we offer two reason that can be particularly powerful, and open the door to further investigation.

Leadership

When a group of people have vested interest in maintaining an idea — no matter how silly it is — then that idea will continue to have some weight for a long time. Leaders by their very nature command respect and the ideas that they espouse will generally gain some traction in their followers. Leaders can also try to limit the contact that a group has with the outside world – thus minimizing the effect of contacts outside of the group8.

People who find an idea expedient, because it justifies their claim to power or access to resources, will in general become great proponents of that idea. This can work for good as well for bad. For example someone who thinks he can win in a free and fair election will be a great advocate of democracy9.

Expediency

Leaders are not the only people who can find an idea expedient. For example, many people find the idea that ‘our problems are not our fault, but the result of those people over there’ to be expedient psychologically. The sweet psychological candy of scapegoating is a powerful force. It can relieve one group of blame and responsibility, and helps some of their politicians gain power.

Footnotes

  1. Feel free while reading this paper to interchange the names King John and King Richard, with your favorite decision of choice. Some examples may be ‘Coke beats Pepsi’, ‘democracy vs. insurgency’ or ‘capitalism vs. communism.’
  2. Another way to look at this is to think of the ‘pool’ of people to be a ‘pool’ in which ideas and opinions (memes) move around. Memes move from person to person as they infect each other with them. This formulation is equivalent. It all depends on who one thinks of as the intelligent agent; the people or the memes.
  3. The author believes that much of this transmittal of opinions is done without even conscious intention. For example, if someone rolls their eyes when they hear the name of a particular candidate, they are sending a message to the people around them. And it is a signal that people pick up on. Since much opinion flow comes from non-verbal signals, it stands to reason that logical well-constructed verbal arguments have little to do with why people believe what they believe.
  4. Since this universe is so small, we will not have a ‘news source’ reflecting the term for a ‘crowd average.’
  5. This may lead to Person A changing their opinion in large part due to the force on them from Person B, while at the same instant person B is changing their opinion due to the influence of Person C, but that is acceptable.
  6. In physical terms, this is as considering her in the bath of public opinion.
  7. It doesn’t have to be. It depends on the culture. The elites may have contempt for the commoners, while the commoners have simultaneously have respect for the elites.
  8. Many people believe that relationships are important when trying to change a society. Using the method presented her, and social network analysis, we can begin to quantify that importance.
  9. To minimize the psychological dissonance that comes from saying one thing and believing another, the democracy promoter may come to believe in democracy even if they did not at first.

Return to the full version of this article
Copyright © UBM Tech, All rights reserved