|
From: <jom...@us...> - 2008-05-04 08:55:06
|
Revision: 1287
http://jason.svn.sourceforge.net/jason/?rev=1287&view=rev
Author: jomifred
Date: 2008-05-04 01:55:03 -0700 (Sun, 04 May 2008)
Log Message:
-----------
jason team: basic herding working
Modified Paths:
--------------
trunk/applications/as-unit-test/build.xml
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/asl/goto.asl
trunk/applications/jason-team/src/asl/herding.asl
trunk/src/jason/stdlib/delete.java
trunk/src/jason/stdlib/min.java
Modified: trunk/applications/as-unit-test/build.xml
===================================================================
--- trunk/applications/as-unit-test/build.xml 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/applications/as-unit-test/build.xml 2008-05-04 08:55:03 UTC (rev 1287)
@@ -42,7 +42,7 @@
</target>
<target name="test" depends="jar">
- <ant dir="../.." target="jar" />
+ <ant dir="../.." target="jar" inheritall="false"/>
<junit printsummary="yes" failureProperty="test.failure">
<classpath refid="project.classpath" />
<classpath path="${build.dir}" />
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/applications/jason-team/readme.txt 2008-05-04 08:55:03 UTC (rev 1287)
@@ -17,13 +17,13 @@
svn update
ant plugin
- cd applications/jason-moise
- ant jar
-
2. run massim-server
cd applications/jason-team/massim-server
./startServer.sh
-
+
+ or some configuration for test
+ ./startServerTest.sh conf/<some conf file>.xml
+
3. run dummies (written in Jason)
ant -f dummies.xml
@@ -44,10 +44,15 @@
6. you can get the agents location with the command
- tail -f world-status.txt
+ tail -f world-status.txt
+
+ you can see the agent mind state with
+
+ ant -f gauchos.xml mind-view
+
-7. the get the graphical view of some agent, add gui=yes in
- the agent's option (.mas2j file)
+7. to enable/disable the graphical view of some agent, add gui=yes
+ or gui=no in the agent's option (.mas2j file)
Modified: trunk/applications/jason-team/src/asl/goto.asl
===================================================================
--- trunk/applications/jason-team/src/asl/goto.asl 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/applications/jason-team/src/asl/goto.asl 2008-05-04 08:55:03 UTC (rev 1287)
@@ -24,6 +24,9 @@
-at_target;
!!move.
+-target(_,_) // if I receive a message untell for my target, remove all target from BB
+ <- .abolish(target(_,_)).
+
// I still do not know my location
/*
+!move
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-04 08:55:03 UTC (rev 1287)
@@ -87,26 +87,26 @@
+!alloc_all([HA|TA],LA)
<- !find_closest(HA,LA,pos(X,Y),NLA);
.print("ooo Alocating position ",pos(X,Y)," to agent ",HA);
+ .send(HA,untell,target(_,_));
.send(HA,tell,target(X,Y));
//-+alloc_target(HA,Alloc);
!alloc_all(TA,NLA).
+!find_closest(Ag, ListPos, MinDist, Rest) // find the location in ListPos nearest to agent Ag
<- ?ally_pos(Ag,X,Y);
- .print("ooo try to alloc ",Ag," in ",X,Y," with ",ListPos);
- //?calc_distances(ListPos,Distances,pos(X,Y));
- //.print("Distances for ",ag_pos(Ag,X,Y)," are ",Distances);
- //.min(Distances,d(_,MinDist));
- //.delete(d(_,MinDist),Distances,Rest);
- //.print("rest is ",Rest).
- !closest(ListPos,[],[MinDist|Rest],pos(X,Y),9999).
+ //.print("ooo try to alloc ",Ag," in ",X,Y," with ",ListPos);
+ ?calc_distances(ListPos,Distances,pos(X,Y));
+ .print("Distances for ",ag_pos(Ag,X,Y)," are ",Distances);
+ .min(Distances,d(_,MinDist));
+ .delete(MinDist,ListPos,Rest).
+ //!closest(ListPos,[],[MinDist|Rest],pos(X,Y),9999).
-/*
+
calc_distances([],[],_) :- true.
calc_distances([pos(Fx,Fy)|TP], [d(D,pos(Fx,Fy))|TD], pos(AgX,AgY))
- :- .print("calc dist from for ag ",pos(AgX,AgY)) & jia.path_length(Fx,Fy,AgX,AgY,D) & calc_distances(TP, TD, pos(AgX,AgY)).
-*/
+ :- jia.path_length(Fx,Fy,AgX,AgY,D) & calc_distances(TP, TD, pos(AgX,AgY)).
+/*
+!closest([],S,S,_,_).
+!closest([pos(XH,YH)|T],Aux,S,pos(XP,YP),LD)
: jia.path_length(XH,YH,XP,YP,D) & D < LD
@@ -114,6 +114,7 @@
+!closest([pos(XH,YH)|T],Aux,S,pos(XP,YP),LD)
<- .concat(Aux,[pos(XH,YH)],Aux2);
!closest(T,Aux2,S,pos(XP,YP),LD).
+*/
/* -- plans for the goals of all roles (herder and herdboy) -- */
Modified: trunk/src/jason/stdlib/delete.java
===================================================================
--- trunk/src/jason/stdlib/delete.java 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/src/jason/stdlib/delete.java 2008-05-04 08:55:03 UTC (rev 1287)
@@ -113,7 +113,7 @@
if (u)
un = bak.copy();
else
- last = last.append(t);
+ last = last.append((Term)t.clone());
}
return r;
}
@@ -124,7 +124,7 @@
int i = 0;
for (Term t: l) {
if ((i++) != index)
- last = last.append(t);
+ last = last.append((Term)t.clone());
}
return r;
}
Modified: trunk/src/jason/stdlib/min.java
===================================================================
--- trunk/src/jason/stdlib/min.java 2008-05-03 20:26:40 UTC (rev 1286)
+++ trunk/src/jason/stdlib/min.java 2008-05-04 08:55:03 UTC (rev 1287)
@@ -87,7 +87,7 @@
min = t;
}
}
- return un.unifies(args[1], min);
+ return un.unifies(args[1], (Term)min.clone());
} catch (ArrayIndexOutOfBoundsException e) {
throw new JasonException("The internal action 'max/min' has not received two arguments.");
} catch (JasonException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|