Click here to Skip to main content
15,867,765 members
Articles / Programming Languages / Visual Basic

DecisionMatrix

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
20 Feb 2020CPOL3 min read 4.3K   151   8  
Short economics game to analyze human behavior and approach to simulate NPC decision making
This is a game experiment that was created in order to analyze how well agents are able to converge towards an optimal solution to meet a need. This is a game containing a bunch of subjects, and a bunch of decisions to be made on an individual basis. The goal of any one subject is to, by the end of the game, possess a favorable amount of capital.

Image 1

Introduction

What motivates human behavior? Maslow's hierarchy of needs is one of the best-known theories of motivation. According to humanist psychologist Abraham Maslow, our actions are motivated in order to achieve certain needs. This is an endeavor to analyze human behavior and simulate decision making.

This is a game experiment created in order to analyze how well agents are able to converge towards an optimal solution to a problem. This is a game containing a bunch of subjects, and a bunch of decisions to be made on an individual basis. The goal of any one subject is to, by the end of the game, possess a favorable (or at least positive) amount of capital.

Overview

This article presents a multiple criteria decision making analysis that contributes to the selection of the most convenient supplier (i.e., Nightclub, Saloon, Bank, Bedroom, Bathroom, etc.) to meet certain needs. The ability of these potential suppliers to meet an Agent need is evaluated based upon the supplier's individual feature sets.

Rather than only taking into account the cost factor in typical games, here we have appropriately determined our needs and weighted those needs to come up with criteria that aids in the supplier selection process. Suppliers are identified, the considered weights are assessed, along with the decision maker’s preferences and existing constraints.

The variants are ranked in terms of their suitability using a DecisionMatrix. The results obtained from this simulation experiment suggest that this methodology is a feasible Non-Playable Character(NPC) decision support model.

Simulation

In this game, there are two groups: the Alive group and Dead group. The Alive group will always receive a constant amount of capital in each round, whereas the Dead group will lose any amount they may have gained (i.e., Loot). A game has an indefinite number of rounds, or until all the agents are dead.

At each turn, Agents must consume some kind of Food (Bread counts) and some kind of Water (Liquor counts) to survive. Agents move around the Map. Agents Trade with each-other, and Loot other dead Agents. When only one Agent is left surviving, they are marked as the winner.

Dead Agents are shown as a '-', where as Alive agents are shown as '+'. Other entities (i.e., suppliers) are denoted by capitalized letters ((B)ank, (S)chool, (X)Home, etc.) .

Agent Needs

Needs are categorized according to Maslow's Need Chart. In this example, we are classifying 5 basic needs as Physical, Esteem, Safety, Growth, and Social. Although there could be more, each need consists of only two factors.

VB.NET
#Region "Physical"
          ''' <summary>
          ''' Gets the total sum of all edible foods carried
          ''' </summary>
          Public Property Food() As Integer

          ''' <summary>
          ''' Gets the total sum of all potable liquids carried
          ''' </summary>
          Public Property Water() As Integer
#End Region

#Region "Esteem"
          ''' <summary>
          ''' Gets the total sum of all Achievements
          ''' </summary>
          Public Property Achievements() As Integer
       
          ''' <summary>
          ''' Gets the total sum of all currencies carried
          ''' </summary>
          Public Property Wealth() As Integer
#End Region

#Region "Safety"
          ''' <summary>
          ''' Gets the total sum of all Generations
          ''' </summary>
          Public Property Generations() As Integer
   
          ''' <summary>
          ''' Gets the total sum of all Health
          ''' </summary>
          Public Property Health() As Integer
#End Region

#Region "Growth"
          ''' <summary>
          ''' Gets the total sum of all Skills
          ''' </summary>
          Public Property Skills() As Integer

          ''' <summary>
          ''' Gets the total sum of all Education
          ''' </summary>
          Public Property Education() As Integer
#End Region

