Changeset 392
- Timestamp:
- 04/26/2010 05:56:08 PM (11 years ago)
- Location:
- AgentMind/trunk/AgentMind
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
AgentMind/trunk/AgentMind/Amy.txt
r381 r392 2 2 isPresent True 3 3 has none 4 location StudyRoom 4 possibleLocation,Afternoon unknown 5 knowPossibleLocation,Afternoon False -
AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/conditions/SACondition.java
r381 r392 110 110 System.out.println("Result " + result); 111 111 sset = new SubstitutionSet(); 112 sset.AddSubstitution(new Substitution(this._value, new Symbol(result)));112 sset.AddSubstitution(new Substitution(this._value, new Symbol(result))); 113 113 subs.add(sset); 114 114 … … 121 121 sac._query = this._query; 122 122 sac._value = (Symbol) this._value.clone(); 123 sac._knownVariables = (Hashtable<String, Symbol>) this._knownVariables.clone(); 123 124 sac._knownVariables = new Hashtable<String, Symbol>(); 125 Iterator<String> it = this._knownVariables.keySet().iterator(); 126 while (it.hasNext()) 127 { 128 String key = it.next(); 129 sac._knownVariables.put(key, (Symbol) this._knownVariables.get(key).clone()); 130 } 131 124 132 return sac; 125 133 } … … 146 154 public void MakeGround(ArrayList<Substitution> bindings) { 147 155 this._value.MakeGround(bindings); 148 Iterator<S tring> it = this._knownVariables.keySet().iterator();156 Iterator<Symbol> it = this._knownVariables.values().iterator(); 149 157 while (it.hasNext()) 150 158 { 151 String key = it.next(); 152 this._knownVariables.get(key).MakeGround(bindings); 159 it.next().MakeGround(bindings); 153 160 } 154 161 } … … 157 164 public void MakeGround(Substitution subst) { 158 165 this._value.MakeGround(subst); 159 Iterator<S tring> it = this._knownVariables.keySet().iterator();166 Iterator<Symbol> it = this._knownVariables.values().iterator(); 160 167 while (it.hasNext()) 161 168 { 162 String key = it.next(); 163 this._knownVariables.get(key).MakeGround(subst); 169 it.next().MakeGround(subst); 164 170 } 165 171 } … … 168 174 public void ReplaceUnboundVariables(int variableID) { 169 175 this._value.ReplaceUnboundVariables(variableID); 170 Iterator<S tring> it = this._knownVariables.keySet().iterator();176 Iterator<Symbol> it = this._knownVariables.values().iterator(); 171 177 while (it.hasNext()) 172 178 { 173 String key = it.next(); 174 this._knownVariables.get(key).ReplaceUnboundVariables(variableID); 179 it.next().ReplaceUnboundVariables(variableID); 175 180 } 176 181 } … … 179 184 public boolean isGrounded() { 180 185 if(!this._value.isGrounded()) return false; 181 Iterator<S tring> it = this._knownVariables.keySet().iterator();186 Iterator<Symbol> it = this._knownVariables.values().iterator(); 182 187 while (it.hasNext()) 183 188 { 184 String key = it.next(); 185 if(!this._knownVariables.get(key).isGrounded()) return false; 189 if(!it.next().isGrounded()) return false; 186 190 } 187 191 return true; -
AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/deliberativeLayer/DeliberativeProcess.java
r381 r392 133 133 import FAtiMA.deliberativeLayer.goals.GoalLibrary; 134 134 import FAtiMA.deliberativeLayer.goals.InterestGoal; 135 import FAtiMA.deliberativeLayer.plan.Effect; 135 136 import FAtiMA.deliberativeLayer.plan.IPlanningOperator; 136 137 import FAtiMA.deliberativeLayer.plan.Plan; … … 991 992 AddSubIntention(am, _currentIntention, (ActivePursuitGoal) copingAction); 992 993 } 993 994 else if(!actionName.startsWith("Inference") && !actionName.endsWith("Appraisal") && !actionName.startsWith("SA")) 994 995 { 995 996 fear = i.GetFear(am.getEmotionalState()); … … 1019 1020 1020 1021 _selectedAction = (Step) copingAction; 1022 } 1023 else if(actionName.startsWith("SA")) 1024 { 1025 Effect eff; 1026 1027 for(ListIterator<Effect> li = copingAction.getEffects().listIterator(); li.hasNext();) 1028 { 1029 eff = (Effect) li.next(); 1030 if(eff.isGrounded()) 1031 am.getMemory().getSemanticMemory().Tell(eff.GetEffect().getName(), eff.GetEffect().GetValue().toString()); 1032 } 1021 1033 } 1022 1034 else -
AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/memory/episodicMemory/ActionDetail.java
r381 r392 306 306 updated = true; 307 307 } 308 308 309 309 switch(em.GetType()) 310 310 { -
AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/memory/episodicMemory/Time.java
r381 r392 50 50 private long _narrativeTime; 51 51 private long _realTime; 52 private String _strRealTime; 52 53 private int _eventSequence; 53 54 … … 57 58 GregorianCalendar gcal = new GregorianCalendar(); 58 59 this._realTime = gcal.get(Calendar.HOUR_OF_DAY); 60 if(this._realTime >= 0 && this._realTime < 12) 61 this._strRealTime = "Morning"; 62 else 63 this._strRealTime = "Afternoon"; 59 64 this._eventSequence = _eventCounter; 60 65 _eventCounter++; … … 69 74 { 70 75 return this._realTime; 76 } 77 78 public String getStrRealTime() 79 { 80 return this._strRealTime; 71 81 } 72 82 -
AgentMind/trunk/AgentMind/FAtiMA/src/FAtiMA/util/parsers/StripsOperatorsLoaderHandler.java
r381 r392 258 258 _sac = SACondition.ParseSA(attributes); 259 259 _sac.MakeGround(_self); 260 }261 catch(Exception e)262 {263 e.printStackTrace();264 }265 }266 267 public void SAKnown(Attributes attributes) {268 String name;269 Symbol value;270 271 try272 {273 name = attributes.getValue("name");274 value = new Symbol(attributes.getValue("value"));275 System.out.println("known " + name + " " + value);276 _sac.AddKnownVariables(name, value);277 _sac.MakeGround(_self);278 260 if(_precondition) 279 261 _currentOperator.AddPrecondition(_sac); … … 286 268 { 287 269 e.printStackTrace(); 270 } 271 } 272 273 public void SAKnown(Attributes attributes) { 274 String name; 275 Symbol value; 276 277 try 278 { 279 name = attributes.getValue("name"); 280 value = new Symbol(attributes.getValue("value")); 281 System.out.println("known " + name + " " + value); 282 _sac.AddKnownVariables(name, value); 283 } 284 catch(Exception e) 285 { 286 e.printStackTrace(); 288 287 } 289 288 } -
AgentMind/trunk/AgentMind/MemoryProcesses/src/main/java/MemoryProcesses/SAQuery.java
r381 r392 50 50 private String _intention; 51 51 private String _status; 52 private String _time; 52 53 private String _speechActMeaning; 53 54 private String _multimediaPath; … … 74 75 this._intention = ""; 75 76 this._status = ""; 77 this._time = ""; 76 78 this._speechActMeaning = ""; 77 79 this._multimediaPath = ""; … … 155 157 this._numKnownVar++; 156 158 } 159 if (queryType.equals("time")) 160 { 161 while(query.hasMoreTokens()) 162 { 163 this._time = query.nextToken(); 164 } 165 this._numKnownVar++; 166 } 157 167 if (queryType.equals("speeachActMeaning")) 158 168 { … … 198 208 System.out.println("ID" + this._id + "subject " + this._subject + " target " + this._target 199 209 + " action " + this._action + " location " + this._location 200 + "intention " + this._intention + "status " + this._status 210 + "intention " + this._intention + "status " + this._status + "time " + this._time 201 211 + "speechActMeaning " + this._speechActMeaning + "multimediaPath " 202 212 + this._multimediaPath + "object " + this._object + "desirability " + this._desirability … … 215 225 this._intention = ""; 216 226 this._status = ""; 227 this._time = ""; 217 228 this._speechActMeaning = ""; 218 229 this._multimediaPath = ""; … … 259 270 public String getStatus(){ 260 271 return this._status; 272 } 273 274 public String getTime(){ 275 return this._time; 261 276 } 262 277 … … 340 355 } 341 356 357 public void setTime(String time){ 358 this._time = time; 359 } 360 342 361 public void setSpeechActMeaning(String speechActMeaning){ 343 362 this._speechActMeaning = speechActMeaning; … … 367 386 public void setResults(String result) 368 387 { 388 Integer val = new Integer(1); 389 369 390 if (result != null) 370 391 { 371 392 if (this._results == null || !this._results.containsKey(result)) 372 393 { 373 this._results.put(result, new Integer(1));394 this._results.put(result, val); 374 395 } 375 396 else 376 397 { 377 Integerval = (Integer) _results.get(result);398 val = (Integer) _results.get(result); 378 399 this._results.put(result, ++val); 379 if (this._maxFrequency < val)380 this._maxFrequency = val;381 400 } 401 if (this._maxFrequency < val) 402 this._maxFrequency = val; 382 403 } 383 404 } … … 385 406 public void setResultIDs(int result) 386 407 { 408 Integer val = new Integer(1); 409 387 410 if (result != -1) 388 411 { … … 393 416 else 394 417 { 395 Integerval = (Integer) _results.get(Integer.toString(result));418 val = (Integer) _results.get(Integer.toString(result)); 396 419 this._results.put(Integer.toString(result), ++val); 397 if (this._maxFrequency < val) 398 this._maxFrequency = val; 420 399 421 } 422 if (this._maxFrequency < val) 423 this._maxFrequency = val; 400 424 } 401 425 } -
AgentMind/trunk/AgentMind/MemoryProcesses/src/main/rules/SpreadActivate.drl
r328 r392 7 7 8 8 import FAtiMA.memory.episodicMemory.ActionDetail; 9 import FAtiMA.memory.episodicMemory.Time; 9 10 10 11 … … 112 113 System.out.println("Status " + $st1); 113 114 System.out.println("status-status " + $ad.getID()); 115 end 116 117 rule "time-time phase1" 118 no-loop true 119 salience 50 120 when 121 $q: SAQuery($t1: time) 122 $ad: ActionDetail(time.strRealTime == $t1) 123 then 124 insert (new CandidateEvent($ad, "time", 1.0f)); 125 retract ($ad); 126 System.out.println("Time " + $t1); 127 System.out.println("time-time " + $ad.getID()); 114 128 end 115 129 … … 244 258 end 245 259 260 rule "time-time" 261 no-loop true 262 when 263 $q: SAQuery($t1: time) 264 $cad: CandidateEvent(extension not contains "time") 265 $ad: ActionDetail(time.strRealTime == $t1) from $cad.actionDetail 266 then 267 modify ($cad) { 268 increasePhase(), 269 setExtension("time") 270 } 271 System.out.println("Time " + $t1); 272 System.out.println("time-time " + $ad.getID()); 273 end 274 246 275 rule "speechAct-speechAct" 247 276 no-loop true … … 426 455 end 427 456 457 rule "time" 458 no-loop true 459 when 460 $q: SAQuery(question == "time") 461 $cad: CandidateEvent( phase == $q.numKnownVar ) 462 $ad: ActionDetail() from $cad.actionDetail 463 Time($t: strRealTime) from $ad 464 then 465 modify ($q) { 466 setResults($t) 467 } 468 System.out.println("Time " + $t); 469 System.out.println("Retracted " +$ad.getID()); 470 retract ($cad); 471 end 472 428 473 rule "speechActMeaning" 429 474 no-loop true -
AgentMind/trunk/AgentMind/WorldTest/src/UserInterface.java
r381 r392 201 201 _infoOptions.addItem("target SELF"); 202 202 _infoOptions.addItem("target Amy"); 203 _infoOptions.addItem("time 17"); 203 204 _infoOptions.addItem("location LivingRoom"); 204 205 _infoOptions.addItem("action Greet"); -
AgentMind/trunk/AgentMind/data/characters/minds/LIRECScenarios.xml
r381 r392 141 141 142 142 <Properties> 143 <Property name="time" value=" Morning"/>143 <Property name="time" value="Afternoon"/> 144 144 <Property name="isPerson" value="True"/> 145 145 <Property name="location" value="LivingRoom"/>
Note: See TracChangeset
for help on using the changeset viewer.