Changeset 952


Ignore:
Timestamp:
02/13/2011 12:37:19 PM (8 years ago)
Author:
joao.dias
Message:
 
Location:
AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core
Files:
4 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/ActionLibrary.java

    r950 r952  
    3838import javax.xml.parsers.SAXParserFactory; 
    3939 
    40 import FAtiMA.Core.deliberativeLayer.plan.Step; 
    4140import FAtiMA.Core.exceptions.ActionsParsingException; 
    4241import FAtiMA.Core.exceptions.UnknownSpeechActException; 
    4342import FAtiMA.Core.exceptions.UnspecifiedVariableException; 
     43import FAtiMA.Core.plans.Step; 
    4444import FAtiMA.Core.util.AgentLogger; 
    4545import FAtiMA.Core.util.parsers.ActionsLoaderHandler; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/AgentCore.java

    r950 r952  
    1414import java.util.HashMap; 
    1515import java.util.ListIterator; 
    16 import java.util.StringTokenizer; 
    1716import java.util.logging.Logger; 
    1817 
     
    3433import FAtiMA.Core.componentTypes.IProcessEmotionComponent; 
    3534import FAtiMA.Core.componentTypes.IProcessExternalRequestComponent; 
    36 import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 
    37 import FAtiMA.Core.deliberativeLayer.EmotionalPlanner; 
    38 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
    39 import FAtiMA.Core.deliberativeLayer.goals.GoalLibrary; 
    4035import FAtiMA.Core.emotionalState.ActiveEmotion; 
    4136import FAtiMA.Core.emotionalState.AppraisalFrame; 
     
    4641import FAtiMA.Core.exceptions.GoalLibParsingException; 
    4742import FAtiMA.Core.exceptions.UnknownGoalException; 
     43import FAtiMA.Core.goals.Goal; 
     44import FAtiMA.Core.goals.GoalLibrary; 
    4845import FAtiMA.Core.memory.Memory; 
    4946import FAtiMA.Core.memory.semanticMemory.KnowledgeSlot; 
     47import FAtiMA.Core.plans.IDetectThreatStrategy; 
    5048import FAtiMA.Core.reactiveLayer.ReactiveProcess; 
    5149import FAtiMA.Core.sensorEffector.Event; 
     
    8684        protected ArrayList<IAppraisalDerivationComponent> _appraisalComponents; 
    8785         
     86        //Strategies 
     87        protected IDetectThreatStrategy _detectThreatStrat; 
     88         
    8889        //Data structures 
    8990        protected EmotionalState _emotionalState; 
     
    9394         
    9495        protected boolean _shutdown; 
    95         protected DeliberativeProcess _deliberativeLayer; 
    9696        protected ReactiveProcess _reactiveLayer; 
    9797        protected ArrayList<ValuedAction> _actionsForExecution; 
     
    193193                                // Load Plan Operators 
    194194                                _actionLibrary.LoadActionsFile(ConfigurationManager.getActionsFile(), this); 
    195                                 EmotionalPlanner planner = new EmotionalPlanner(); 
    196195         
    197196                                // Load GoalLibrary 
     
    201200                                _reactiveLayer = new ReactiveProcess(); 
    202201                                addComponent(_reactiveLayer); 
    203          
    204                                 _deliberativeLayer = new DeliberativeProcess(planner); 
    205                                 addComponent(_deliberativeLayer); 
    206202                                 
    207203                                addComponent(new OCCComponent()); 
     
    377373 
    378374 
    379         public void AppraiseSelfActionFailed(Event e) 
    380         { 
    381                 _deliberativeLayer.appraiseSelfActionFailed(e); 
     375        public void PerceiveActionFailed(Event e) 
     376        { 
     377                Event e2 = e.ApplyPerspective(_name); 
     378                 
     379                for(IAdvancedPerceptionsComponent c : _processPerceptionsComponents) 
     380                { 
     381                        c.actionFailedPerception(e2); 
     382                } 
    382383        } 
    383384 
     
    390391        } 
    391392 
    392  
    393         /** 
    394          * Gets the agent's Deliberative Layer that you can use 
    395          * to get access to Deliberative structures such as  
    396          * the goals and planner 
    397          * @return the agent's Deliberative Layer 
    398          */ 
    399         public DeliberativeProcess getDeliberativeLayer() 
    400         { 
    401                 return this._deliberativeLayer; 
    402         } 
    403393 
    404394        public EmotionalState getEmotionalState() 
     
    477467                ObjectInputStream s = new ObjectInputStream(in); 
    478468         
    479                 this._deliberativeLayer = (DeliberativeProcess) s.readObject(); 
    480469                this._reactiveLayer = (ReactiveProcess) s.readObject(); 
    481470                this._emotionalState = (EmotionalState) s.readObject(); 
     
    530519 
    531520                AgentLogger.GetInstance().log("LOADING Personality: " + personalityFile); 
    532                 AgentLoaderHandler c = new AgentLoaderHandler(this,_reactiveLayer,_deliberativeLayer,_emotionalState); 
     521                AgentLoaderHandler c = new AgentLoaderHandler(_reactiveLayer,_emotionalState); 
    533522 
    534523                SAXParserFactory factory = SAXParserFactory.newInstance(); 
    535524                SAXParser parser = factory.newSAXParser(); 
    536525                parser.parse(new File(personalityFile), c); 
    537  
    538                 //The ION Agent does not load the goals initially from the personality file, therefore we 
    539                 //must clear all the goals loaded. 
    540                 //if(agentPlatform == AgentPlatform.ION){ 
    541                 //      _deliberativeLayer.RemoveAllGoals(); 
    542                 //} 
    543  
    544                 //The WorldSimulator Agent loads additional goals provided in the starting goal list 
    545                 if(agentPlatform == AgentPlatform.WORLDSIM){ 
    546                         ListIterator<String> lt = goalList.listIterator(); 
    547                         String goalDescription; 
    548                         String goalName; 
    549                         StringTokenizer st; 
    550                         float impOfSuccess; 
    551                         float impOfFailure; 
    552                         while(lt.hasNext()) { 
    553                                 goalDescription = (String) lt.next(); 
    554                                 st = new StringTokenizer(goalDescription, "|"); 
    555                                 goalName = st.nextToken(); 
    556                                 impOfSuccess = Float.parseFloat(st.nextToken()); 
    557                                 impOfFailure = Float.parseFloat(st.nextToken()); 
    558  
    559                                 _deliberativeLayer.addGoal(this, goalName, impOfSuccess, impOfFailure);    
    560                         }        
    561                 } 
    562526        } 
    563527 
     
    864828                for(IProcessExternalRequestComponent ip: _processExternalRequestComponents) 
    865829                { 
    866                         if(ip.name().equals("AdvancedMemory")) 
    867                                 ip.processExternalRequest("SAVE_ADV_MEMORY"); 
     830                        ip.processExternalRequest(this,"SAVE_ADV_MEMORY",""); 
    868831                } 
    869832                 
     
    892855                for(IProcessExternalRequestComponent ip: _processExternalRequestComponents) 
    893856                { 
    894                         if(ip.name().equals("AdvancedMemory")) 
    895                                 ip.processExternalRequest("LOAD_ADV_MEMORY"); 
     857                        ip.processExternalRequest(this,"LOAD_ADV_MEMORY",""); 
    896858                } 
    897859        } 
     
    915877                        ObjectOutputStream s = new ObjectOutputStream(out); 
    916878                         
    917                         s.writeObject(_deliberativeLayer); 
    918879                        s.writeObject(_reactiveLayer); 
    919880                        s.writeObject(_emotionalState); 
     
    1005966                        //s.writeObject(_ToM); 
    1006967                        //s.writeObject(_nearbyAgents); 
    1007                         s.writeObject(_deliberativeLayer); 
    1008968                        s.writeObject(_reactiveLayer); 
    1009969                        s.writeObject(_emotionalState); 
     
    10681028 
    10691029                        ObjectInputStream s = new ObjectInputStream(in); 
    1070                         this._deliberativeLayer = (DeliberativeProcess) s.readObject(); 
    10711030                        this._reactiveLayer = (ReactiveProcess) s.readObject(); 
    10721031                        this._emotionalState = (EmotionalState) s.readObject(); 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/AgentModel.java

    r950 r952  
    22 
    33import FAtiMA.Core.componentTypes.IComponent; 
    4 import FAtiMA.Core.deliberativeLayer.goals.GoalLibrary; 
    54import FAtiMA.Core.emotionalState.AppraisalFrame; 
    65import FAtiMA.Core.emotionalState.EmotionalState; 
     6import FAtiMA.Core.goals.GoalLibrary; 
    77import FAtiMA.Core.memory.Memory; 
    88import FAtiMA.Core.reactiveLayer.ReactiveProcess; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/Display/AgentDisplay.java

    r779 r952  
    4040import FAtiMA.Core.AgentCore; 
    4141 
    42 /** 
    43  * @author  bruno 
    44  */ 
     42 
    4543public class AgentDisplay { 
    4644    JFrame _frame; 
     
    6765                panel = new KnowledgeBasePanel(); 
    6866                _displayPane.addTab("Knowledge Base",null,panel,"displays all information stored in the KB"); 
    69                  
    70                 panel = new GoalsPanel(); 
    71                 _displayPane.addTab("Goals",null,panel,"displays the character's goals and active intentions"); 
    7267                 
    7368                panel = new EpisodicMemoryPanel(); 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/componentTypes/IAdvancedPerceptionsComponent.java

    r926 r952  
    22 
    33import FAtiMA.Core.AgentCore; 
     4import FAtiMA.Core.sensorEffector.Event; 
    45import FAtiMA.Core.wellFormedNames.Name; 
    56 
     
    1112         
    1213        public void entityRemovedPerception(String entity); 
     14         
     15        public void actionFailedPerception(Event e); 
    1316 
    1417} 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/componentTypes/IProcessExternalRequestComponent.java

    r926 r952  
    11package FAtiMA.Core.componentTypes; 
     2 
     3import FAtiMA.Core.AgentModel; 
    24 
    35 
    46public interface IProcessExternalRequestComponent extends IComponent{ 
    57         
    6         public void processExternalRequest(String requestMsg); 
     8        public void processExternalRequest(AgentModel am, String msgType, String perception); 
    79 
    810} 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/AutobiographicalMemory.java

    r782 r952  
    4949import java.util.ListIterator; 
    5050 
    51 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
     51import FAtiMA.Core.goals.Goal; 
    5252import FAtiMA.Core.memory.Memory; 
    5353import FAtiMA.Core.sensorEffector.Event; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/EpisodicMemory.java

    r896 r952  
    55import java.util.ListIterator; 
    66 
    7 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
    87import FAtiMA.Core.emotionalState.ActiveEmotion; 
    98import FAtiMA.Core.emotionalState.NeutralEmotion; 
     9import FAtiMA.Core.goals.Goal; 
    1010import FAtiMA.Core.memory.Memory; 
    1111import FAtiMA.Core.sensorEffector.Event; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/MemoryEpisode.java

    r896 r952  
    4141import java.util.ListIterator; 
    4242 
    43 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
    4443import FAtiMA.Core.emotionalState.BaseEmotion; 
     44import FAtiMA.Core.goals.Goal; 
    4545import FAtiMA.Core.memory.Memory; 
    4646import FAtiMA.Core.sensorEffector.Event; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/episodicMemory/ShortTermEpisodicMemory.java

    r782 r952  
    3535import java.util.ListIterator; 
    3636 
    37 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
    3837import FAtiMA.Core.emotionalState.ActiveEmotion; 
     38import FAtiMA.Core.goals.Goal; 
    3939import FAtiMA.Core.memory.Memory; 
    4040import FAtiMA.Core.sensorEffector.Event; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/semanticMemory/KnowledgeBase.java

    r848 r952  
    7777import java.util.ListIterator; 
    7878 
    79 import FAtiMA.Core.deliberativeLayer.plan.Step; 
     79import FAtiMA.Core.plans.Step; 
    8080import FAtiMA.Core.wellFormedNames.Name; 
    8181import FAtiMA.Core.wellFormedNames.Substitution; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/memory/semanticMemory/SemanticMemory.java

    r833 r952  
    77import FAtiMA.Core.AgentModel; 
    88import FAtiMA.Core.conditions.Condition; 
    9 import FAtiMA.Core.deliberativeLayer.plan.Effect; 
    10 import FAtiMA.Core.deliberativeLayer.plan.Step; 
     9import FAtiMA.Core.plans.Effect; 
     10import FAtiMA.Core.plans.Step; 
    1111import FAtiMA.Core.wellFormedNames.Name; 
    1212import FAtiMA.Core.wellFormedNames.SubstitutionSet; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/sensorEffector/IONRemoteAgent.java

    r768 r952  
    350350                { 
    351351                        AgentLogger.GetInstance().logAndPrint("Self action failed, agent can act again"); 
    352                         _agent.AppraiseSelfActionFailed(rmAction.toEvent(ActionEvent.FAILURE)); 
    353352                        _canAct = true; 
    354353                } 
     354                 
     355                _agent.PerceiveActionFailed(rmAction.toEvent(ActionEvent.FAILURE)); 
    355356        } 
    356357 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/sensorEffector/RemoteAgent.java

    r950 r952  
    9090import FAtiMA.Core.AgentSimulationTime; 
    9191import FAtiMA.Core.ValuedAction; 
    92 import FAtiMA.Core.componentTypes.IComponent; 
    9392import FAtiMA.Core.componentTypes.IProcessExternalRequestComponent; 
    9493import FAtiMA.Core.emotionalState.EmotionalState; 
     
    112111        protected static final String SHUTDOWN = "SHUTDOWN"; 
    113112        protected static final String CMD = "CMD"; 
    114         protected static final String CHANGE_IMPORTANCE_SUCCESS = "CIS"; 
    115         protected static final String CHANGE_IMPORTANCE_FAILURE = "CIF"; 
    116         protected static final String ADD_GOALS = "ADDGOALS"; 
    117         protected static final String REMOVE_GOAL = "REMOVEGOAL"; 
    118         protected static final String REMOVE_ALL_GOALS = "REMOVEALLGOALS"; 
    119113        protected static final String AGENTS = "AGENTS"; 
    120114        protected static final String LOOK_AT = "LOOK-AT"; 
     
    283277                                CmdPerception(perception); 
    284278                        } 
    285                         else if(msgType.equals(CHANGE_IMPORTANCE_SUCCESS)  
    286                                         || msgType.equals(CHANGE_IMPORTANCE_FAILURE)) 
    287                         { 
    288                                 ChangeImportancePerception(msgType, perception); 
    289                         } 
    290                         else if(msgType.equals(ADD_GOALS)) { 
    291                                 AddGoalsPerception(perception); 
    292                         } 
    293                         else if(msgType.equals(REMOVE_GOAL)) { 
    294                                 RemoveGoalPerception(perception); 
    295                         } 
    296                         else if (msgType.equals(REMOVE_ALL_GOALS)) { 
    297                                 RemoveAllGoalsPerception(perception); 
    298                         } 
    299279                        else if(msgType.equals(AGENTS)) { 
    300280                                AgentsPerception(perception); 
     
    350330                                for(IProcessExternalRequestComponent c : _agent.getProcessExternalRequestComponents()) 
    351331                                { 
    352                                         if(msgType.equals(((IComponent)c).name())) 
    353                                         { 
    354                                                 c.processExternalRequest(perception); 
    355                                         } 
     332                                        c.processExternalRequest(_agent,msgType,perception); 
    356333                                } 
    357334                        } 
     
    702679        } 
    703680         
    704         protected void ChangeImportancePerception(String type, String perc) 
    705         { 
    706                 StringTokenizer st = new StringTokenizer(perc," "); 
    707                 String goalName = st.nextToken(); 
    708                 float importance = new Float(st.nextToken()).floatValue(); 
    709                 _agent.getDeliberativeLayer().changeGoalImportance(_agent, goalName,importance,type); 
    710         } 
     681         
    711682         
    712683        protected void CmdPerception(String perc) 
     
    783754                        this.Send("STATE-SET"); 
    784755                } 
    785 } 
    786          
    787         protected void AddGoalsPerception(String perc) 
    788         { 
    789                 String goalDescription; 
    790                 String goalName; 
    791                 float importance; 
    792                 float importance2; 
    793                 StringTokenizer st2; 
    794                 StringTokenizer st = new StringTokenizer(perc," "); 
    795                  
    796                 while(st.hasMoreTokens()) { 
    797                         goalDescription = st.nextToken(); 
    798                         st2 = new StringTokenizer(goalDescription,"|"); 
    799                         goalName = st2.nextToken(); 
    800                         importance = new Float(st2.nextToken()).floatValue(); 
    801                         importance2 = new Float(st2.nextToken()).floatValue(); 
    802                         try { 
    803                                 _agent.getDeliberativeLayer().addGoal(_agent, goalName,importance,importance2); 
    804                         } 
    805                         catch(Exception e) { 
    806                                 e.printStackTrace(); 
    807                         } 
    808                 } 
    809         } 
    810          
    811         protected void RemoveGoalPerception(String perc) 
    812         { 
    813                 _agent.getDeliberativeLayer().removeGoal(perc);  
    814         } 
    815          
    816         protected void RemoveAllGoalsPerception(String perc) 
    817         { 
    818                 _agent.getDeliberativeLayer().removeAllGoals(); 
    819756        } 
    820757         
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/sensorEffector/WorldSimulatorRemoteAgent.java

    r911 r952  
    413413                        // we need to change the event subject to SELF, before we can appraise it 
    414414                        event.SetSubject(Constants.SELF); 
    415                         _agent.AppraiseSelfActionFailed(event); 
     415                        _agent.PerceiveActionFailed(event); 
    416416                        _canAct = true; 
    417417                }        
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/parsers/ActionsLoaderHandler.java

    r801 r952  
    5757import FAtiMA.Core.conditions.PropertyCondition; 
    5858import FAtiMA.Core.conditions.RecentEventCondition; 
    59 import FAtiMA.Core.deliberativeLayer.plan.Effect; 
    60 import FAtiMA.Core.deliberativeLayer.plan.Step; 
    6159import FAtiMA.Core.exceptions.InvalidEmotionTypeException; 
     60import FAtiMA.Core.plans.Effect; 
     61import FAtiMA.Core.plans.Step; 
    6262import FAtiMA.Core.util.enumerables.ActionEvent; 
    6363import FAtiMA.Core.util.enumerables.EventType; 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/parsers/AgentLoaderHandler.java

    r950 r952  
    5252import org.xml.sax.Attributes; 
    5353 
    54 import FAtiMA.Core.AgentModel; 
    5554import FAtiMA.Core.conditions.EmotionCondition; 
    5655import FAtiMA.Core.conditions.MoodCondition; 
     
    5958import FAtiMA.Core.conditions.PropertyCondition; 
    6059import FAtiMA.Core.conditions.RecentEventCondition; 
    61 import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 
    6260import FAtiMA.Core.emotionalState.ElicitingEmotion; 
    6361import FAtiMA.Core.emotionalState.EmotionDisposition; 
    6462import FAtiMA.Core.emotionalState.EmotionalState; 
    6563import FAtiMA.Core.exceptions.InvalidEmotionTypeException; 
    66 import FAtiMA.Core.exceptions.UnknownGoalException; 
    6764import FAtiMA.Core.reactiveLayer.Action; 
    6865import FAtiMA.Core.reactiveLayer.Reaction; 
     
    7774         
    7875    private ReactiveProcess _reactiveLayer; 
    79     private DeliberativeProcess _deliberativeLayer; 
     76    //private DeliberativeProcess _deliberativeLayer; 
    8077    private EmotionalState _emotionalState; 
    8178     
    8279        private Action _action; 
    83     private String _goalName; 
    8480    private ElicitingEmotion _elicitingEmotion; 
    8581    private Reaction _eventReaction; 
    8682    private Substitution _self; 
    87     private AgentModel _am; 
    88      
    89     public AgentLoaderHandler(AgentModel am, ReactiveProcess reactiveLayer, DeliberativeProcess deliberativeLayer, EmotionalState es) 
     83     
     84    public AgentLoaderHandler(ReactiveProcess reactiveLayer, EmotionalState es) 
    9085    { 
    9186        this._reactiveLayer = reactiveLayer; 
    92         this._deliberativeLayer = deliberativeLayer; 
    9387        this._emotionalState = es; 
    9488        //this is just because of compatibility issues. 
    9589        this._self = new Substitution(new Symbol("[SELF]"), new Symbol(Constants.SELF)); 
    96         this._am = am; 
    9790    } 
    9891     
     
    182175    } 
    183176 
    184     public void Goal(Attributes attributes) throws UnknownGoalException  
    185     { 
    186    
    187       float impOfSucess = 0; 
    188       float impOfFailure = 0; 
    189  
    190       _goalName = attributes.getValue("name"); 
    191       String aux = attributes.getValue("importanceOfSuccess"); 
    192       if(aux != null) 
    193       { 
    194           impOfSucess = Float.parseFloat(aux); 
    195       } 
    196        
    197       aux = attributes.getValue("importanceOfFailure"); 
    198       if(aux != null) 
    199       { 
    200           impOfFailure = Float.parseFloat(attributes.getValue("importanceOfFailure")); 
    201       } 
    202                          
    203       _deliberativeLayer.addGoal(_am, _goalName,impOfSucess,impOfFailure);  
    204     } 
     177     
    205178     
    206179    public void Predicate(Attributes attributes)  
  • AgentMind/branches/FAtiMA-Modular/FAtiMA/src/FAtiMA/Core/util/parsers/GoalLoaderHandler.java

    r721 r952  
    5252import FAtiMA.Core.conditions.PropertyCondition; 
    5353import FAtiMA.Core.conditions.RecentEventCondition; 
    54 import FAtiMA.Core.deliberativeLayer.goals.ActivePursuitGoal; 
    55 import FAtiMA.Core.deliberativeLayer.goals.Goal; 
    56 import FAtiMA.Core.deliberativeLayer.goals.InterestGoal; 
    5754import FAtiMA.Core.exceptions.InvalidEmotionTypeException; 
     55import FAtiMA.Core.goals.ActivePursuitGoal; 
     56import FAtiMA.Core.goals.Goal; 
     57import FAtiMA.Core.goals.InterestGoal; 
    5858import FAtiMA.Core.util.Constants; 
    5959import FAtiMA.Core.wellFormedNames.Name; 
Note: See TracChangeset for help on using the changeset viewer.