Changeset 744
- Timestamp:
- 11/25/2010 02:59:16 PM (10 years ago)
- Location:
- AgentMind/branches/FAtiMA-Modular
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
AgentMind/branches/FAtiMA-Modular/AgentLauncher/.classpath
r742 r744 7 7 <classpathentry combineaccessrules="false" kind="src" path="/FAtiMA.SocialRelations"/> 8 8 <classpathentry combineaccessrules="false" kind="src" path="/FAtiMA.culture"/> 9 <classpathentry combineaccessrules="false" kind="src" path="/FAtiMA.ToM"/> 9 10 <classpathentry kind="output" path="bin"/> 10 11 </classpath> -
AgentMind/branches/FAtiMA-Modular/AgentLauncher/src/AgentLauncher.java
r742 r744 11 11 import FAtiMA.Core.exceptions.UnknownGoalException; 12 12 import FAtiMA.Core.util.ConfigurationManager; 13 import FAtiMA. Core.util.enumerables.CulturalDimensionType;13 import FAtiMA.ToM.ToMComponent; 14 14 import FAtiMA.culture.CulturalDimensionsComponent; 15 15 import FAtiMA.motivationalSystem.MotivationalComponent; … … 32 32 AgentCore aG = initializeAgentCore(args); 33 33 ArrayList<String> extraFiles = new ArrayList<String>(); 34 String cultureFile = ConfigurationManager.getMindPath() + ConfigurationManager.getAgentProperties().get("cultureName") + ".xml";34 //String cultureFile = ConfigurationManager.getMindPath() + ConfigurationManager.getAgentProperties().get("cultureName") + ".xml"; 35 35 36 extraFiles.add(cultureFile);37 aG.addComponent(new CulturalDimensionsComponent(cultureFile));36 //extraFiles.add(cultureFile); 37 //aG.addComponent(new CulturalDimensionsComponent(cultureFile)); 38 38 aG.addComponent(new SocialRelationsComponent(extraFiles)); 39 39 aG.addComponent(new MotivationalComponent(extraFiles)); 40 aG.addComponent(new ToMComponent(ConfigurationManager.getName())); 40 41 41 42 -
AgentMind/branches/FAtiMA-Modular/AgentLauncher/src/AgentWithNeedsLauncher.java
r724 r744 15 15 static public void main(String args[]) throws ParserConfigurationException, SAXException, IOException, UnknownGoalException, ActionsParsingException, GoalLibParsingException { 16 16 AgentCore aG = initializeAgentCore(args); 17 aG.addComponent(new MotivationalComponent( ));17 aG.addComponent(new MotivationalComponent(null)); 18 18 aG.StartAgent(); 19 19 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA.MotivationalSystem/src/FAtiMA/motivationalSystem/MotivationalComponent.java
r742 r744 392 392 } 393 393 394 395 /**TODO find a decay formula396 * Decays all needs according to the System Time397 */398 public void decay(long currentTime) {399 400 if (currentTime >= _lastTime + 1000) {401 _lastTime = currentTime;402 403 404 //decay self motivators405 for(int i = 0; i < _motivators.length; i++){406 _motivators[i].DecayMotivator();407 }408 409 }410 }411 412 394 413 395 /** … … 491 473 public void updateCycle(AgentModel am, long time) { 492 474 _appraisals.clear(); 475 if (time >= _lastTime + 1000) { 476 _lastTime = time; 477 478 //decay self motivators 479 for(int i = 0; i < _motivators.length; i++){ 480 _motivators[i].DecayMotivator(); 481 } 482 483 } 493 484 } 494 485 … … 496 487 @Override 497 488 public IComponent createModelOfOther() { 498 MotivationalComponent ms = new MotivationalComponent(n ull);489 MotivationalComponent ms = new MotivationalComponent(new ArrayList<String>()); 499 490 Motivator m2; 500 491 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.SocialRelations/src/FAtiMA/socialRelations/SocialRelationsComponent.java
r742 r744 10 10 import FAtiMA.Core.IComponent; 11 11 import FAtiMA.Core.IModelOfOtherComponent; 12 import FAtiMA.Core.IProc cessEmotionComponent;12 import FAtiMA.Core.IProcessEmotionComponent; 13 13 import FAtiMA.Core.Display.AgentDisplayPanel; 14 14 import FAtiMA.Core.emotionalState.ActiveEmotion; … … 22 22 23 23 24 public class SocialRelationsComponent implements IComponent, IModelOfOtherComponent, IProc cessEmotionComponent {24 public class SocialRelationsComponent implements IComponent, IModelOfOtherComponent, IProcessEmotionComponent { 25 25 26 26 public static final String NAME = "SocialRelations"; … … 167 167 @Override 168 168 public IComponent createModelOfOther() { 169 return new SocialRelationsComponent(n ull);169 return new SocialRelationsComponent(new ArrayList<String>()); 170 170 } 171 171 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.ToM/src/FAtiMA/ToM/ModelOfOther.java
r742 r744 10 10 import FAtiMA.Core.IComponent; 11 11 import FAtiMA.Core.IGetModelStrategy; 12 import FAtiMA.Core.IProc cessEmotionComponent;12 import FAtiMA.Core.IProcessEmotionComponent; 13 13 import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 14 14 import FAtiMA.Core.emotionalState.ActiveEmotion; … … 34 34 private Memory _mem; 35 35 private HashMap<String,IComponent> _components; 36 private ArrayList<IProc cessEmotionComponent> _processEmotionComponents;36 private ArrayList<IProcessEmotionComponent> _processEmotionComponents; 37 37 private ReactiveProcess _reactiveProcess; 38 38 private DeliberativeProcess _deliberativeProcess; … … 44 44 _mem = new Memory(); 45 45 _components = new HashMap<String,IComponent>(); 46 _processEmotionComponents = new ArrayList<IProc cessEmotionComponent>();46 _processEmotionComponents = new ArrayList<IProcessEmotionComponent>(); 47 47 48 48 for(EmotionDisposition ed : ag.getEmotionalState().getEmotionDispositions()) … … 77 77 public void updateCycle(long time) 78 78 { 79 _es.Decay(); 80 79 81 for(IComponent c : _components.values()) 80 82 { … … 85 87 public void perceiveEvent(Event e) 86 88 { 89 _mem.getEpisodicMemory().StoreAction(_mem, e); 90 _mem.getSemanticMemory().Tell(AgentCore.ACTION_CONTEXT, e.toName().toString()); 91 87 92 for(IComponent c : _components.values()) 88 93 { … … 108 113 if(activeEmotion != null) 109 114 { 110 for(IProc cessEmotionComponent c : this._processEmotionComponents)115 for(IProcessEmotionComponent c : this._processEmotionComponents) 111 116 { 112 117 c.emotionActivation(this,e,activeEmotion); … … 119 124 public void addComponent(IComponent c) 120 125 { 121 c.initialize(this);122 126 if(c.name().equals(ReactiveProcess.NAME)) 123 127 { … … 130 134 } 131 135 132 if(c instanceof IProc cessEmotionComponent)136 if(c instanceof IProcessEmotionComponent) 133 137 { 134 _processEmotionComponents.add((IProc cessEmotionComponent)c);138 _processEmotionComponents.add((IProcessEmotionComponent)c); 135 139 } 136 140 -
AgentMind/branches/FAtiMA-Modular/FAtiMA.ToM/src/FAtiMA/ToM/ToMComponent.java
r742 r744 27 27 protected HashMap<String,ModelOfOther> _ToM; 28 28 protected ArrayList<String> _nearbyAgents; 29 protected HashMap< Event,AppraisalStructure> _appraisalsOfOthers;29 protected HashMap<String,AppraisalStructure> _appraisalsOfOthers; 30 30 31 31 … … 34 34 this._name = agentName; 35 35 this._nearbyAgents = new ArrayList<String>(); 36 this._appraisalsOfOthers = new HashMap<Event,AppraisalStructure>(); 36 this._appraisalsOfOthers = new HashMap<String,AppraisalStructure>(); 37 this._ToM = new HashMap<String,ModelOfOther>(); 37 38 } 38 39 … … 96 97 public void reset() { 97 98 // TODO Auto-generated method stub 98 99 99 } 100 100 … … 113 113 public void perceiveEvent(AgentModel am, Event e) 114 114 { 115 for(String s : _nearbyAgents)116 {117 ModelOfOther m = _ToM.get(s);118 m.perceiveEvent(e);119 }120 }121 122 @Override123 public void appraisal(AgentModel am, Event e, AppraisalStructure as) {124 125 115 Event e2 = e.RemovePerspective(_name); 126 116 Event e3; 117 for(String s : _nearbyAgents) 118 { 119 ModelOfOther m = _ToM.get(s); 120 e3 = e2.ApplyPerspective(s); 121 m.perceiveEvent(e3); 122 } 123 } 124 125 @Override 126 public void appraisal(AgentModel am, Event e, AppraisalStructure as) { 127 128 Event e2 = e.RemovePerspective(_name); 129 Event e3; 127 130 128 131 //one time appraisal for each event, so if the event was already appraised this cycle, just return 129 if(_appraisalsOfOthers.containsKey(e2 ))132 if(_appraisalsOfOthers.containsKey(e2.toString())) 130 133 { 131 134 return; … … 143 146 as.SetAppraisalOfOther(s, otherAS); 144 147 } 148 149 _appraisalsOfOthers.put(e2.toString(), as); 145 150 } 146 151 … … 194 199 if(isPerson(ag, target)) 195 200 { 201 initializeModelOfOther(ag, target); 196 202 addNearbyAgent(target); 197 initializeModelOfOther(ag, target);198 203 } 199 204 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA.ToM/src/FAtiMA/ToM/ToMPanel.java
r700 r744 45 45 } 46 46 47 update = ((ModelOfOtherPanel)_agentsPanel.getSelectedComponent()).Update(ag) || update; 47 if(_agentsPanel.getSelectedComponent() != null) 48 { 49 update = ((ModelOfOtherPanel)_agentsPanel.getSelectedComponent()).Update(ag) || update; 50 } 48 51 49 52 return update; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/AgentCore.java
r742 r744 61 61 public static final String SCENARIO_FILENAME = "LIRECScenarios.xml"; 62 62 63 p rivatestatic final Name ACTION_CONTEXT = Name.ParseName("ActionContext()");63 public static final Name ACTION_CONTEXT = Name.ParseName("ActionContext()"); 64 64 65 65 protected HashMap<String, IComponent> _generalComponents; 66 protected ArrayList<IProc cessEmotionComponent> _processEmotionComponents;66 protected ArrayList<IProcessEmotionComponent> _processEmotionComponents; 67 67 protected ArrayList<IBehaviourComponent> _behaviourComponents; 68 68 protected ArrayList<IModelOfOtherComponent> _modelOfOtherComponents; … … 112 112 113 113 _generalComponents = new HashMap<String,IComponent>(); 114 _processEmotionComponents = new ArrayList<IProc cessEmotionComponent>();114 _processEmotionComponents = new ArrayList<IProcessEmotionComponent>(); 115 115 _behaviourComponents = new ArrayList<IBehaviourComponent>(); 116 116 _modelOfOtherComponents = new ArrayList<IModelOfOtherComponent>(); … … 247 247 { 248 248 this._generalComponents.put(c.name(), c); 249 if(c instanceof IProc cessEmotionComponent)250 { 251 _processEmotionComponents.add((IProc cessEmotionComponent) c);249 if(c instanceof IProcessEmotionComponent) 250 { 251 _processEmotionComponents.add((IProcessEmotionComponent) c); 252 252 } 253 253 if(c instanceof IBehaviourComponent) … … 392 392 this._strat = (IGetModelStrategy) s.readObject(); 393 393 this._generalComponents = (HashMap<String,IComponent>) s.readObject(); 394 this._processEmotionComponents = (ArrayList<IProc cessEmotionComponent>) s.readObject();394 this._processEmotionComponents = (ArrayList<IProcessEmotionComponent>) s.readObject(); 395 395 this._behaviourComponents = (ArrayList<IBehaviourComponent>) s.readObject(); 396 396 this._modelOfOtherComponents = (ArrayList<IModelOfOtherComponent>) s.readObject(); … … 458 458 { 459 459 String auxTarget; 460 String auxSubject; 461 462 if(subject.equals(_name)) 463 { 464 auxSubject = Constants.SELF; 465 } 466 else 467 { 468 auxSubject = subject; 469 } 460 470 461 471 if(target.equals(_name)) … … 470 480 for(IProcessPerceptionsComponent c : this._processPerceptionsComponents) 471 481 { 472 c.lookAtPerception(this, subject, auxTarget);482 c.lookAtPerception(this, auxSubject, auxTarget); 473 483 } 474 484 } … … 550 560 ValuedAction action; 551 561 AppraisalStructure appraisal; 552 AppraisalStructure a2;553 562 ArrayList<BaseEmotion> emotions; 554 563 ActiveEmotion activeEmotion; … … 617 626 if(activeEmotion != null) 618 627 { 619 for(IProc cessEmotionComponent c : this._processEmotionComponents)628 for(IProcessEmotionComponent c : this._processEmotionComponents) 620 629 { 621 630 c.emotionActivation(this,e2,activeEmotion); … … 933 942 this._strat = (IGetModelStrategy) s.readObject(); 934 943 this._generalComponents = (HashMap<String,IComponent>) s.readObject(); 935 this._processEmotionComponents = (ArrayList<IProc cessEmotionComponent>) s.readObject();944 this._processEmotionComponents = (ArrayList<IProcessEmotionComponent>) s.readObject(); 936 945 this._behaviourComponents = (ArrayList<IBehaviourComponent>) s.readObject(); 937 946 this._modelOfOtherComponents = (ArrayList<IModelOfOtherComponent>) s.readObject(); -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/emotionalState/Appraisal.java
r732 r744 197 197 { 198 198 float desirabilityForOther = appraisalOfOther.getAppraisalVariable(AppraisalStructure.DESIRABILITY); 199 float targetBias = 0; 200 float subjectBias = 0; 201 float bias; 202 float newDesirability = 0; 203 204 205 String subject = event.GetSubject(); 206 199 207 200 208 201 if(desirabilityForOther == 0) return null; -
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/sensorEffector/WorldSimulatorRemoteAgent.java
r699 r744 230 230 if(action.equals("look-at")) 231 231 { 232 if(!subject.equals(this._agent.getName())) 233 { 234 _agent.PerceiveLookAt(subject, target); 235 } 232 _agent.PerceiveLookAt(subject, target); 236 233 } 237 234 /*event = new Event(subject,actionName,target);
Note: See TracChangeset
for help on using the changeset viewer.