Ignore:
Timestamp:
02/12/2011 05:24:08 PM (10 years ago)
Author:
joao.dias
Message:
 
Location:
AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/CulturalDimensionsComponent.java

    r937 r950  
    1515import FAtiMA.Core.componentTypes.IAppraisalDerivationComponent; 
    1616import FAtiMA.Core.conditions.Condition; 
     17import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 
    1718import FAtiMA.Core.deliberativeLayer.IExpectedUtilityStrategy; 
    1819import FAtiMA.Core.deliberativeLayer.IGetUtilityForOthers; 
     
    5758        @Override 
    5859        public void initialize(AgentModel aM){ 
     60                DeliberativeProcess dp = (DeliberativeProcess) aM.getComponent(DeliberativeProcess.NAME); 
    5961                this.loadCulture(aM); 
    60                 aM.getDeliberativeLayer().AddOptionsStrategy(this); 
    61                 aM.getDeliberativeLayer().setExpectedUtilityStrategy(this); 
     62                dp.addOptionsStrategy(this); 
     63                dp.setExpectedUtilityStrategy(this); 
    6264                aM.getRemoteAgent().setProcessActionStrategy(new CultureProcessActionStrategy()); 
    6365        } 
     
    111113                Ritual r2, r3; 
    112114                String ritualName; 
     115                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 
    113116                 
    114117                //this section detects if a ritual has started with another agent's action 
     
    138141                                                                ritualName = r3.getNameWithCharactersOrdered(); 
    139142                                                                r3.setUrgency(2); 
    140                                                                 if(!_ritualOptions.containsKey(ritualName) && !am.getDeliberativeLayer().ContainsIntention(r3)) 
     143                                                                if(!_ritualOptions.containsKey(ritualName) && !dp.containsIntention(r3)) 
    141144                                                                { 
    142145                                                                        AgentLogger.GetInstance().logAndPrint("Reactive Activation of a Ritual:" + r3.getName()); 
     
    159162         
    160163        private void loadCulture(AgentModel aM){ 
     164                 
     165                DeliberativeProcess dp = (DeliberativeProcess) aM.getComponent(DeliberativeProcess.NAME); 
    161166 
    162167                AgentLogger.GetInstance().log("LOADING Culture: " + this.cultureFile); 
     
    171176                        for(Ritual r : cultureLoader.GetRituals(aM)){ 
    172177                                this._rituals.add(r); 
    173                                 aM.getDeliberativeLayer().AddGoal(r); 
     178                                dp.addGoal(r); 
    174179                        } 
    175180 
     
    276281        public Collection<? extends ActivePursuitGoal> options(AgentModel am) { 
    277282                 
     283                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 
     284                 
    278285                Iterator<Ritual> it = _ritualOptions.values().iterator(); 
    279286                Ritual r; 
     
    282289                { 
    283290                        r = it.next(); 
    284                         if(am.getDeliberativeLayer().ContainsIntention(r)) 
     291                        if(dp.containsIntention(r)) 
    285292                        { 
    286293                                it.remove(); 
     
    294301        private float culturalEU(AgentModel am, ActivePursuitGoal g, float probability) 
    295302        { 
    296                 IUtilityStrategy str =  am.getDeliberativeLayer().getUtilityStrategy(); 
     303                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 
     304                 
     305                IUtilityStrategy str =  dp.getUtilityStrategy(); 
    297306                 
    298307                float contributionToSelf = str.getUtility(am, g); 
    299308                 
    300                 IGetUtilityForOthers ostrat = am.getDeliberativeLayer().getUtilityForOthersStrategy(); 
     309                IGetUtilityForOthers ostrat = dp.getUtilityForOthersStrategy(); 
    301310                 
    302311                float contributionOthers = ostrat.getUtilityForOthers(am, g); 
     
    314323        @Override 
    315324        public float getExpectedUtility(AgentModel am, ActivePursuitGoal g) { 
    316                  
    317                 float probability = am.getDeliberativeLayer().getProbabilityStrategy().getProbability(am, g); 
     325                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 
     326                 
     327                float probability = dp.getProbabilityStrategy().getProbability(am, g); 
    318328                return culturalEU(am,g,probability); 
    319329        } 
     
    322332        public float getExpectedUtility(AgentModel am, Intention i) { 
    323333                 
    324                 float probability = am.getDeliberativeLayer().getProbabilityStrategy().getProbability(am, i); 
     334                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME);  
     335                 
     336                float probability = dp.getProbabilityStrategy().getProbability(am, i); 
    325337                 
    326338                return culturalEU(am,i.getGoal(),probability); 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/CultureLoaderHandler.java

    r878 r950  
    7979                _rituals = new ArrayList<Ritual>(); 
    8080                _self = new Substitution(new Symbol("[SELF]"), new Symbol(FAtiMA.Core.util.Constants.SELF)); 
    81                 _reactiveLayer = aM.getReactiveLayer();  
    82                 _deliberativeLayer = aM.getDeliberativeLayer(); 
     81                _reactiveLayer = (ReactiveProcess) aM.getComponent(ReactiveProcess.NAME);  
     82                _deliberativeLayer = (DeliberativeProcess) aM.getComponent(DeliberativeProcess.NAME); 
    8383                _am = aM; 
    8484                _culturalComponent = cDM; 
     
    172172                if(_beforeRituals){ 
    173173                        String goalName = attributes.getValue("name");   
    174                     _deliberativeLayer.AddGoal(_am, goalName);   
     174                        _deliberativeLayer.addGoal(_am, goalName);   
    175175                } 
    176176    } 
     
    216216                stepName = Name.ParseName(attributes.getValue("name")); 
    217217                role = new Symbol(attributes.getValue("role")); 
    218                 _ritual.AddStep(stepName, role); 
     218                _ritual.AddStep(_am, stepName, role); 
    219219        } 
    220220 
     
    266266                        _ritual.AddCondition(_conditionType, cond); 
    267267                }else if (_currentGoalKey != null){ 
    268                         Goal g = _deliberativeLayer.getGoalLibrary().GetGoal(Name.ParseName(_currentGoalKey)); 
     268                        Goal g = _am.getGoalLibrary().GetGoal(Name.ParseName(_currentGoalKey)); 
    269269                        g.AddCondition(_conditionType, cond); 
    270270                } 
  • AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/Ritual.java

    r733 r950  
    3636import java.util.ListIterator; 
    3737 
    38 import FAtiMA.Core.ActionLibrary; 
    3938import FAtiMA.Core.AgentModel; 
    4039import FAtiMA.Core.conditions.Condition; 
     40import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 
    4141import FAtiMA.Core.deliberativeLayer.goals.ActivePursuitGoal; 
    4242import FAtiMA.Core.deliberativeLayer.plan.CausalLink; 
     
    8484        } 
    8585         
    86         public void AddStep(Name actionName, Name role) 
     86        public void AddStep(AgentModel am, Name actionName, Name role) 
    8787        { 
    8888                ArrayList<Substitution> subst; 
    89                 Step action = ActionLibrary.GetInstance().GetAction(_steps.size(), actionName); 
     89                Step action =  am.getActionLibrary().getAction(_steps.size(), actionName); 
    9090                if(action != null) 
    9191                { 
     
    164164        public void BuildPlan(AgentModel am) 
    165165        { 
     166                DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 
     167                 
    166168                Step s; 
    167169                OrderingConstraint o; 
    168                 _plan = new Plan(new ArrayList<ProtectedCondition>(),am.getDeliberativeLayer().getDetectThreatStrategy(),_successConditions); 
     170                _plan = new Plan(new ArrayList<ProtectedCondition>(),dp.getDetectThreatStrategy(),_successConditions); 
    169171                 
    170172                for(int i=0; i < _steps.size(); i++) 
Note: See TracChangeset for help on using the changeset viewer.