- Timestamp:
- 02/12/2011 05:24:08 PM (10 years ago)
- 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 15 15 import FAtiMA.Core.componentTypes.IAppraisalDerivationComponent; 16 16 import FAtiMA.Core.conditions.Condition; 17 import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 17 18 import FAtiMA.Core.deliberativeLayer.IExpectedUtilityStrategy; 18 19 import FAtiMA.Core.deliberativeLayer.IGetUtilityForOthers; … … 57 58 @Override 58 59 public void initialize(AgentModel aM){ 60 DeliberativeProcess dp = (DeliberativeProcess) aM.getComponent(DeliberativeProcess.NAME); 59 61 this.loadCulture(aM); 60 aM.getDeliberativeLayer().AddOptionsStrategy(this);61 aM.getDeliberativeLayer().setExpectedUtilityStrategy(this);62 dp.addOptionsStrategy(this); 63 dp.setExpectedUtilityStrategy(this); 62 64 aM.getRemoteAgent().setProcessActionStrategy(new CultureProcessActionStrategy()); 63 65 } … … 111 113 Ritual r2, r3; 112 114 String ritualName; 115 DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 113 116 114 117 //this section detects if a ritual has started with another agent's action … … 138 141 ritualName = r3.getNameWithCharactersOrdered(); 139 142 r3.setUrgency(2); 140 if(!_ritualOptions.containsKey(ritualName) && ! am.getDeliberativeLayer().ContainsIntention(r3))143 if(!_ritualOptions.containsKey(ritualName) && !dp.containsIntention(r3)) 141 144 { 142 145 AgentLogger.GetInstance().logAndPrint("Reactive Activation of a Ritual:" + r3.getName()); … … 159 162 160 163 private void loadCulture(AgentModel aM){ 164 165 DeliberativeProcess dp = (DeliberativeProcess) aM.getComponent(DeliberativeProcess.NAME); 161 166 162 167 AgentLogger.GetInstance().log("LOADING Culture: " + this.cultureFile); … … 171 176 for(Ritual r : cultureLoader.GetRituals(aM)){ 172 177 this._rituals.add(r); 173 aM.getDeliberativeLayer().AddGoal(r);178 dp.addGoal(r); 174 179 } 175 180 … … 276 281 public Collection<? extends ActivePursuitGoal> options(AgentModel am) { 277 282 283 DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 284 278 285 Iterator<Ritual> it = _ritualOptions.values().iterator(); 279 286 Ritual r; … … 282 289 { 283 290 r = it.next(); 284 if( am.getDeliberativeLayer().ContainsIntention(r))291 if(dp.containsIntention(r)) 285 292 { 286 293 it.remove(); … … 294 301 private float culturalEU(AgentModel am, ActivePursuitGoal g, float probability) 295 302 { 296 IUtilityStrategy str = am.getDeliberativeLayer().getUtilityStrategy(); 303 DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 304 305 IUtilityStrategy str = dp.getUtilityStrategy(); 297 306 298 307 float contributionToSelf = str.getUtility(am, g); 299 308 300 IGetUtilityForOthers ostrat = am.getDeliberativeLayer().getUtilityForOthersStrategy();309 IGetUtilityForOthers ostrat = dp.getUtilityForOthersStrategy(); 301 310 302 311 float contributionOthers = ostrat.getUtilityForOthers(am, g); … … 314 323 @Override 315 324 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); 318 328 return culturalEU(am,g,probability); 319 329 } … … 322 332 public float getExpectedUtility(AgentModel am, Intention i) { 323 333 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); 325 337 326 338 return culturalEU(am,i.getGoal(),probability); -
AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/CultureLoaderHandler.java
r878 r950 79 79 _rituals = new ArrayList<Ritual>(); 80 80 _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); 83 83 _am = aM; 84 84 _culturalComponent = cDM; … … 172 172 if(_beforeRituals){ 173 173 String goalName = attributes.getValue("name"); 174 _deliberativeLayer.AddGoal(_am, goalName);174 _deliberativeLayer.addGoal(_am, goalName); 175 175 } 176 176 } … … 216 216 stepName = Name.ParseName(attributes.getValue("name")); 217 217 role = new Symbol(attributes.getValue("role")); 218 _ritual.AddStep( stepName, role);218 _ritual.AddStep(_am, stepName, role); 219 219 } 220 220 … … 266 266 _ritual.AddCondition(_conditionType, cond); 267 267 }else if (_currentGoalKey != null){ 268 Goal g = _ deliberativeLayer.getGoalLibrary().GetGoal(Name.ParseName(_currentGoalKey));268 Goal g = _am.getGoalLibrary().GetGoal(Name.ParseName(_currentGoalKey)); 269 269 g.AddCondition(_conditionType, cond); 270 270 } -
AgentMind/branches/FAtiMA-Modular/FAtiMA.culture/src/FAtiMA/culture/Ritual.java
r733 r950 36 36 import java.util.ListIterator; 37 37 38 import FAtiMA.Core.ActionLibrary;39 38 import FAtiMA.Core.AgentModel; 40 39 import FAtiMA.Core.conditions.Condition; 40 import FAtiMA.Core.deliberativeLayer.DeliberativeProcess; 41 41 import FAtiMA.Core.deliberativeLayer.goals.ActivePursuitGoal; 42 42 import FAtiMA.Core.deliberativeLayer.plan.CausalLink; … … 84 84 } 85 85 86 public void AddStep( Name actionName, Name role)86 public void AddStep(AgentModel am, Name actionName, Name role) 87 87 { 88 88 ArrayList<Substitution> subst; 89 Step action = ActionLibrary.GetInstance().GetAction(_steps.size(), actionName);89 Step action = am.getActionLibrary().getAction(_steps.size(), actionName); 90 90 if(action != null) 91 91 { … … 164 164 public void BuildPlan(AgentModel am) 165 165 { 166 DeliberativeProcess dp = (DeliberativeProcess) am.getComponent(DeliberativeProcess.NAME); 167 166 168 Step s; 167 169 OrderingConstraint o; 168 _plan = new Plan(new ArrayList<ProtectedCondition>(), am.getDeliberativeLayer().getDetectThreatStrategy(),_successConditions);170 _plan = new Plan(new ArrayList<ProtectedCondition>(),dp.getDetectThreatStrategy(),_successConditions); 169 171 170 172 for(int i=0; i < _steps.size(); i++)
Note: See TracChangeset
for help on using the changeset viewer.