Beispiel #1
0
        /// <summary>
        /// Calculates the actual value of openness after considering the current emotional state
        /// </summary>
        /// <param name="openness">The raw openness value of the bot</param>
        /// <param name="emotions">The emotions of the bot</param>
        /// <returns>The new value of openness</returns>
        private double emotionalAffectedOpenness(double openness, EmotionTree emotions)
        {
            //Emotions here are based on the emotions affected by openness
            //the /2 at the end of the following line is worked out from the number of emotions invovled divided by 2.
            //because the maximum range of the addition is +- (num of emotions /2)
            double emotionalBonus = (emotions[EmotionType.Pride] + emotions[EmotionType.Shame] + emotions[EmotionType.Admiration] + emotions[EmotionType.Reproach]) / 2;

            return(cleanedDouble(openness - emotionalBonus));
        }
Beispiel #2
0
        /// <summary>
        /// Calculates the actual value of neuroticism after considering the current emotional state
        /// </summary>
        /// <param name="neuroticism">The raw neuroticism value of the bot</param>
        /// <param name="emotions">The emotions of the bot</param>
        /// <returns>The new value of neuroticism</returns>
        private double emotionalAffectedNeuroticism(double neuroticism, EmotionTree emotions)
        {
            //Emotions here are based on neuroticism's effect on emotions
            //the /2 at the end of the following line is worked out from the number of emotions invovled divided by 2.
            //because the maximum range of the addition is +- (num of emotions /2)
            double emotionalBonus = (emotions[EmotionType.Distress] - emotions[EmotionType.Joy] - emotions[EmotionType.Gratification] + emotions[EmotionType.Remorse]) / 2;

            return(cleanedDouble(neuroticism + emotionalBonus));
        }
Beispiel #3
0
        /// <summary>
        /// Calculates the actual value of agreeableness after considering the current emotional state
        /// </summary>
        /// <param name="agreeableness">The raw agreeableness value of the bot</param>
        /// <param name="emotions">The emotions of the bot</param>
        /// <returns>The new value of agreeableness</returns>
        private double emotionalAffectedAgreeableness(double agreeableness, EmotionTree emotions)
        {
            //Emotions here are based on those affected by agreeableneess
            //the /5 at the end of the following line is worked out from the number of emotions invovled divided by 2.
            //because the maximum range of the addition is +- (num of emotions /2)
            double emotionalBonus = (emotions[EmotionType.Joy] - emotions[EmotionType.Distress] + emotions[EmotionType.Love] - emotions[EmotionType.Hate] +
                                     emotions[EmotionType.HappyFor] - emotions[EmotionType.Resentment] + emotions[EmotionType.Admiration] - emotions[EmotionType.Reproach] +
                                     emotions[EmotionType.Gratitude] - emotions[EmotionType.Anger]) / 5;

            return(cleanedDouble(agreeableness + emotionalBonus));
        }
Beispiel #4
0
        /// <summary>
        /// Calculates the actual value of conscientiousness after considering the current emotional state
        /// </summary>
        /// <param name="conscientiousness">The raw conscientiousness value of the bot</param>
        /// <param name="emotions">The emotions of the bot</param>
        /// <returns>The new value of conscientiousness</returns>
        private double emotionalAffectedConscientiousness(double conscientiousness, EmotionTree emotions)
        {
            //Emotions here are based on the emotions affected by conscientiousness AND the notion that
            //you are more likely to abandon standards in times of stress, and more liekly to stick to standards
            //in times of happyness
            //the /3 at the end of the following line is worked out from the number of emotions invovled divided by 2.
            //because the maximum range of the addition is +- (num of emotions /2)
            double emotionalBonus = (emotions[EmotionType.Pride] - emotions[EmotionType.Distress] + emotions[EmotionType.Joy] - emotions[EmotionType.Shame]
                                     + emotions[EmotionType.Admiration] - emotions[EmotionType.Reproach] - emotions[EmotionType.Anger] + emotions[EmotionType.Admiration]) / 3;

            return(cleanedDouble(conscientiousness + emotionalBonus));
        }
Beispiel #5
0
        /// <summary>
        /// Calculates the utility of an action based both on the personality of a bot
        /// and it's current emotional state and the attributes of the action
        /// </summary>
        /// <param name="agent">The agent evaluating the utility of an action</param>
        /// <returns>The utility of an action</returns>
        public double Utility(PersonalityModel personality)
        {
            double      utility  = 0;
            EmotionTree emotions = personality.Emotions;

            // We believe that emotions and personality have a two-way relationship. Personality affects ones emotions
            // but emotions also effect one's personality. For example, you are less likely to be agreeable if you are
            // angry. The first step here is to calculate a personality value based on the agent's emotions. Then normalise
            // to a value between -1 and 1.
            double o = normalise(emotionalAffectedOpenness(personality.Openness, emotions), 0, 1, -1, 1);
            double c = normalise(emotionalAffectedConscientiousness(personality.Conscientiousness, emotions), 0, 1, -1, 1);
            double i = normalise(personality.Introversion, 0, 1, -1, 1);
            double a = normalise(emotionalAffectedAgreeableness(personality.Agreeableness, emotions), 0, 1, -1, 1);
            double n = normalise(emotionalAffectedNeuroticism(personality.Neuroticism, emotions), 0, 1, -1, 1);

            //Debug output - print out the original personality attributes and their processed value
            Console.WriteLine("===========================" + this.ToString() + "==============================");
            Console.WriteLine("Normalising variables...");
            Console.WriteLine(String.Format("Openness {0}->{1}, Conscientiousness {2}->{3}, Introversion {4}->{5}, Agreeableness {6}->{7}, Neuroticism {8}->{9}",
                                            personality.Openness.ToString(), o.ToString(), personality.Conscientiousness.ToString(), c.ToString(), personality.Introversion.ToString(),
                                            i.ToString(), personality.Agreeableness.ToString(), a.ToString(), personality.Neuroticism.ToString(), n.ToString()));

            //For each attribute of the action, work out the utility associated with it.
            utility += utilityAddition(o, Familiarity);
            utility += utilityAddition(c, Correctness);
            //The personality model uses the opposite of extraversion, so reverse the values
            utility += utilityAddition(i, -1 * Gregariousness);
            utility += utilityAddition(i, -1 * Assertiveness);
            utility += utilityAddition(i, -1 * Excitement);
            //Console.Write("Straightforwardness bonus:");
            //utility += utilityAddition(a, _straightforwardness) ;
            utility += utilityAddition(a, Altruism);
            utility += utilityAddition(a, Compliance);
            utility += utilityAddition(a, Modesty);
            utility += utilityAddition(n, Temptation);

            Console.WriteLine("Final utility: " + utility.ToString());
            return(utility);
        }