Class MotivationalComponent

  • All Implemented Interfaces:
    FAtiMA.Core.componentTypes.IAppraisalDerivationComponent, FAtiMA.Core.componentTypes.IComponent, FAtiMA.Core.componentTypes.IModelOfOtherComponent, FAtiMA.DeliberativeComponent.IProbabilityStrategy, FAtiMA.DeliberativeComponent.IUtilityStrategy, FAtiMA.DeliberativeComponent.strategies.IActionFailureStrategy, FAtiMA.DeliberativeComponent.strategies.IExpectedUtilityStrategy, FAtiMA.DeliberativeComponent.strategies.IGoalFailureStrategy, FAtiMA.DeliberativeComponent.strategies.IGoalSuccessStrategy, java.io.Serializable, java.lang.Cloneable

    public class MotivationalComponent
    extends java.lang.Object
    implements java.io.Serializable, java.lang.Cloneable, FAtiMA.Core.componentTypes.IAppraisalDerivationComponent, FAtiMA.Core.componentTypes.IModelOfOtherComponent, FAtiMA.DeliberativeComponent.strategies.IExpectedUtilityStrategy, FAtiMA.DeliberativeComponent.IProbabilityStrategy, FAtiMA.DeliberativeComponent.IUtilityStrategy, FAtiMA.DeliberativeComponent.strategies.IGoalSuccessStrategy, FAtiMA.DeliberativeComponent.strategies.IGoalFailureStrategy, FAtiMA.DeliberativeComponent.strategies.IActionFailureStrategy
    Implements the character's motivational state.
    Author:
    Meiyii Lim, Samuel Mascarenhas
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      MotivationalComponent​(java.util.ArrayList<java.lang.String> extraFiles)
      Creates an empty MotivationalState
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addActionEffectsOnDrive​(java.lang.String action, java.lang.String driveName, FAtiMA.Core.wellFormedNames.Symbol target, float value)  
      void addExpectedGoalEffectOnDrive​(java.lang.String goal, short effectType, java.lang.String driveName, FAtiMA.Core.wellFormedNames.Symbol target, float value)  
      void AddMotivator​(Motivator motivator)
      Adds a motivator to the MotivationalState
      void appraisal​(FAtiMA.Core.AgentModel am, FAtiMA.Core.sensorEffector.Event e, FAtiMA.Core.emotionalState.AppraisalFrame as)  
      FAtiMA.Core.Display.AgentDisplayPanel createDisplayPanel​(FAtiMA.Core.AgentModel am)  
      FAtiMA.Core.componentTypes.IComponent createModelOfOther()  
      static double determineQuadraticNeedVariation​(float currentLevel, float deviation)  
      float getCompetence​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      java.lang.String[] getComponentDependencies()  
      float getContributionToNeeds​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      float getExpectedUtility​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      float getExpectedUtility​(FAtiMA.Core.AgentModel am, FAtiMA.DeliberativeComponent.Intention i)  
      float GetIntensity​(short type)
      Gets the received motivator's intensity, i.e.
      Motivator GetMotivator​(short motivatorType)  
      Motivator[] getMotivators()  
      float GetNeedUrgency​(java.lang.String agentName, short type)
      Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
      float getProbability​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      float getProbability​(FAtiMA.Core.AgentModel am, FAtiMA.DeliberativeComponent.Intention i)  
      float getUtility​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      float GetWeight​(short type)
      Gets the received motivator's weight, i.e.
      void initialize​(FAtiMA.Core.AgentModel am)  
      void inverseAppraisal​(FAtiMA.Core.AgentModel am, FAtiMA.Core.emotionalState.AppraisalFrame af)  
      java.lang.String name()  
      void perceiveActionFailure​(FAtiMA.Core.AgentModel am, FAtiMA.Core.plans.Step a)  
      void perceiveGoalFailure​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      void perceiveGoalSuccess​(FAtiMA.Core.AgentModel am, FAtiMA.Core.goals.ActivePursuitGoal g)  
      float PredictCompetenceChange​(boolean succeed)  
      FAtiMA.Core.emotionalState.AppraisalFrame reappraisal​(FAtiMA.Core.AgentModel am)  
      void reset()  
      java.util.ArrayList<FAtiMA.Core.wellFormedNames.SubstitutionSet> searchEventsWithAppraisal​(FAtiMA.Core.AgentModel am, FAtiMA.Core.wellFormedNames.Symbol subjectVariable, FAtiMA.Core.wellFormedNames.Symbol actionVariable, FAtiMA.Core.wellFormedNames.Symbol targetVariable, FAtiMA.Core.wellFormedNames.Symbol paramVariable, float desirability)  
      java.lang.String toXml()
      Converts the motivational state to XML
      void update​(FAtiMA.Core.AgentModel am, long time)  
      void update​(FAtiMA.Core.AgentModel am, FAtiMA.Core.sensorEffector.Event e)  
      void UpdateCertainty​(float expectation)
      Update the agent's certainty value
      void UpdateCompetence​(boolean succeed)
      Calculates the agent's competence about a goal
      float UpdateMotivators​(FAtiMA.Core.AgentModel am, FAtiMA.Core.sensorEffector.Event e)
      Updates the intensity of the motivators based on the event received
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _motivators

        protected Motivator[] _motivators
      • _lastTime

        protected long _lastTime
      • _goalTried

        protected int _goalTried
      • _goalSucceeded

        protected int _goalSucceeded
      • _appraisals

        protected java.util.HashMap<java.lang.String,​java.lang.Float> _appraisals
      • _actionEffectsOnDrives

        protected java.util.HashMap<java.lang.String,​ActionEffectsOnDrives> _actionEffectsOnDrives
    • Constructor Detail

      • MotivationalComponent

        public MotivationalComponent​(java.util.ArrayList<java.lang.String> extraFiles)
        Creates an empty MotivationalState
    • Method Detail

      • determineQuadraticNeedVariation

        public static double determineQuadraticNeedVariation​(float currentLevel,
                                                             float deviation)
      • addActionEffectsOnDrive

        public void addActionEffectsOnDrive​(java.lang.String action,
                                            java.lang.String driveName,
                                            FAtiMA.Core.wellFormedNames.Symbol target,
                                            float value)
      • addExpectedGoalEffectOnDrive

        public void addExpectedGoalEffectOnDrive​(java.lang.String goal,
                                                 short effectType,
                                                 java.lang.String driveName,
                                                 FAtiMA.Core.wellFormedNames.Symbol target,
                                                 float value)
      • AddMotivator

        public void AddMotivator​(Motivator motivator)
        Adds a motivator to the MotivationalState
      • appraisal

        public void appraisal​(FAtiMA.Core.AgentModel am,
                              FAtiMA.Core.sensorEffector.Event e,
                              FAtiMA.Core.emotionalState.AppraisalFrame as)
        Specified by:
        appraisal in interface FAtiMA.Core.componentTypes.IAppraisalDerivationComponent
      • createDisplayPanel

        public FAtiMA.Core.Display.AgentDisplayPanel createDisplayPanel​(FAtiMA.Core.AgentModel am)
        Specified by:
        createDisplayPanel in interface FAtiMA.Core.componentTypes.IComponent
      • createModelOfOther

        public FAtiMA.Core.componentTypes.IComponent createModelOfOther()
        Specified by:
        createModelOfOther in interface FAtiMA.Core.componentTypes.IModelOfOtherComponent
      • getCompetence

        public float getCompetence​(FAtiMA.Core.AgentModel am,
                                   FAtiMA.Core.goals.ActivePursuitGoal g)
      • getComponentDependencies

        public java.lang.String[] getComponentDependencies()
        Specified by:
        getComponentDependencies in interface FAtiMA.Core.componentTypes.IComponent
      • getContributionToNeeds

        public float getContributionToNeeds​(FAtiMA.Core.AgentModel am,
                                            FAtiMA.Core.goals.ActivePursuitGoal g)
      • getExpectedUtility

        public float getExpectedUtility​(FAtiMA.Core.AgentModel am,
                                        FAtiMA.Core.goals.ActivePursuitGoal g)
        Specified by:
        getExpectedUtility in interface FAtiMA.DeliberativeComponent.strategies.IExpectedUtilityStrategy
      • getExpectedUtility

        public float getExpectedUtility​(FAtiMA.Core.AgentModel am,
                                        FAtiMA.DeliberativeComponent.Intention i)
        Specified by:
        getExpectedUtility in interface FAtiMA.DeliberativeComponent.strategies.IExpectedUtilityStrategy
      • GetIntensity

        public float GetIntensity​(short type)
        Gets the received motivator's intensity, i.e. the current level of the motivator
        Returns:
        a float value corresponding to the motivator's intensity
      • GetMotivator

        public Motivator GetMotivator​(short motivatorType)
      • getMotivators

        public Motivator[] getMotivators()
      • GetNeedUrgency

        public float GetNeedUrgency​(java.lang.String agentName,
                                    short type)
        Gets the motivator's urgency discretizing the need intensity into diffent categories (very urgent, urgent, not urgent, satisfied)
        Returns:
        a multiplier corresponding to the motivator's urgency
      • getProbability

        public float getProbability​(FAtiMA.Core.AgentModel am,
                                    FAtiMA.Core.goals.ActivePursuitGoal g)
        Specified by:
        getProbability in interface FAtiMA.DeliberativeComponent.IProbabilityStrategy
      • getProbability

        public float getProbability​(FAtiMA.Core.AgentModel am,
                                    FAtiMA.DeliberativeComponent.Intention i)
        Specified by:
        getProbability in interface FAtiMA.DeliberativeComponent.IProbabilityStrategy
      • getUtility

        public float getUtility​(FAtiMA.Core.AgentModel am,
                                FAtiMA.Core.goals.ActivePursuitGoal g)
        Specified by:
        getUtility in interface FAtiMA.DeliberativeComponent.IUtilityStrategy
      • GetWeight

        public float GetWeight​(short type)
        Gets the received motivator's weight, i.e. how important is the motivator to the agent
        Returns:
        a float value corresponding to the motivator's weight
      • initialize

        public void initialize​(FAtiMA.Core.AgentModel am)
        Specified by:
        initialize in interface FAtiMA.Core.componentTypes.IComponent
      • inverseAppraisal

        public void inverseAppraisal​(FAtiMA.Core.AgentModel am,
                                     FAtiMA.Core.emotionalState.AppraisalFrame af)
        Specified by:
        inverseAppraisal in interface FAtiMA.Core.componentTypes.IAppraisalDerivationComponent
      • name

        public java.lang.String name()
        Specified by:
        name in interface FAtiMA.Core.componentTypes.IComponent
      • perceiveActionFailure

        public void perceiveActionFailure​(FAtiMA.Core.AgentModel am,
                                          FAtiMA.Core.plans.Step a)
        Specified by:
        perceiveActionFailure in interface FAtiMA.DeliberativeComponent.strategies.IActionFailureStrategy
      • perceiveGoalFailure

        public void perceiveGoalFailure​(FAtiMA.Core.AgentModel am,
                                        FAtiMA.Core.goals.ActivePursuitGoal g)
        Specified by:
        perceiveGoalFailure in interface FAtiMA.DeliberativeComponent.strategies.IGoalFailureStrategy
      • perceiveGoalSuccess

        public void perceiveGoalSuccess​(FAtiMA.Core.AgentModel am,
                                        FAtiMA.Core.goals.ActivePursuitGoal g)
        Specified by:
        perceiveGoalSuccess in interface FAtiMA.DeliberativeComponent.strategies.IGoalSuccessStrategy
      • PredictCompetenceChange

        public float PredictCompetenceChange​(boolean succeed)
      • reappraisal

        public FAtiMA.Core.emotionalState.AppraisalFrame reappraisal​(FAtiMA.Core.AgentModel am)
        Specified by:
        reappraisal in interface FAtiMA.Core.componentTypes.IAppraisalDerivationComponent
      • reset

        public void reset()
        Specified by:
        reset in interface FAtiMA.Core.componentTypes.IComponent
      • toXml

        public java.lang.String toXml()
        Converts the motivational state to XML
        Returns:
        a XML String that contains all information in the motivational state
      • update

        public void update​(FAtiMA.Core.AgentModel am,
                           FAtiMA.Core.sensorEffector.Event e)
        Specified by:
        update in interface FAtiMA.Core.componentTypes.IComponent
      • update

        public void update​(FAtiMA.Core.AgentModel am,
                           long time)
        Specified by:
        update in interface FAtiMA.Core.componentTypes.IComponent
      • UpdateCertainty

        public void UpdateCertainty​(float expectation)
        Update the agent's certainty value
        Parameters:
        expectation - - ranges from -1 to 1, -1 means complete violation of expectation while 1 means complete fulfillment of expectation Changed the factor from 10 to 3 (Meiyii)
      • UpdateCompetence

        public void UpdateCompetence​(boolean succeed)
        Calculates the agent's competence about a goal
        Parameters:
        succeed - - whether a goal has succeeded, true is success, and false is failure
      • UpdateMotivators

        public float UpdateMotivators​(FAtiMA.Core.AgentModel am,
                                      FAtiMA.Core.sensorEffector.Event e)
        Updates the intensity of the motivators based on the event received
      • searchEventsWithAppraisal

        public java.util.ArrayList<FAtiMA.Core.wellFormedNames.SubstitutionSet> searchEventsWithAppraisal​(FAtiMA.Core.AgentModel am,
                                                                                                          FAtiMA.Core.wellFormedNames.Symbol subjectVariable,
                                                                                                          FAtiMA.Core.wellFormedNames.Symbol actionVariable,
                                                                                                          FAtiMA.Core.wellFormedNames.Symbol targetVariable,
                                                                                                          FAtiMA.Core.wellFormedNames.Symbol paramVariable,
                                                                                                          float desirability)