65.9K
CodeProject 正在变化。 阅读更多。
Home

决策矩阵

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1投票)

2020年2月20日

CPOL

3分钟阅读

viewsIcon

5099

downloadIcon

205

一个简短的经济学游戏,用于分析人类行为以及模拟 NPC 决策过程的方法。

引言

什么驱动人类行为?马斯洛的需求层次理论是最著名的动机理论之一。根据人本主义心理学家亚伯拉罕·马斯洛的说法,我们的行为是为了满足某些需求而被驱动的。这是一个分析人类行为并模拟决策的尝试。

这是一个游戏实验,旨在分析智能体在解决问题的过程中,能够多好地趋向于最优解。这是一个包含许多主体,并且需要在个体基础上做出许多决定的游戏。任何一个主体的目标是,在游戏结束时,拥有有利的(或至少是积极的)资本额。

概述

本文介绍了一种多标准决策分析方法,该方法有助于选择最方便的供应商(即,夜总会、酒吧、银行、卧室、浴室等)来满足某些需求。这些潜在供应商满足智能体需求的能力是根据供应商的个体特征集进行评估的。

我们没有像典型游戏中那样只考虑成本因素,而是适当地确定了我们的需求,并对这些需求进行了加权,从而提出了有助于供应商选择过程的标准。确定了供应商,评估了所考虑的权重,以及决策者的偏好和现有约束。

使用 DecisionMatrix,根据变体的适用性对其进行排名。从这个模拟实验中获得的结果表明,这种方法是一种可行的非玩家角色 (NPC) 决策支持模型。

模拟

在这个游戏中,有两个组:活着组和死亡组。活着组将在每一轮中始终收到固定数量的资本,而死亡组将失去他们可能获得的任何数量(即,掠夺物)。一个游戏有无限轮数,或者直到所有智能体都死亡。

在每一回合,智能体必须消耗某种食物(面包算)和某种水(酒算)才能生存。智能体在地图上移动。智能体彼此交易,并掠夺其他死亡的智能体。当只剩下一个智能体存活时,他们会被标记为赢家。

死亡的智能体显示为“-”,而活着的智能体显示为“+”。其他实体(即,供应商)用大写字母表示((B)银行,(S)学校,(X)家等)。

智能体需求

需求根据马斯洛的需求图进行分类。在这个例子中,我们将 5 个基本需求分类为生理、尊重、安全、成长和社交。虽然可能还有更多,但每个需求仅包含两个因素。

#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

评估

对于每次更新,智能体将根据其当前状态评估并分配权重。这允许智能体定义其决策矩阵。决策矩阵是一种分类算法。这有助于智能体确定选择哪个供应商。智能体必须评估并计算其需求和偏好。偏好使我们能够将智能体结果随机化到更大的程度。

        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

决策

一旦智能体评估了其需求,它就必须做出决定。决策过程从一组在伪标准上评估的替代方案开始,并将优先数据聚合为一个模糊
超越关系。

一旦启动,就会创建不同数量的供应商。供应商选择标准和替代方案是预定义的。对于每个标准,必须指定偏好方向。偏好值应按降序设置。例如,如果一个智能体的饥饿感增加,那么满足该需求的偏好应该增加,并且其比较下降的偏好应该增加。

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

摘要

马斯洛的需求层次理论是心理学中的一种动机理论,包括人类需求的五层模型,通常被描绘为金字塔内的层次结构。这个实验试图将马斯洛理论的基本原理封装到一个游戏中,NPC 模型可以通过该游戏评估并确定满足自身独特需求的最佳方式。

历史

  • 2020 年 2 月 20 日:初始版本。

参考文献

© . All rights reserved.