|
From: <jom...@us...> - 2008-06-11 21:27:40
|
Revision: 1337
http://jason.svn.sourceforge.net/jason/?rev=1337&view=rev
Author: jomifred
Date: 2008-06-11 14:27:35 -0700 (Wed, 11 Jun 2008)
Log Message:
-----------
improve comments in the food-simulation example
Modified Paths:
--------------
trunk/examples/food-simulation/FoodSimulation.mas2j
trunk/examples/food-simulation/src/asl/blind.asl
trunk/examples/food-simulation/src/asl/normative.asl
trunk/examples/food-simulation/src/asl/reputation.asl
trunk/examples/food-simulation/src/asl/strategic.asl
trunk/release-notes.txt
Modified: trunk/examples/food-simulation/FoodSimulation.mas2j
===================================================================
--- trunk/examples/food-simulation/FoodSimulation.mas2j 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/examples/food-simulation/FoodSimulation.mas2j 2008-06-11 21:27:35 UTC (rev 1337)
@@ -1,13 +1,15 @@
/*
Jason Project
- -- create on December 20, 2007
-
-- Food Simulation --
based on the description available at
http://jasss.soc.surrey.ac.uk/1/3/3.html
-
+
+ used in the chapter about Jason in the book
+ "Agents, Simulation and Applications" by
+ Adelinde M. Uhrmacher and Danny Weyns
+
*/
/*
@@ -63,4 +65,4 @@
reputation [verbose=0] #25;
aslSourcePath: "src/asl";
-}
\ No newline at end of file
+}
Modified: trunk/examples/food-simulation/src/asl/blind.asl
===================================================================
--- trunk/examples/food-simulation/src/asl/blind.asl 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/examples/food-simulation/src/asl/blind.asl 2008-06-11 21:27:35 UTC (rev 1337)
@@ -1,14 +1,16 @@
-// rule 1: food in my position
+/* -- blind agent -- */
+
+// rule 1: If there is food in my cell, eat.
+step(_) : food(X,Y,my_pos,_) <- eat.
-// rule 2: food I see
+// rule 2: If I see food in a free cell, move to there
+step(_) : food(X,Y,see,_) & not agent(_,X,Y,_,_) <- move(X,Y).
-// rule 3: food I see
+// rule 3: If I see food in an occupied cell, attack the agent at that cell
+step(_) : food(X,Y,see,_) & agent(_,X,Y,_,eating) <- attack(X,Y).
-// rule 4: food I smell
+// rule 4: If I smell food, move to there
+step(_) : food(X,Y,smell,_) <- move(X,Y).
-// rule 5
+// rule 5: Otherwise, do a random movement
+step(_) <- random_move.
Modified: trunk/examples/food-simulation/src/asl/normative.asl
===================================================================
--- trunk/examples/food-simulation/src/asl/normative.asl 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/examples/food-simulation/src/asl/normative.asl 2008-06-11 21:27:35 UTC (rev 1337)
@@ -1,16 +1,24 @@
+/* -- normative agent -- */
-// food in my position
+// Rule-n1: only eat food that is free or allocated to me
+step(_) : food(X,Y,my_pos,A) & (pos(A,_,_) | A == -1) <- eat.
-// food I see
+// Rule-n2: if I see food allocated to me, move to there
+step(_) : food(X,Y,see,Me) & pos(Me,_,_) & not agent(_,X,Y,_,_) <- move(X,Y).
+
+// Rule-n3: if I see unallocated food, move to there
+step(_) : food(X,Y,see,-1) & not agent(_,X,Y,_,_) <- move(X,Y).
+
+// Rule-n4: if I see another agent eating food owned by others, attack it
+step(_) : food(X,Y,see,OAg) & agent(AgId,X,Y,_,eating) &
AgId \== OAg & OAg \== -1
<- attack(X,Y).
-// food I smell
+// Rule-n5: if I smell my food, move to there
+step(_) : food(X,Y,smell,Me) & pos(Me,_,_) <- move(X,Y).
+
+// Rule-n6: if I smell unallocated food, move to there
+step(_) : food(X,Y,smell,-1) <- move(X,Y).
+// Rule-n7: otherwise, move randomly
+step(_) <- random_move.
Modified: trunk/examples/food-simulation/src/asl/reputation.asl
===================================================================
--- trunk/examples/food-simulation/src/asl/reputation.asl 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/examples/food-simulation/src/asl/reputation.asl 2008-06-11 21:27:35 UTC (rev 1337)
@@ -1,20 +1,28 @@
+/* -- reputation agent -- */
-// food in my position
+// Rule-r1: eat food that is either allocate to me, free, or belongs to a cheater
+step(_) : food(_,_,my_pos,A) & (pos(A,_,_) | A == -1 | cheater(A)) <- eat.
-// food I see
+// Rule-r2: if I see food allocated to me, move to there
+step(_) : food(X,Y,see,Me) & pos(Me,_,_) & not agent(_,X,Y,_,_) <- move(X,Y).
+
+// Rule-r3: if I see unallocated food, move to there
+step(_) : food(X,Y,see,-1) & not agent(_,X,Y,_,_) <- move(X,Y).
+
+// Rule-r4: attack cheaters that are weaker than me
+step(_) : food(X,Y,see,_) & agent(AgId,X,Y,S,eating) &
cheater(AgId) &
strength(MS) & MS > S
<- attack(X,Y).
-// food I smell
+// Rule-r5: if I smell my food, move to there
+step(_) : food(X,Y,smell,Me) & pos(Me,_,_) <- move(X,Y).
+
+// Rule-r6: if I smell unallocated food, move to there
+step(_) : food(X,Y,smell,-1) <- move(X,Y).
+// Rule-r7: otherwise, move randomly
+step(_) <- random_move.
Modified: trunk/examples/food-simulation/src/asl/strategic.asl
===================================================================
--- trunk/examples/food-simulation/src/asl/strategic.asl 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/examples/food-simulation/src/asl/strategic.asl 2008-06-11 21:27:35 UTC (rev 1337)
@@ -1,3 +1,4 @@
+/* -- strategic agent -- */
// food in my position
+step(_) : food(X,Y,my_pos,_) <- eat.
Modified: trunk/release-notes.txt
===================================================================
--- trunk/release-notes.txt 2008-06-09 22:54:15 UTC (rev 1336)
+++ trunk/release-notes.txt 2008-06-11 21:27:35 UTC (rev 1337)
@@ -62,7 +62,8 @@
Bugs fixed:
. BUF add annotation "source(percept)" in the perception deletion event
. drop_desire does not remove desires in Circumstance.Event correctly
- when annotations are used.
+ when annotations are used
+. print works like println
-------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|