public MainForm() { InitializeComponent(); string[] args = Environment.GetCommandLineArgs(); if (args.Length <= 1) { Reset(true); } else { _saveFileName = args[1]; try { this._emotionalAppraisalAsset = EmotionalAppraisalAsset.LoadFromFile((args[1])); Reset(false); } catch (Exception ex) { MessageBox.Show(ex.Message, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); Reset(true); } } }
//This is a small console program to exemplify the main functionality of the Emotional Appraisal Asset static void Main(string[] args) { AssetManager.Instance.Bridge = new BasicIOBridge(); var kickEvent = "Event(Action-Start, Player, Kick, John)"; // To create a new asset it is required to tell the name of the agent which will correpond to the perspective of the "SELF" EmotionalAppraisalAsset ea = new EmotionalAppraisalAsset("John"); //The following lines add an appraisal rule that will make the kickEvent be perceived as undesirable //Normally, these rules should be authored using the AuthoringTool provided with the asset but they can also be added dynamically var rule = new AppraisalRuleDTO { EventMatchingTemplate = "Event(Action-Start, *, Kick, SELF)", Desirability = -5f, Praiseworthiness = -3f }; ea.AddOrUpdateAppraisalRule(rule); //Emotions are generated by the appraisal of the events that occur in the game world ea.AppraiseEvents(new[] { kickEvent }); Console.WriteLine("\nAfter appraising '" + kickEvent + "'\nWith the appraisal rule '" + rule.EventMatchingTemplate + " Desirability: "+rule.Desirability+ " Praiseworthiness: " + rule.Praiseworthiness + "'"); Console.WriteLine("\nMood on tick '" + ea.Tick + "': " + ea.Mood); Console.WriteLine("Active Emotions: " + string.Concat(ea.ActiveEmotions.Select(e => e.Type + "-" + e.Intensity + " "))); //Each event that is appraised will be stored an the agent's autobiographical memory Console.WriteLine("\nEvents occured so far: " + string.Concat(ea.EventRecords.Select(e => "\nId: " + e.Id + " Event: " + e.Event))); //The update function will increase the current tick by 1. Each active emotion will decay to 0 and the mood will slowly return to 0 for (int i = 0; i < 3; i++) { ea.Update(); Console.WriteLine("\nMood on tick '" + ea.Tick + "': " + ea.Mood); Console.WriteLine("Active Emotions: " + string.Concat(ea.GetAllActiveEmotions().Select(e => e.EmotionType + "-" + e.Intensity + " "))); } //The asset can also be loaded from an existing file using the following method: ea = EmotionalAppraisalAsset.LoadFromFile("../../../Examples/EATest.ea"); Console.ReadKey(); }
protected override void OnAssetDataLoaded(EmotionalAppraisalAsset asset) { //Emotion Dispositions _emotionDispositionsVM = new EmotionDispositionsVM(this); comboBoxDefaultDecay.SelectedIndex = comboBoxDefaultDecay.FindString(_emotionDispositionsVM.DefaultDecay.ToString()); comboBoxDefaultThreshold.SelectedIndex = comboBoxDefaultThreshold.FindString(_emotionDispositionsVM.DefaultThreshold.ToString()); dataGridViewEmotionDispositions.DataSource = _emotionDispositionsVM.EmotionDispositions; //Appraisal Rule _appraisalRulesVM = new AppraisalRulesVM(this); dataGridViewAppraisalRules.DataSource = _appraisalRulesVM.AppraisalRules; EditorTools.HideColumns(dataGridViewAppraisalRules, new[] { PropertyUtil.GetPropertyName <AppraisalRuleDTO>(dto => dto.Id), PropertyUtil.GetPropertyName <AppraisalRuleDTO>(dto => dto.Conditions) }); conditionSetEditor.View = _appraisalRulesVM.CurrentRuleConditions; dataGridViewGoals.DataSource = new BindingListView <GoalDTO>(LoadedAsset.GetAllGoals().ToList()); // if(dynamicPropertyListing.TabPages.Count > 1) // dynamicPropertyListing.TabPages.RemoveAt(1); _wasModified = false; }
public void Appraisal(EmotionalAppraisalAsset emotionalModule, IBaseEvent evt, IWritableAppraisalFrame frame) { AppraisalRule selfEvaluation = Evaluate(evt, emotionalModule.Kb); if (selfEvaluation != null) { if (selfEvaluation.Desirability != 0) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, selfEvaluation.Desirability); } //if (selfEvaluation.DesirabilityForOther != 0) //{ // string other; // if (selfEvaluation.Other != null) // other = selfEvaluation.Other.ToString(); // else if (evt.Target != null) // other = evt.Target; // else // other = evt.Subject; // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER + other, selfEvaluation.DesirabilityForOther); //} if (selfEvaluation.Praiseworthiness != 0) { frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, selfEvaluation.Praiseworthiness); } //if (selfEvaluation.Like != 0) // frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, selfEvaluation.Like); } }
/// <summary> /// Loads the associated assets from the defined sources and prevents further authoring of the asset /// </summary> public void LoadAssociatedAssets() { var charName = CharacterName.ToString(); EmotionalAppraisalAsset ea = Loader(m_emotionalAppraisalAssetSource, () => new EmotionalAppraisalAsset()); EmotionalDecisionMakingAsset edm = Loader(m_emotionalDecisionMakingAssetSource, () => new EmotionalDecisionMakingAsset()); SocialImportanceAsset si = Loader(m_socialImportanceAssetSource, () => new SocialImportanceAsset()); CommeillFautAsset cfa = Loader(m_commeillFautAssetSource, () => new CommeillFautAsset()); m_emotionalAppraisalAsset = ea; m_emotionalDecisionMakingAsset = edm; m_socialImportanceAsset = si; m_commeillFautAsset = cfa; MCTSAsset mcts = new MCTSAsset(); //Dynamic properties BindToRegistry(m_kb); edm.RegisterKnowledgeBase(m_kb); si.RegisterKnowledgeBase(m_kb); cfa.RegisterKnowledgeBase(m_kb); mcts.RegisterKnowledgeBase(m_kb); m_allowAuthoring = false; }
public SocialImportanceAsset() { m_ea = null; m_attributionRules = new AttributionRule[0]; m_claimTree = new NameSearchTree <float>(); m_cachedSI = new NameSearchTree <NameSearchTree <float> >(); }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { _currentFilePath = null; _storage = new AssetStorage(); _loadedAsset = EmotionalAppraisalAsset.CreateInstance(_storage); OnAssetDataLoaded(); }
public MainForm() { InitializeComponent(); _storage = new AssetStorage(); _loadedAsset = EmotionalAppraisalAsset.CreateInstance(_storage); OnAssetDataLoaded(); }
/// <summary> /// Updates the character's mood when a given emotion is "felt" by the character. /// </summary> /// <param name="emotion">the ActiveEmotion that will influence the agent's current mood</param> public void UpdateMood(ActiveEmotion emotion, EmotionalAppraisalAsset parent) { if (!emotion.InfluenceMood) return; float scale = (float)emotion.Valence; SetMoodValue(this._intensity + scale * (emotion.Intensity * parent.EmotionInfluenceOnMoodFactor),parent); }
public AppraisalRulesVM(EmotionalAppraisalAsset ea) { _emotionalAppraisalAsset = ea; this.AppraisalRules = new BindingListView <AppraisalRuleDTO>(new List <AppraisalRuleDTO>()); this.CurrentRuleConditions = new BindingListView <ConditionDTO>(new List <ConditionDTO>()); this.SelectedRuleId = Guid.Empty; RefreshData(); }
public void SetMoodValue(float value,EmotionalAppraisalAsset parent) { value = value < -10 ? -10 : (value > 10 ? 10 : value); if (Math.Abs(value) < parent.MinimumMoodValueForInfluencingEmotions) value = 0; this._intensityATt0 = this._intensity = value; this._tickT0 = parent.Tick; }
public AppraisalRulesVM(EmotionalAppraisalAsset ea) { _ea = ea; this.AppraisalRules = new BindingListView <AppraisalRuleDTO>(new List <AppraisalRuleDTO>()); this.CurrentRuleConditions = new ConditionSetView(); this.CurrentRuleConditions.OnDataChanged += CurrentRuleConditions_OnDataChanged; this.SelectedRuleId = Guid.Empty; RefreshData(); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var aux = EditorTools.OpenFileDialog("Asset Storage File (*.json)|*.json|All Files|*.*"); if (aux != null) { _currentFilePath = aux; _storage = AssetStorage.FromJson(File.ReadAllText(_currentFilePath)); _loadedAsset = EmotionalAppraisalAsset.CreateInstance(_storage); OnAssetDataLoaded(); } }
public void RegisterEmotionalAppraisalAsset(EmotionalAppraisalAsset eaa) { if (m_ea != null) { //Unregist bindings RemoveKBBindings(); m_ea = null; } m_ea = eaa; PerformKBBindings(); }
public KnowledgeBaseVM(EmotionalAppraisalAsset ea) { _emotionalAppraisalAsset = ea; var beliefList = ea.Kb.GetAllBeliefs().Select(b => new BeliefDTO { Name = b.Name.ToString(), Perspective = b.Perspective.ToString(), Value = b.Value.ToString() }).ToList(); this.Beliefs = new BindingListView <BeliefDTO>(beliefList); }
/// <summary> /// Binds an Emotional Appraisal Asset (EAA) to this Social Importance Asset instance. /// Without a EAA instance binded to this asset, social importance evaluations will not /// work. /// InvalidateCachedSI() is automatically called by this method. /// </summary> /// <param name="eaa">The Emotional Appraisal Asset to be binded to this asset.</param> public void BindEmotionalAppraisalAsset(EmotionalAppraisalAsset eaa) { if (m_ea != null) { //Unregist bindings RemoveKBBindings(); m_ea = null; } m_ea = eaa; PerformKBBindings(); InvalidateCachedSI(); }
private void Reset(bool newFile) { if (newFile) { this.Text = Resources.MainFormPrincipalTitle; this._emotionalAppraisalAsset = new EmotionalAppraisalAsset(DEFAULT_PERSPECTIVE); } else { this.Text = Resources.MainFormPrincipalTitle + Resources.TitleSeparator + _saveFileName; } //Emotional State Tab _emotionalStateVM = new EmotionalStateVM(_emotionalAppraisalAsset); this.textBoxPerspective.Text = _emotionalStateVM.Perspective; this.richTextBoxDescription.Text = _emotionalAppraisalAsset.Description; this.moodValueLabel.Text = Math.Round(_emotionalStateVM.Mood).ToString(MOOD_FORMAT); this.moodTrackBar.Value = (int)float.Parse(this.moodValueLabel.Text); this.textBoxStartTick.Text = _emotionalStateVM.Start.ToString(); this.emotionsDataGridView.DataSource = _emotionalStateVM.Emotions; //Emotion Dispositions _emotionDispositionsVM = new EmotionDispositionsVM(_emotionalAppraisalAsset); comboBoxDefaultDecay.SelectedIndex = comboBoxDefaultDecay.FindString(_emotionDispositionsVM.DefaultDecay.ToString()); comboBoxDefaultThreshold.SelectedIndex = comboBoxDefaultThreshold.FindString(_emotionDispositionsVM.DefaultThreshold.ToString()); dataGridViewEmotionDispositions.DataSource = _emotionDispositionsVM.EmotionDispositions; //Appraisal Rule _appraisalRulesVM = new AppraisalRulesVM(_emotionalAppraisalAsset); dataGridViewAppraisalRules.DataSource = _appraisalRulesVM.AppraisalRules; dataGridViewAppraisalRules.Columns[PropertyUtil.GetName <BaseDTO>(dto => dto.Id)].Visible = false; dataGridViewAppraisalRules.Columns[PropertyUtil.GetName <AppraisalRuleDTO>(dto => dto.Conditions)].Visible = false; dataGridViewAppraisalRules.Columns[PropertyUtil.GetName <AppraisalRuleDTO>(dto => dto.QuantifierType)].Visible = false; dataGridViewAppRuleConditions.DataSource = _appraisalRulesVM.CurrentRuleConditions; dataGridViewAppRuleConditions.Columns[PropertyUtil.GetName <BaseDTO>(dto => dto.Id)].Visible = false; comboBoxQuantifierType.DataSource = _appraisalRulesVM.QuantifierTypes; //KB _knowledgeBaseVM = new KnowledgeBaseVM(_emotionalAppraisalAsset); dataGridViewBeliefs.DataSource = _knowledgeBaseVM.Beliefs; dataGridViewBeliefs.Columns[PropertyUtil.GetName <BaseDTO>(dto => dto.Id)].Visible = false; //AM _autobiographicalMemoryVM = new AutobiographicalMemoryVM(_emotionalAppraisalAsset); dataGridViewAM.DataSource = _autobiographicalMemoryVM.Events; }
internal ConfigStore(Platform platform = Platform.Windows) { Platform = platform; ConfigValues = new Dictionary <ConfigKey, float>(); var configText = Templates.ResourceManager.GetString("config"); var contractResolver = new PrivatePropertyResolver(); var settings = new JsonSerializerSettings { ContractResolver = contractResolver }; ConfigValues = JsonConvert.DeserializeObject <Dictionary <ConfigKey, float> >(configText, settings); foreach (var key in (ConfigKey[])Enum.GetValues(typeof(ConfigKey))) { if (!ConfigValues.ContainsKey(key)) { throw new Exception("Config key " + key + " not included in config!"); } } BoatTypes = new Dictionary <string, List <Position> >(); var boatText = Templates.ResourceManager.GetString("boat_config"); BoatTypes = JsonConvert.DeserializeObject <Dictionary <string, List <Position> > >(boatText); GameConfig = new GameConfig().GetConfig(); NameConfig = new NameConfig().GetConfig(); Avatar.Config = new AvatarGeneratorConfig().GetConfig(); AssetManager.Instance.Bridge = new TemplateBridge(); RolePlayCharacter = RolePlayCharacterAsset.LoadFromFile("template_rpc"); EmotionalAppraisal = EmotionalAppraisalAsset.LoadFromFile("template_ea"); EmotionalDecisionMaking = EmotionalDecisionMakingAsset.LoadFromFile("template_edm"); SocialImportance = SocialImportanceAsset.LoadFromFile("template_si"); IntegratedAuthoringTool = IntegratedAuthoringToolAsset.LoadFromFile("template_iat"); switch (Platform) { case Platform.Android: AssetManager.Instance.Bridge = new AndroidBaseBridge(); break; case Platform.iOS: AssetManager.Instance.Bridge = new IOSBaseBridge(); break; case Platform.Windows: AssetManager.Instance.Bridge = new BaseBridge(); break; } }
public void LoadAssociatedAssets(AssetStorage storage) { var charName = CharacterName.ToString(); m_emotionalAppraisalAsset = EmotionalAppraisalAsset.CreateInstance(storage); m_emotionalDecisionMakingAsset = EmotionalDecisionMakingAsset.CreateInstance(storage); m_socialImportanceAsset = SocialImportanceAsset.CreateInstance(storage); m_commeillFautAsset = CommeillFautAsset.CreateInstance(storage); //Dynamic properties BindToRegistry(m_kb); m_emotionalDecisionMakingAsset.RegisterKnowledgeBase(m_kb); m_commeillFautAsset.RegisterKnowledgeBase(m_kb); m_socialImportanceAsset.RegisterKnowledgeBase(m_kb); }
public void InverseAppraisal(EmotionalAppraisalAsset emotionalModule, IAppraisalFrame frame) { float desirability = frame.GetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY); float praiseworthiness = frame.GetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS); if (desirability != 0 || praiseworthiness != 0) { var eventName = frame.AppraisedEvent.EventName.ApplyPerspective(emotionalModule.Perspective); AppraisalRule r = new AppraisalRule(eventName, null); r.Desirability = desirability; r.Praiseworthiness = praiseworthiness; //r.EventObject = frame.AppraisedEvent.ToIdentifierName().RemovePerspective(emotionalModule.Perspective); AddEmotionalReaction(r); } }
/// <summary> /// Decays the mood according to the agent's simulated time /// </summary> /// <returns>the mood's intensity after being decayed</returns> public void DecayMood(EmotionalAppraisalAsset parent) { if (this._intensityATt0 == 0) { this._intensity = 0; return; } var delta = (parent.Tick - this._tickT0); double lambda = Math.Log(parent.HalfLifeDecayConstant)/parent.MoodHalfLifeDecayTime; _intensity = (float)(this._intensityATt0 * Math.Exp(lambda*delta)); if(Math.Abs(this._intensity) < parent.MinimumMoodValueForInfluencingEmotions) { this._intensity = this._intensityATt0 = 0; this._tickT0 = 0; } }
//This is a small console program to exemplify the main functionality of the Emotional Appraisal Asset static void Main(string[] args) { var kickEvent = Name.BuildName("Event(Action-End, John, *, *)"); EmotionalAppraisalAsset ea = EmotionalAppraisalAsset.LoadFromFile("../../../Examples/EA-Tutorial/EATest.ea"); //The following lines add an appraisal rule that will make the kickEvent be perceived as undesirable //Normally, these rules should be authored using the AuthoringTool provided with the asset but they can also be added dynamically /* var rule = new AppraisalRuleDTO {EventMatchingTemplate = (Name)"Event(Action-End, [s], *, *)", Desirability = (Name)"4"}; * ea.AddOrUpdateAppraisalRule(rule); */ var am = new AM(); var kb = new KB((Name)"John"); kb.Tell(Name.BuildName("Likes(Mary)"), Name.BuildName("John"), Name.BuildName("SELF")); var emotionalState = new ConcreteEmotionalState(); //Emotions are generated by the appraisal of the events that occur in the game world ea.AppraiseEvents(new[] { kickEvent }, emotionalState, am, kb); Console.WriteLine("\nMood on tick '" + am.Tick + "': " + emotionalState.Mood); Console.WriteLine("Active Emotions: " + string.Concat(emotionalState.GetAllEmotions().Select(e => e.EmotionType + "-" + e.Intensity + " "))); //Each event that is appraised will be stored in the autobiographical memory that was passed as a parameter Console.WriteLine("\nEvents occured so far: " + string.Concat(am.RecallAllEvents().Select(e => "\nId: " + e.Id + " Event: " + e.EventName.ToString()))); //The update function will increase the current tick by 1. Each active emotion will decay to 0 and the mood will slowly return to 0 for (int i = 0; i < 3; i++) { am.Tick++; emotionalState.Decay(am.Tick); Console.WriteLine("\nMood on tick '" + am.Tick + "': " + emotionalState.Mood); Console.WriteLine("Active Emotions: " + string.Concat(emotionalState.GetAllEmotions().Select(e => e.EmotionType + "-" + e.Intensity + " "))); } //The asset can also be loaded from an existing file using the following method: ea = EmotionalAppraisalAsset.LoadFromFile("../../../Examples/EA-Tutorial/EATest.ea"); Console.ReadKey(); }
private void buttonSetEmotionalAppraisalSource_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { try { var ea = EmotionalAppraisalAsset.LoadFromFile(ofd.FileName); _rpcAsset.EmotionalAppraisalAssetSource = ofd.FileName; textBoxEmotionalAppraisalSource.Text = ofd.FileName; } catch (Exception ex) { MessageBox.Show(ex.Message + "-" + ex.StackTrace, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog(); if (ofd.ShowDialog() == DialogResult.OK) { try { _emotionalAppraisalAsset = EmotionalAppraisalAsset.LoadFromFile(ofd.FileName); _saveFileName = ofd.FileName; Reset(false); } catch (Exception ex) { MessageBox.Show(ex.Message + "-" + ex.StackTrace, Resources.ErrorDialogTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private static RolePlayCharacterAsset BuildEmotionalRPCAsset() { var kb = new KB((Name)"Matt"); var ea = new EmotionalAppraisalAsset(); var appraisalRule = new EmotionalAppraisal.DTOs.AppraisalRuleDTO() { Conditions = new Conditions.DTOs.ConditionSetDTO(), EventMatchingTemplate = (Name)"Event(*, *,*, *)", Desirability = Name.BuildName(2), Praiseworthiness = Name.BuildName(2) }; ea.AddOrUpdateAppraisalRule(appraisalRule); var rpc = new RolePlayCharacterAsset { BodyName = "Male", VoiceName = "Male", CharacterName = (Name)"Matt", m_kb = kb, }; rpc.m_emotionalAppraisalAsset = ea; rpc.BindToRegistry(rpc.m_kb); EmotionalDecisionMakingAsset edm = new EmotionalDecisionMakingAsset(); SocialImportanceAsset si = new SocialImportanceAsset(); CommeillFautAsset cfa = new CommeillFautAsset(); rpc.m_emotionalAppraisalAsset = ea; rpc.m_emotionalDecisionMakingAsset = edm; rpc.m_socialImportanceAsset = si; rpc.m_commeillFautAsset = cfa; return(rpc); }
public static RolePlayCharacterAsset LoadFromFile(string filename) { RolePlayCharacterAsset rpc; using (var f = File.Open(filename, FileMode.Open, FileAccess.Read)) { var serializer = new JSONSerializer(); rpc = serializer.Deserialize <RolePlayCharacterAsset>(f); } if (!string.IsNullOrEmpty(rpc.EmotionalAppraisalAssetSource)) { try { rpc._emotionalAppraisalAsset = EmotionalAppraisalAsset.LoadFromFile(rpc.EmotionalAppraisalAssetSource); } catch (Exception ex) { rpc.ErrorOnLoad = "Unable to load the Emotional Appraisal Asset at " + rpc.EmotionalAppraisalAssetSource + ". Check if the path is correct."; return(rpc); } if (!string.IsNullOrEmpty(rpc.EmotionalDecisionMakingSource)) { try { rpc._emotionalDecisionMakingAsset = EmotionalDecisionMakingAsset.LoadFromFile(rpc.EmotionalDecisionMakingSource); } catch (Exception ex) { rpc.ErrorOnLoad = "Unable to load the Emotional Decision Making Asset at " + rpc.EmotionalAppraisalAssetSource + ". Check if the path is correct."; return(rpc); } rpc._emotionalDecisionMakingAsset.RegisterEmotionalAppraisalAsset(rpc._emotionalAppraisalAsset); } } return(rpc); }
public AddOrEditGoalForm(EmotionalAppraisalAsset asset, GoalDTO goalDto) { InitializeComponent(); ea = asset; //Validators textBoxGoalName.AllowNil = false; textBoxGoalName.AllowUniversal = false; if (goalDto != null) { this.Text = "Edit Goal"; buttonAddOrEditGoal.Text = "Update"; goal = goalDto; textBoxGoalName.Value = (Name)goalDto.Name; floatFieldBoxSignificance.Value = goalDto.Significance; floatFieldBoxLikelihood.Value = goalDto.Likelihood; } else { goal = new GoalDTO(); textBoxGoalName.Value = (Name)"g1"; } }
//This is a small console program to exemplify the main functionality of the Emotional Decision Making Asset static void Main(string[] args) { //First we construct a new instance of the EmotionalDecisionMakingAsset class var storage = new AssetStorage(); var edm = EmotionalDecisionMakingAsset.CreateInstance(storage); //Then, we have to register an existing knowledge base to the asset so it can check for //beliefs are true var kb = new KB((Name)"John"); kb.Tell((Name)"LikesToFight(SELF)", (Name)"True"); edm.RegisterKnowledgeBase(kb); //create an action rule var actionRule = new ActionRuleDTO { Action = Name.BuildName("Kick"), Priority = Name.BuildName("4"), Target = (Name)"Player" }; //add the reaction rule var id = edm.AddActionRule(actionRule); var rule = edm.GetActionRule(id); edm.AddRuleCondition(id, "LikesToFight(SELF) = True"); var actions = edm.Decide(Name.UNIVERSAL_SYMBOL); var ea = EmotionalAppraisalAsset.CreateInstance(storage); edm.Save(); using (var writer = File.CreateText("D:\\test2.json")) { writer.Write(storage.ToJson()); } string aux2 = File.ReadAllText("D:\\Test2.json"); var storage2 = AssetStorage.FromJson(aux2); using (var writer = File.CreateText("D:\\test3.json")) { writer.Write(storage2.ToJson()); } Console.WriteLine("Decisions: "); foreach (var a in actions) { Console.WriteLine(a.Name.ToString() + " p: " + a.Utility); } //this is how you can load the asset from a file Console.WriteLine("Loading From File: "); edm.RegisterKnowledgeBase(kb); actions = edm.Decide(Name.UNIVERSAL_SYMBOL); foreach (var a in actions) { Console.WriteLine(a.Name.ToString() + " p: " + a.Utility); } Console.WriteLine("Decisions: "); foreach (var a in actions) { Console.WriteLine(a.Name.ToString() + " p: " + a.Utility); } Console.ReadKey(); }
private static SocialImportanceAsset BuildAsset() { var ea = new EmotionalAppraisalAsset("Matt"); #region Set KB ea.Kb.Tell((Name)"IsPerson(Matt)", true, Name.UNIVERSAL_SYMBOL); ea.Kb.Tell((Name)"IsPerson(Mary)", true, Name.UNIVERSAL_SYMBOL); ea.Kb.Tell((Name)"IsPerson(Diego)", true, Name.UNIVERSAL_SYMBOL); ea.Kb.Tell((Name)"IsPerson(Thomas)", true, Name.UNIVERSAL_SYMBOL); ea.Kb.Tell((Name)"IsPerson(Robot)", true, (Name)"Diego"); ea.Kb.Tell((Name)"IsOutsider(Diego)", true, Name.UNIVERSAL_SYMBOL); ea.Kb.Tell((Name)"IsOutsider(Diego)", false, (Name)"Robot"); ea.Kb.Tell((Name)"AreFriends(Self,Mary)", true, Name.SELF_SYMBOL); ea.Kb.Tell((Name)"AreFriends(Self,Matt)", true, (Name)"Mary"); ea.Kb.Tell((Name)"AreFriends(Self,Thomas)", true, Name.SELF_SYMBOL); #endregion #region SI DTO especification var siDTO = new SocialImportanceDTO { AttributionRules = new[] { new AttributionRuleDTO() { Target = "[target]", Value = 20, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "IsPerson([target]) = true" }, new ConditionDTO() { Condition = "[target] != Self" } } } }, new AttributionRuleDTO() { Target = "[target]", Value = -1, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "IsOutsider([target]) = true" }, new ConditionDTO() { Condition = "[target] != Self" } } } }, new AttributionRuleDTO() { Target = "[target]", Value = 15, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "AreFriends(Self,[target]) = true" } } } }, new AttributionRuleDTO() { Target = "[target]", Value = 10, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "IsClient([target]) = true" }, new ConditionDTO() { Condition = "IsBartender(Self) = true" }, new ConditionDTO() { Condition = "[target] != Self" } } } }, new AttributionRuleDTO() { Target = "[target]", Value = 1, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "IsElder([target]) = true" }, new ConditionDTO() { Condition = "IsElder(Self) = false" } } } }, new AttributionRuleDTO() { Target = "[target]", Value = -1, Conditions = new ConditionSetDTO() { Set = new [] { new ConditionDTO() { Condition = "IsElder([target]) = false" }, new ConditionDTO() { Condition = "IsElder(Self) = true" } } } } } }; #endregion var si = new SocialImportanceAsset(); si.LoadFromDTO(siDTO); si.RegisterEmotionalAppraisalAsset(ea); return(si); }
private static EmotionalAppraisalAsset BuildTestAsset() { var m_emotionalAppraisalAsset = new EmotionalAppraisalAsset(); var joyDisposition = new EmotionDisposition(OCCEmotionType.Joy.Name, 2, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(joyDisposition.ToDto()); var distressDisposition = new EmotionDisposition(OCCEmotionType.Distress.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(distressDisposition.ToDto()); var prideDisposition = new EmotionDisposition(OCCEmotionType.Pride.Name, 5, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(prideDisposition.ToDto()); var shameDisposition = new EmotionDisposition(OCCEmotionType.Shame.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(shameDisposition.ToDto()); var gratificationDisposition = new EmotionDisposition(OCCEmotionType.Gratification.Name, 8, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(gratificationDisposition.ToDto()); var remorseDisposition = new EmotionDisposition(OCCEmotionType.Remorse.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(remorseDisposition.ToDto()); var admirationDisposition = new EmotionDisposition(OCCEmotionType.Admiration.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(admirationDisposition.ToDto()); var reproachDisposition = new EmotionDisposition(OCCEmotionType.Reproach.Name, 8, 2); m_emotionalAppraisalAsset.AddEmotionDisposition(reproachDisposition.ToDto()); var gratitudeDisposition = new EmotionDisposition(OCCEmotionType.Gratitude.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(gratitudeDisposition.ToDto()); var angerDisposition = new EmotionDisposition(OCCEmotionType.Anger.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(angerDisposition.ToDto()); //Setup appraisal rules m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = (Name)"Event(Action-End,*,Pet,SELF)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"10" }, }) }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = (Name)"Event(Action-End,*,Slap,SELF)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"10" } }) }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = (Name)"Event(Action-End,*,Feed,SELF)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"5" }, new AppraisalVariableDTO() { Name = OCCAppraisalVariables.PRAISEWORTHINESS, Value = (Name)"10" } }) }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = (Name)"Event(Action-End,*,Talk(High,Mad),SELF)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"-7" }, new AppraisalVariableDTO() { Name = OCCAppraisalVariables.PRAISEWORTHINESS, Value = (Name)"15" } }) }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = (Name)"Event(Action-End,*,Talk(Low,Happy),SELF)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"5" } }) }); //Generate emotion //m_emotionalAppraisalAsset.AppraiseEvents(new []{ "Event(Action-Finished,Player,Slap,self)" }); //Add knowledge return(m_emotionalAppraisalAsset); }
public void RegisterEmotionalAppraisalAsset(EmotionalAppraisalAsset eaa) { m_emotionalDecisionMaking = eaa; }
/// <summary> /// Decays the emotion according to the system's time /// </summary> /// <returns>the intensity of the emotion after being decayed</returns> internal void DecayEmotion(EmotionalAppraisalAsset parent) { var delta = parent.Tick - tickATt0; double lambda = Math.Log(parent.HalfLifeDecayConstant) /parent.EmotionalHalfLifeDecayTime; float decay = (float)Math.Exp(lambda * this.Decay * delta); Intensity = intensityATt0 * decay; }
///// <summary> ///// Appraises a Goal's success according to the emotions that the agent is experiencing ///// </summary> ///// <param name="hopeEmotion">the emotion of Hope for achieving the goal that the character feels</param> ///// <param name="fearEmotion">the emotion of Fear for not achieving the goal that the character feels</param> ///// <param name="goalImportance">how important is the goal to the agent</param> ///// <param name="evt">The event that triggered the emotion</param> ///// <returns>the emotion created</returns> //private static OCCBaseEmotion AppraiseGoalSuccess(IActiveEmotion hopeEmotion, IActiveEmotion fearEmotion, float goalImportance, uint evt) { // return AppraiseGoalEnd(OCCEmotionType.Satisfaction,OCCEmotionType.Relief,hopeEmotion,fearEmotion,goalImportance,evt); //} ///// <summary> ///// Appraises a Goal's Failure according to the emotions that the agent is experiencing ///// </summary> ///// <param name="hopeEmotion">the emotion of Hope for achieving the goal that the character feels</param> ///// <param name="fearEmotion">the emotion of Fear for not achieving the goal that the character feels</param> ///// <param name="goalImportance">how important is the goal to the agent</param> ///// <param name="evt">The event that triggered the emotion</param> ///// <returns></returns> //public static OCCBaseEmotion AppraiseGoalFailure(IActiveEmotion hopeEmotion, IActiveEmotion fearEmotion, float goalImportance, uint evt) { // return AppraiseGoalEnd(OCCEmotionType.Disappointment,OCCEmotionType.FearsConfirmed,hopeEmotion,fearEmotion,goalImportance,evt); //} ///// <summary> ///// Appraises a Goal's likelihood of succeeding ///// </summary> ///// <param name="e">The event that triggered the emotion</param> ///// <param name="goalConduciveness">???????</param> ///// <param name="prob">probability of sucess</param> ///// <returns></returns> //public static OCCBaseEmotion AppraiseGoalSuccessProbability(uint evt, float goalConduciveness, float prob) { // return new OCCBaseEmotion(OCCEmotionType.Hope, prob * goalConduciveness, evt); //} ///// <summary> ///// Appraises a Goal's likelihood of failure ///// </summary> ///// <param name="e">The event that triggered the emotion</param> ///// <param name="goalConduciveness">???????</param> ///// <param name="prob">probability of failure</param> ///// <returns></returns> //public static OCCBaseEmotion AppraiseGoalFailureProbability(uint evt, float goalConduciveness, float prob) //{ // return new OCCBaseEmotion(OCCEmotionType.Fear, prob * goalConduciveness, evt); //} public IEnumerable<IEmotion> AffectDerivation(EmotionalAppraisalAsset emotionalModule, IAppraisalFrame frame) { var evt = frame.AppraisedEvent; if(frame.ContainsAppraisalVariable(OCCAppraisalVariables.DESIRABILITY) && frame.ContainsAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS)) { float desirability = frame.GetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY); float praiseworthiness = frame.GetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS); var composedEmotion = OCCAppraiseCompoundEmotions(evt, desirability, praiseworthiness); if (composedEmotion != null) yield return composedEmotion; } if(frame.ContainsAppraisalVariable(OCCAppraisalVariables.DESIRABILITY)) { float desirability = frame.GetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY); if(desirability!=0) { yield return OCCAppraiseWellBeing(evt.Id, desirability); //foreach(string variable in frame.AppraisalVariables.Where(v => v.StartsWith(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER))) //{ // string other = variable.Substring(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER.Length); // float desirabilityForOther = frame.GetAppraisalVariable(variable); // if (desirabilityForOther != 0) // yield return OCCAppraiseFortuneOfOthers(evt.Id, desirability, desirabilityForOther, other); //} } } if(frame.ContainsAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS)) { float praiseworthiness = frame.GetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS); if (praiseworthiness != 0) yield return OCCAppraisePraiseworthiness(evt, praiseworthiness); } //if(frame.ContainsAppraisalVariable(OCCAppraisalVariables.LIKE)) //{ // float like = frame.GetAppraisalVariable(OCCAppraisalVariables.LIKE); // if (like != 0) // yield return OCCAppraiseAttribution(evt, like); //} //if(frame.ContainsAppraisalVariable(OCCAppraisalVariables.GOALCONDUCIVENESS)) //{ // float goalConduciveness = frame.GetAppraisalVariable(OCCAppraisalVariables.GOALCONDUCIVENESS); // if(goalConduciveness!=0) // { // var status = frame.GetAppraisalVariable(OCCAppraisalVariables.GOALSTATUS); // if(status == GOALUNCONFIRMED) // { // float prob = frame.GetAppraisalVariable(OCCAppraisalVariables.SUCCESSPROBABILITY); // if (prob != 0) // yield return AppraiseGoalSuccessProbability(evt.Id, goalConduciveness, prob); // prob = frame.GetAppraisalVariable(OCCAppraisalVariables.FAILUREPROBABILITY); // if (prob != 0) // yield return AppraiseGoalFailureProbability(evt.Id, goalConduciveness, prob); // } // else // { // //TODO find a better way to retrive the active emotions, without allocating extra KB // var fear = emotionalModule.EmotionalState.GetEmotion(new OCCBaseEmotion(OCCEmotionType.Fear, 0, evt.Id)); // var hope = emotionalModule.EmotionalState.GetEmotion(new OCCBaseEmotion(OCCEmotionType.Hope, 0, evt.Id)); // if (status == GOALCONFIRMED) // yield return AppraiseGoalSuccess(hope, fear, goalConduciveness, evt.Id); // else if (status == GOALDISCONFIRMED) // yield return AppraiseGoalFailure(hope, fear, goalConduciveness, evt.Id); // } // } //} }
private static RolePlayCharacterAsset BuildEmotionalRPCAsset(int eaSet = -1) { var kb = new KB((Name)"Matt"); var ea = new EmotionalAppraisalAsset(); if (eaSet == -1) { var appraisalRule = new EmotionalAppraisal.DTOs.AppraisalRuleDTO() { Conditions = new Conditions.DTOs.ConditionSetDTO(), EventMatchingTemplate = (Name)"Event(*, *,*, *)", AppraisalVariables = new AppraisalVariables(new List <AppraisalVariableDTO>() { new AppraisalVariableDTO() { Name = OCCAppraisalVariables.DESIRABILITY, Value = (Name)"2" }, new AppraisalVariableDTO() { Name = OCCAppraisalVariables.PRAISEWORTHINESS, Value = (Name)"2" } }) }; ea.AddOrUpdateAppraisalRule(appraisalRule); } else { PopulateAppraisalRuleSet(); ea.AddOrUpdateAppraisalRule(appraisalRuleSet[eaSet]); } ea.AddOrUpdateGoal(new GoalDTO() { Name = "Goal", Significance = 5, Likelihood = 0.5f }); ea.AddOrUpdateGoal(new GoalDTO() { Name = "GoalNegative", Significance = 5, Likelihood = 0.2f }); ea.AddOrUpdateGoal(new GoalDTO() { Name = "GoalPositive", Significance = 5, Likelihood = 0.8f }); var rpc = new RolePlayCharacterAsset { BodyName = "Male", VoiceName = "Male", CharacterName = (Name)"Matt", m_kb = kb, }; rpc.m_emotionalAppraisalAsset = ea; rpc.BindToRegistry(rpc.m_kb); EmotionalDecisionMakingAsset edm = new EmotionalDecisionMakingAsset(); SocialImportanceAsset si = new SocialImportanceAsset(); CommeillFautAsset cfa = new CommeillFautAsset(); rpc.m_emotionalAppraisalAsset = ea; rpc.m_emotionalDecisionMakingAsset = edm; rpc.m_socialImportanceAsset = si; rpc.m_commeillFautAsset = cfa; return(rpc); }
public void InverseAffectDerivation(EmotionalAppraisalAsset emotionalModule, IEmotion emotion, IWritableAppraisalFrame frame) { const float MAGIC_VALUE_FOR_LOVE = 1.43f; //TODO improve this code //ignoring mood for now EmotionDispositionDTO emotionDisposition = emotionalModule.EmotionDispositions.FirstOrDefault(e => e.Emotion == emotion.EmotionType); if (emotionDisposition == null) { emotionDisposition = emotionalModule.DefaultEmotionDisposition; } int threshold = emotionDisposition.Threshold; float potentialValue = emotion.Potential + threshold; if (emotion.EmotionType == OCCEmotionType.Love.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, potentialValue * MAGIC_VALUE_FOR_LOVE); } else if (emotion.EmotionType == OCCEmotionType.Hate.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, potentialValue * -MAGIC_VALUE_FOR_LOVE); } else if (emotion.EmotionType == OCCEmotionType.Joy.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Distress.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Pride.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Shame.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, -potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Gloating.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); } else if (emotion.EmotionType == OCCEmotionType.HappyFor.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Pitty.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Resentment.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Gratification.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Anger.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); } }
public EmotionalStateVM(EmotionalAppraisalAsset ea) { _emotionalAppraisalAsset = ea; Emotions = new BindingListView <EmotionDTO>(ea.ActiveEmotions.ToList()); }
public void Appraisal(EmotionalAppraisalAsset emotionalModule, IBaseEvent evt, IWritableAppraisalFrame frame) { AppraisalRule selfEvaluation = Evaluate(evt, emotionalModule,emotionalModule.Perspective); if (selfEvaluation != null) { if (selfEvaluation.Desirability != 0) frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, selfEvaluation.Desirability); //if (selfEvaluation.DesirabilityForOther != 0) //{ // string other; // if (selfEvaluation.Other != null) // other = selfEvaluation.Other.ToString(); // else if (evt.Target != null) // other = evt.Target; // else // other = evt.Subject; // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER + other, selfEvaluation.DesirabilityForOther); //} if (selfEvaluation.Praiseworthiness != 0) frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, selfEvaluation.Praiseworthiness); //if (selfEvaluation.Like != 0) // frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, selfEvaluation.Like); } }
public IAppraisalFrame Reappraisal(EmotionalAppraisalAsset emotionalModule) { return null; }
public void InverseAppraisal(EmotionalAppraisalAsset emotionalModule, IAppraisalFrame frame) { float desirability = frame.GetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY); float praiseworthiness = frame.GetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS); if (desirability != 0 || praiseworthiness != 0) { var eventName = frame.AppraisedEvent.EventName.ApplyPerspective((Name)emotionalModule.Perspective); AppraisalRule r = new AppraisalRule(eventName,null); r.Desirability = desirability; r.Praiseworthiness = praiseworthiness; //r.EventObject = frame.AppraisedEvent.ToIdentifierName().RemovePerspective(emotionalModule.Perspective); AddEmotionalReaction(r); } }
private static EmotionalAppraisalAsset BuildTestAsset() { //Emotional System Setup var m_emotionalAppraisalAsset = new EmotionalAppraisalAsset("Agent"); m_emotionalAppraisalAsset.Perspective = "Test"; //Setup Emotional Disposition //var loveDisposition = new EmotionDisposition(OCCEmotionType.Love.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(loveDisposition); //var hateDisposition = new EmotionDisposition(OCCEmotionType.Hate.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(hateDisposition); //var hopeDisposition = new EmotionDisposition(OCCEmotionType.Hope.Name, 8, 4); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(hopeDisposition); //var fearDisposition = new EmotionDisposition(OCCEmotionType.Fear.Name, 2, 1); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(fearDisposition); //var satisfactionDisposition = new EmotionDisposition(OCCEmotionType.Satisfaction.Name, 8, 5); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(satisfactionDisposition); //var reliefDisposition = new EmotionDisposition(OCCEmotionType.Relief.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(reliefDisposition); //var fearsConfirmedDisposition = new EmotionDisposition(OCCEmotionType.FearsConfirmed.Name, 2, 1); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(fearsConfirmedDisposition); //var disapointmentDisposition = new EmotionDisposition(OCCEmotionType.Disappointment.Name, 5, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(disapointmentDisposition); var joyDisposition = new EmotionDisposition(OCCEmotionType.Joy.Name, 2, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(joyDisposition.ToDto()); var distressDisposition = new EmotionDisposition(OCCEmotionType.Distress.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(distressDisposition.ToDto()); //var happyForDisposition = new EmotionDisposition(OCCEmotionType.HappyFor.Name, 5, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(happyForDisposition); //var pittyDisposition = new EmotionDisposition(OCCEmotionType.Pitty.Name, 2, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(pittyDisposition); //var resentmentDisposition = new EmotionDisposition(OCCEmotionType.Resentment.Name, 2, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(resentmentDisposition); //var gloatingDisposition = new EmotionDisposition(OCCEmotionType.Gloating.Name, 8, 5); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(gloatingDisposition); var prideDisposition = new EmotionDisposition(OCCEmotionType.Pride.Name, 5, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(prideDisposition.ToDto()); var shameDisposition = new EmotionDisposition(OCCEmotionType.Shame.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(shameDisposition.ToDto()); var gratificationDisposition = new EmotionDisposition(OCCEmotionType.Gratification.Name, 8, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(gratificationDisposition.ToDto()); var remorseDisposition = new EmotionDisposition(OCCEmotionType.Remorse.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(remorseDisposition.ToDto()); var admirationDisposition = new EmotionDisposition(OCCEmotionType.Admiration.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(admirationDisposition.ToDto()); var reproachDisposition = new EmotionDisposition(OCCEmotionType.Reproach.Name, 8, 2); m_emotionalAppraisalAsset.AddEmotionDisposition(reproachDisposition.ToDto()); var gratitudeDisposition = new EmotionDisposition(OCCEmotionType.Gratitude.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(gratitudeDisposition.ToDto()); var angerDisposition = new EmotionDisposition(OCCEmotionType.Anger.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(angerDisposition.ToDto()); //Setup appraisal rules AppraisalRule petAppraisalRule = new AppraisalRule((Name)"Event(EventObject,*,Pet,self)"); petAppraisalRule.TriggersOnFailedActivation = true; petAppraisalRule.Desirability = 10; //petAppraisalRule.Like = 7; //m_emotionalAppraisalAsset.AddAppraisalRule(petAppraisalRule); AppraisalRule slapAppraisalRule = new AppraisalRule((Name)"Event(EventObject,*,Slap,self)"); slapAppraisalRule.Desirability = -10; //slapAppraisalRule.Like = -15; //m_emotionalAppraisalAsset.AddAppraisalRule(slapAppraisalRule); AppraisalRule feedAppraisalRule = new AppraisalRule((Name)"Event(EventObject,*,Feed,self)"); feedAppraisalRule.Desirability = 5; feedAppraisalRule.Praiseworthiness = 10; //m_emotionalAppraisalAsset.AddAppraisalRule(feedAppraisalRule); AppraisalRule screamMad = new AppraisalRule((Name)"Event(EventObject,*,Talk(High,Mad),self)"); screamMad.Desirability = -7; screamMad.Praiseworthiness = -15; //screamMad.Like = -4; //m_emotionalAppraisalAsset.AddAppraisalRule(screamMad); AppraisalRule talkSoftAppraisalRule = new AppraisalRule((Name)"Event(EventObject,*,Talk(Low,Happy),self)"); talkSoftAppraisalRule.Praiseworthiness = 5; //talkSoftAppraisalRule.Like = 5; //m_emotionalAppraisalAsset.AddAppraisalRule(talkSoftAppraisalRule); //Generate emotion m_emotionalAppraisalAsset.AppraiseEvents(new []{ (Name)"Event(EventObject,*,Slap(Hard),self)" }); //Add knowledge var kb = m_emotionalAppraisalAsset.Kb; kb.Tell((Name)"Strength(John)", (byte)5,true,KnowledgeVisibility.Self); kb.Tell((Name)"Strength(Mary)", (sbyte)3, true, KnowledgeVisibility.Self); kb.Tell((Name)"Strength(Leonidas)", (short)500, true, KnowledgeVisibility.Self); kb.Tell((Name)"Strength(Goku)", (uint)9001f, true, KnowledgeVisibility.Self); kb.Tell((Name)"Strength(SuperMan)", ulong.MaxValue, true, KnowledgeVisibility.Self); kb.Tell((Name)"Strength(Saitama)", float.MaxValue, true, KnowledgeVisibility.Self); kb.Tell((Name)"Race(Saitama)", "human", true, KnowledgeVisibility.Self); kb.Tell((Name)"Race(Superman)", "kriptonian", true, KnowledgeVisibility.Universal); kb.Tell((Name)"Race(Goku)", "sayian",true,KnowledgeVisibility.Self); kb.Tell((Name)"Race(Leonidas)", "human", true, KnowledgeVisibility.Self); kb.Tell((Name)"Race(Mary)", "human", true, KnowledgeVisibility.Self); kb.Tell((Name)"Race(John)", "human", true, KnowledgeVisibility.Self); kb.Tell((Name)"Job(Saitama)", "super-hero",false,KnowledgeVisibility.Self); kb.Tell((Name)"Job(Superman)", "super-hero", true, KnowledgeVisibility.Universal); kb.Tell((Name)"Job(Leonidas)", "Spartan", false, KnowledgeVisibility.Self); kb.Tell((Name)"AKA(Saitama)", "One-Punch_Man", true, KnowledgeVisibility.Self); kb.Tell((Name)"AKA(Superman)", "Clark_Kent", true, KnowledgeVisibility.Self); kb.Tell((Name)"AKA(Goku)", "Kakarot", true, KnowledgeVisibility.Self); kb.Tell((Name)"Hobby(Saitama)", "super-hero", false, KnowledgeVisibility.Self); kb.Tell((Name)"Hobby(Goku)", "training", true, KnowledgeVisibility.Universal); return m_emotionalAppraisalAsset; }
public ConcreteEmotionalState(EmotionalAppraisalAsset parent) : this() { m_parent = parent; }
private static EmotionalAppraisalAsset BuildTestAsset() { //Emotional System Setup var m_emotionalAppraisalAsset = new EmotionalAppraisalAsset("Agent"); m_emotionalAppraisalAsset.SetPerspective("Test"); //Setup Emotional Disposition //var loveDisposition = new EmotionDisposition(OCCEmotionType.Love.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(loveDisposition); //var hateDisposition = new EmotionDisposition(OCCEmotionType.Hate.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(hateDisposition); //var hopeDisposition = new EmotionDisposition(OCCEmotionType.Hope.Name, 8, 4); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(hopeDisposition); //var fearDisposition = new EmotionDisposition(OCCEmotionType.Fear.Name, 2, 1); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(fearDisposition); //var satisfactionDisposition = new EmotionDisposition(OCCEmotionType.Satisfaction.Name, 8, 5); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(satisfactionDisposition); //var reliefDisposition = new EmotionDisposition(OCCEmotionType.Relief.Name, 5, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(reliefDisposition); //var fearsConfirmedDisposition = new EmotionDisposition(OCCEmotionType.FearsConfirmed.Name, 2, 1); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(fearsConfirmedDisposition); //var disapointmentDisposition = new EmotionDisposition(OCCEmotionType.Disappointment.Name, 5, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(disapointmentDisposition); var joyDisposition = new EmotionDisposition(OCCEmotionType.Joy.Name, 2, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(joyDisposition.ToDto()); var distressDisposition = new EmotionDisposition(OCCEmotionType.Distress.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(distressDisposition.ToDto()); //var happyForDisposition = new EmotionDisposition(OCCEmotionType.HappyFor.Name, 5, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(happyForDisposition); //var pittyDisposition = new EmotionDisposition(OCCEmotionType.Pitty.Name, 2, 2); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(pittyDisposition); //var resentmentDisposition = new EmotionDisposition(OCCEmotionType.Resentment.Name, 2, 3); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(resentmentDisposition); //var gloatingDisposition = new EmotionDisposition(OCCEmotionType.Gloating.Name, 8, 5); //m_emotionalAppraisalAsset.EmotionalState.AddEmotionDisposition(gloatingDisposition); var prideDisposition = new EmotionDisposition(OCCEmotionType.Pride.Name, 5, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(prideDisposition.ToDto()); var shameDisposition = new EmotionDisposition(OCCEmotionType.Shame.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(shameDisposition.ToDto()); var gratificationDisposition = new EmotionDisposition(OCCEmotionType.Gratification.Name, 8, 5); m_emotionalAppraisalAsset.AddEmotionDisposition(gratificationDisposition.ToDto()); var remorseDisposition = new EmotionDisposition(OCCEmotionType.Remorse.Name, 2, 1); m_emotionalAppraisalAsset.AddEmotionDisposition(remorseDisposition.ToDto()); var admirationDisposition = new EmotionDisposition(OCCEmotionType.Admiration.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(admirationDisposition.ToDto()); var reproachDisposition = new EmotionDisposition(OCCEmotionType.Reproach.Name, 8, 2); m_emotionalAppraisalAsset.AddEmotionDisposition(reproachDisposition.ToDto()); var gratitudeDisposition = new EmotionDisposition(OCCEmotionType.Gratitude.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(gratitudeDisposition.ToDto()); var angerDisposition = new EmotionDisposition(OCCEmotionType.Anger.Name, 5, 3); m_emotionalAppraisalAsset.AddEmotionDisposition(angerDisposition.ToDto()); //Setup appraisal rules m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = "Event(Action-Finished,*,Pet,self)", Desirability = 10 }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = "Event(Action-Finished,*,Slap,self)", Desirability = -10 }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = "Event(Action-Finished, *, Feed, self)", Desirability = 5, Praiseworthiness = 10 }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = "Event(Action-Finished,*,Talk(High,Mad),self)", Desirability = -7, Praiseworthiness = -15 }); m_emotionalAppraisalAsset.AddOrUpdateAppraisalRule(new AppraisalRuleDTO() { EventMatchingTemplate = "Event(Action-Finished,*,Talk(Low,Happy),self)", Praiseworthiness = 5 }); //Generate emotion m_emotionalAppraisalAsset.AppraiseEvents(new []{ "Event(Action-Finished,Player,Slap,self)" }); //Add knowledge m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(John)", Perspective = "self", Value = "5" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(Mary)", Perspective = "self", Value = "3" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(Leonidas)", Perspective = "self", Value = "500" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(Goku)", Perspective = "self", Value = "9001" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(SuperMan)", Perspective = "self", Value = ulong.MaxValue.ToString() }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Strength(Saitama)", Perspective = "self", Value = double.MaxValue.ToString(CultureInfo.InvariantCulture) }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(Saitama)", Perspective = "self", Value = "human" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(Mary)", Perspective = "self", Value = "human" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(John)", Perspective = "self", Value = "human" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(Leonidas)", Perspective = "self", Value = "human" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(Goku)", Perspective = "self", Value = "sayian" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Race(Superman)", Perspective = "self", Value = "kriptonian" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Job(Superman)", Perspective = "self", Value = "super-hero" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Job(Jeonidas)", Perspective = "self", Value = "king" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "AKA(Saitama)", Perspective = "self", Value = "One-Punch_Man" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "AKA(Saitama)", Perspective = "self", Value = "Caped_Baldy" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "AKA(Superman)", Perspective = "self", Value = "Clark_Kent" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "AKA(Goku)", Perspective = "self", Value = "Kakarot" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Hobby(Saitama)", Perspective = "self", Value = "super-hero" }); m_emotionalAppraisalAsset.AddOrUpdateBelief(new BeliefDTO() { Name = "Hobby(Goku)", Perspective = "self", Value = "training" }); return m_emotionalAppraisalAsset; }
public void SetObjectData(ISerializationData dataHolder, ISerializationContext context) { if(emotionPool==null) emotionPool = new Dictionary<string, ActiveEmotion>(); else emotionPool.Clear(); if(emotionDispositions==null) emotionDispositions = new Dictionary<string, EmotionDisposition>(); else emotionDispositions.Clear(); if(mood==null) mood = new Mood(); m_parent = dataHolder.GetValue<EmotionalAppraisalAsset>("Parent"); mood.SetMoodValue(dataHolder.GetValue<float>("Mood"), m_parent); var dispositions = dataHolder.GetValue<EmotionDisposition[]>("EmotionDispositions"); EmotionDisposition defaultDisposition = null; foreach (var disposition in dispositions) { if (string.Equals(disposition.Emotion, "*", StringComparison.InvariantCultureIgnoreCase)) { if (defaultDisposition == null) defaultDisposition = disposition; } else emotionDispositions.Add(disposition.Emotion, disposition); } if (defaultDisposition == null) defaultDisposition = new EmotionDisposition("*",1,1); m_defaultEmotionalDisposition = defaultDisposition; context.PushContext(); { context.Context = m_parent.Tick; var emotions = dataHolder.GetValue<ActiveEmotion[]>("EmotionalPool"); foreach (var emotion in emotions) { var hash = calculateHashString(emotion, m_parent.m_am); emotionPool.Add(hash, emotion); } } context.PopContext(); }
private static SocialImportanceAsset BuildAsset() { var ea = new EmotionalAppraisalAsset("Matt"); #region Set KB ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsPerson(Matt)", Perspective = "*", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsPerson(Mary)", Perspective = "*", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsPerson(Diego)", Perspective = "*", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsPerson(Thomas)", Perspective = "*", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsPerson(Robot)", Perspective = "Diego", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsOutsider(Diego)", Perspective = "*", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsOutsider(Diego)", Perspective = "Robot", Value = "false" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "AreFriends(Self,Mary)", Perspective = "Self", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "AreFriends(Self,Matt)", Perspective = "Mary", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "AreFriends(Self,Thomas)", Perspective = "Self", Value = "true" }); ea.AddOrUpdateBelief(new BeliefDTO() { Name = "IsBartender(Matt)", Perspective = "*", Value = "true" }); #endregion #region SI DTO especification var siDTO = new SocialImportanceDTO { AttributionRules = new[] { new AttributionRuleDTO() { Target = "[target]", Value = 20, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "IsPerson([target]) = true", "[target] != Self" } } }, new AttributionRuleDTO() { Target = "[target]", Value = -1, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "IsOutsider([target]) = true", "[target] != Self" } } }, new AttributionRuleDTO() { Target = "[target]", Value = 15, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "AreFriends(Self,[target]) = true" } } }, new AttributionRuleDTO() { Target = "[target]", Value = 10, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "IsClient([target]) = true", "IsBartender(Self) = true", "[target] != Self" } } }, new AttributionRuleDTO() { Target = "[target]", Value = 1, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "IsElder([target]) = true", "IsElder(Self) = false" } } }, new AttributionRuleDTO() { Target = "[target]", Value = -1, Conditions = new ConditionSetDTO() { ConditionSet = new [] { "IsElder([target]) = false", "IsElder(Self) = true" } } } }, Conferral = new[] { new ConferralDTO() { Action = "Give(Drink)", ConferralSI = 10, Target = "[x]", Conditions = new ConditionSetDTO() { ConditionSet = new [] { "AskedDrink([x])=true" } } }, new ConferralDTO() { Action = "Give(Best-Drink)", ConferralSI = 23, Target = "[x]", Conditions = new ConditionSetDTO() { ConditionSet = new [] { "AskedDrink([x])=true" } } } } }; #endregion var si = new SocialImportanceAsset(); si.LoadFromDTO(siDTO); si.BindEmotionalAppraisalAsset(ea); return si; }
public void InverseAffectDerivation(EmotionalAppraisalAsset emotionalModule, IEmotion emotion, IWritableAppraisalFrame frame) { //const float MAGIC_VALUE_FOR_LOVE = 1.43f; //TODO improve this code //ignoring mood for now EmotionDispositionDTO emotionDisposition = emotionalModule.EmotionDispositions.FirstOrDefault(e => e.Emotion == emotion.EmotionType); if (emotionDisposition == null) { emotionDisposition = emotionalModule.DefaultEmotionDisposition; } int threshold = emotionDisposition.Threshold; float potentialValue = emotion.Potential + threshold; //if(emotion.EmotionType == OCCEmotionType.Love.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, potentialValue * MAGIC_VALUE_FOR_LOVE); //} //else if(emotion.EmotionType == OCCEmotionType.Hate.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.LIKE, potentialValue * -MAGIC_VALUE_FOR_LOVE); //} //else if (emotion.EmotionType == OCCEmotionType.Joy.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Distress.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Pride.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, potentialValue); } else if (emotion.EmotionType == OCCEmotionType.Shame.Name) { frame.SetAppraisalVariable(OCCAppraisalVariables.PRAISEWORTHINESS, -potentialValue); } //else if (emotion.EmotionType == OCCEmotionType.Gloating.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); //} //else if (emotion.EmotionType == OCCEmotionType.HappyFor.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); //} //else if (emotion.EmotionType == OCCEmotionType.Pitty.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); //} //else if (emotion.EmotionType == OCCEmotionType.Resentment.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); //} //else if (emotion.EmotionType == OCCEmotionType.Gratification.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, potentialValue); // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, potentialValue); //} //else if (emotion.EmotionType == OCCEmotionType.Anger.Name) //{ // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY, -potentialValue); // frame.SetAppraisalVariable(OCCAppraisalVariables.DESIRABILITY_FOR_OTHER, -potentialValue); //} }