#Region "Social"
          ''' <summary>
          ''' Gets the total sum of all Perceptions
          ''' </summary>
          Public Property Perceptions() As Integer
 
          ''' <summary>
          ''' Gets the total sum of all Relationships
          ''' </summary>
          Public Property Relationships() As Integer
#End Region

Evaluate

For each Update, an Agent will Evaluate and assign weights based on its current status. This allows the agent to define its decision matrix. The decision matrix is a classification algorithm. This helps the agent to figure out which supplier to choose. The agent must evaluate and calculate its needs and preference. Preference allows us to randomize Agent outcomes to an even greater degree.

VB.NET
Public Overridable Sub Evaluate()
       EvaluatePhysical()
       EvaluateEsteem()
       EvaluateSafety()
       EvaluateGrowth()
       EvaluateSocial()

       Dim TotalValues As Double = _Physical.Value + _Esteem.Value + ...

       _Physical.Weight = _Physical.Value / TotalValues
       _Esteem.Weight = _Esteem.Value / TotalValues
       _Safety.Weight = _Safety.Value / TotalValues
       _Growth.Weight = _Growth.Value / TotalValues
       _Social.Weight = _Social.Value / TotalValues

       '' Add additional weight proportionate to preference
       Select Case Preference
            Case FeatureTypes.Break, FeatureTypes.Home, FeatureTypes.Cook, ...
                 _Physical.Weight += 3

            Case FeatureTypes.Dance, FeatureTypes.Drink, FeatureTypes.Eat, ...
                 _Social.Weight += 3

            Case FeatureTypes.Deposit, FeatureTypes.Shop
                 _Esteem.Weight += 3

            Case FeatureTypes.Learn
                 _Growth.Weight += 3

            Case FeatureTypes.Work
                 _Safety.Weight += 3

       End Select
  End Sub

Decision

Once the Agent has Evaluated its needs, it must then make a decision. The decision process starts with a specified set of alternatives assessed on pseudo-criteria and aggregates the preferential data into a fuzzy
outranking relation.

Once started, a distinct number of suppliers are created. The supplier selection criteria and alternatives are predefined. For every criterion, the direction of preference has to be specified. The value of the preference should be set in descending. For example, if an agent's hunger increases, then the preference to satisfy that need should increase and its preference to fall in comparison.

VB.NET
For Each item In lst ...
                              ' Calculate needs influenced by what the Character values
                              Dim Name As String = item.Name

                              Dim PhysicalValue As Double = item.Features.Physical
                              Dim EsteemValue As Double = item.Features.Esteem
                              Dim SafetyValue As Double = item.Features.Safety
                              Dim GrowthValue As Double = item.Features.Growth
                              Dim SocialValue As Double = item.Features.Social

                              item.Features.Value = (PhysicalValue * Physical.Weight) +
                                             (EsteemValue * Esteem.Weight) +
                                              (SafetyValue * Safety.Weight) +
                                               (GrowthValue * Growth.Weight) +
                                                (SocialValue * Social.Weight)
                         Next item

                         ' Sort values
                         Manager.Instance.Logger.Debug($"=========[{Name}]===========")
                         Dim DecisionList As IOrderedEnumerable(Of Entity) = From p In lst
                                   Order By p.Features.Value Descending

Summary

Maslow's hierarchy of needs is a motivational theory in psychology comprising a five-tier model of human needs, often depicted as hierarchical levels within a pyramid. This experiment has attempted to encapsulate the basic principles of Maslow's theory into a game whereby NPC models can Evaluate and determine how best to meet their own unique needs.

History

  • 20th February, 2020: Initial version

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Arkitech EBC Corporation
United States United States
MS, BBA, software developer, consultant, and trainer. Specializing in building data-centric applications designed for business, university, community & faith based organizations. Started developing Excel VBA macros and never looked back. Freelance developer utilizing VB.Net, SQL Server, Microsoft Access, and ASP.Net.

Comments and Discussions

 
-- There are no messages in this forum --