|
From: <jom...@us...> - 2008-05-20 21:35:56
|
Revision: 1299
http://jason.svn.sourceforge.net/jason/?rev=1299&view=rev
Author: jomifred
Date: 2008-05-20 14:35:50 -0700 (Tue, 20 May 2008)
Log Message:
-----------
jason team: change from herding group to exploration group
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/OrgAgent.java
trunk/applications/jason-moise/src/jmoise/OrgManager.java
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/gauchos.xml
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/asl/exploration.asl
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/asl/herding.asl
trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
trunk/applications/jason-team/src/team-os.xml
Modified: trunk/applications/jason-moise/lib/moise.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jason-moise/src/jmoise/OrgAgent.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-05-20 21:35:50 UTC (rev 1299)
@@ -123,8 +123,10 @@
i.remove();
if (content.startsWith("goal_state")) {
// the state of a scheme i belong to has changed
- updateGoalBels( Pred.parsePred(content) );
+ // add all goals of the scheme in BB
+ updateGoalBels = true;
updateGoalEvt = true;
+ // Note: must change all goals, because the state of others may also change (waiting->possible)
} else {
Literal cl = addAsBel(content);
@@ -132,7 +134,9 @@
// this message is generated when my group becomes
// responsible for a scheme
generateObligationPermissionEvents(cl);
- } else if (content.startsWith("commitment")) {
+ } else if (content.startsWith("commitment")) {
+ // add all goals of the scheme in BB
+ updateGoalBels = true;
// I need to generate AS Triggers like !<orggoal> since some scheme becomes well formed
updateGoalEvt = true;
}
@@ -144,11 +148,21 @@
if (content.startsWith("scheme")) {
String schId = cl.getTerm(1).toString();
- removeAchieveGoalsOfSch(schId);
+ cleanGoalsOfSch(schId);
removeBeliefs(schId);
} else if (content.startsWith("scheme_group")) {
- removeObligationPermissionBeliefs(cl, "obligation");
- removeObligationPermissionBeliefs(cl, "permission");
+ Term sch = cl.getTerm(0);
+ Term gr = cl.getTerm(1);
+ removeObligationPermissionBeliefs(sch, gr, "obligation");
+ removeObligationPermissionBeliefs(sch, gr, "permission");
+ } else if (content.startsWith("commitment")) {
+ // if I remove my commit, remove the goals from BB
+ String schId = cl.getTerm(2).toString();
+ SchemeInstance sch = currentOE.findScheme(schId);
+ if (sch != null && !sch.isPlayer(getMyOEAgent())) {
+ cleanGoalsOfSch(schId);
+ removeBeliefs(schId);
+ }
}
}
}
@@ -237,13 +251,10 @@
}
- private void removeObligationPermissionBeliefs(Pred m, String type) throws RevisionFailedException {
+ private void removeObligationPermissionBeliefs(Term sch, Term gr, String type) throws RevisionFailedException {
// computes this agent obligations in the scheme
- Term sch = m.getTerm(0);
- Term grId = m.getTerm(1);
-
Structure giAnnot = new Structure("group");
- giAnnot.addTerm(grId);
+ giAnnot.addTerm(gr);
Literal obl = new Literal(type);
obl.addTerms(sch,new UnnamedVar());
@@ -327,7 +338,7 @@
return null;
}
- void removeAchieveGoalsOfSch(String schId) {
+ void cleanGoalsOfSch(String schId) {
Iterator<GoalInstance> i = alreadyGeneratedEvents.iterator();
while (i.hasNext()) {
GoalInstance gi = i.next();
@@ -377,7 +388,7 @@
/** add/remove bel regarding the goals' state */
void updateGoalBels() throws RevisionFailedException {
// for all missions
- // for all goals
+ // for all goals of the mission's scheme
// if not in BB, add
// if different from BB, remove/add
for (MissionPlayer mp : getMyOEAgent().getMissions()) {
Modified: trunk/applications/jason-moise/src/jmoise/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-05-20 21:35:50 UTC (rev 1299)
@@ -191,20 +191,20 @@
sender.adoptRole(roleId, grId);
GroupInstance gr = currentOE.findGroup(grId);
- // send schemes of this group to sender
- for (SchemeInstance sch : gr.getRespSchemes()) {
- updateMembersOE(sender, "scheme_group(" + sch.getId() + "," + grId + ")", true, true);
- }
-
// notify others in the group about this new player
updateMembersOE(gr.getAgents(true), "play(" + sender + "," + roleId + "," + grId + ")", true, true);
- // send players of this group to sender
+ // send players of the group to the sender
for (RolePlayer rp : gr.getPlayers(null, true)) {
- if (!rp.getPlayer().getId().equals(sender)) {
+ if (!rp.getPlayer().equals(sender)) {
updateMembersOE(sender, "play(" + rp.getPlayer().getId() + "," + rp.getRole().getId() + "," + grId + ")", false, true);
}
}
+
+ // send schemes of this group to sender
+ for (SchemeInstance sch : gr.getRespSchemes()) {
+ updateMembersOE(sender, "scheme_group(" + sch.getId() + "," + grId + ")", false, true);
+ }
sendReply(sender, mId, "ok");
}
}
@@ -252,7 +252,7 @@
// notify to the sender the other commitments of the scheme
for (MissionPlayer mp : sch.getPlayers()) {
- if (!mp.getPlayer().getId().equals(sender)) {
+ if (!mp.getPlayer().equals(sender)) {
updateMembersOE(sender, "commitment(" + mp.getPlayer().getId() + "," + mp.getMission().getId() + "," + sch.getId() + ")", false, true);
}
}
@@ -358,15 +358,6 @@
gr.checkRemove();
- /*String annot = "";
- if (gr.getGrSpec().isRoot()) {
- annot = "root";
- } else {
- annot = "super_gr(" + gr.getSuperGroup().getId() + ")";
- }
- */
- //updateMembersOE(currentOE.getAgents(), "group(" + gr.getGrSpec().getId() + "," + gr.getId() + ")[owner(" + gr.getOwner() + ")," + annot + "]", false, false);
-
// also send untell scheme_group (if it is the case)
for (SchemeInstance sch: gr.getRespSchemes()) {
updateMembersOE(gr.getPlayers(), "scheme_group(" + sch.getId() + "," + grId + ")", false, false);
@@ -606,22 +597,12 @@
Iterator iAgs = ags.iterator();
while (iAgs.hasNext()) {
Object next = iAgs.next();
- OEAgent ag = null;
- try {
- // check if it is a list of OEAgents
- ag = (OEAgent) next;
- } catch (ClassCastException e) {
- try {
- // check if it is a list of Players
- ag = ((Player) next).getPlayer();
- } catch (ClassCastException e2) {
- }
- }
+ if (next instanceof OEAgent) // check if it is a list of OEAgents
+ all.add((OEAgent) next);
+ else if (next instanceof Player) // check if it is a list of Players
+ all.add(((Player) next).getPlayer());
- if (ag != null) {
- all.add(ag);
- }
}
for (OEAgent ag : all) {
updateMembersOE(ag, pEnv, sendOE, tell);
@@ -633,7 +614,7 @@
try {
if (sendOE) {
Message moe = new Message("tell", null, ag.getId(), null);
- moe.setPropCont(currentOE.partialOE(ag));
+ moe.setPropCont(currentOE); //partialOE(ag)); // TODO: the clone of OE is not working!
sendMsg(moe);
}
if (pEnv != null) {
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-20 21:35:50 UTC (rev 1299)
@@ -20,42 +20,42 @@
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
gaucho2 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant2, password="2"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
gaucho3 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant3, password="3"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
gaucho4 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant4, password="4"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
gaucho5 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant5, password="5"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
gaucho6 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
- "group_area(key, _, _)");
+ "group_area(key, _)");
directives: maintenance_goal = agent.OrgMaintenanceGoal;
Modified: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/gauchos.xml 2008-05-20 21:35:50 UTC (rev 1299)
@@ -94,7 +94,7 @@
<target name="run" depends="compile" >
<delete failonerror="no" includeEmptyDirs="true" verbose="false">
- <fileset dir="tmp-ag-mind" includes="*.xml"/>
+ <fileset dir="mind-ag-gaucho1" includes="*.xml"/>
</delete>
<echo message="Running project ${ant.project.name}" />
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/readme.txt 2008-05-20 21:35:50 UTC (rev 1299)
@@ -45,7 +45,8 @@
you can see the agent mind state with
ant -f gauchos.xml mind-view
-
+
+ or in the files stored in directory mind-ag-gaucho1
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/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-05-20 21:35:50 UTC (rev 1299)
@@ -1,26 +1,28 @@
/* -- plans for exploration phase -- */
-/* -- initial beliefs -- */
-
-/* -- initial goals -- */
-
-
/*
-- plans for new match
-- create the initial exploration groups and areas
*/
-/* plans for agents with odd id */
++gsize(_,_) // new match has started
+ <- !define_areas;
+ !create_exploration_gr.
-+gsize(_,_) // new match has started
++!define_areas
+ <- ?gsize(W,H);
+ X = math.round(((W*H)/3)/H);
+ +group_area(0, area(0, 0, X, H-1));
+ +group_area(1, area(X+1, 0, W-1, H/2));
+ +group_area(2, area(X+1, (H/2)+1, W-1, H-1)).
+
++!create_exploration_gr
: .my_name(Me) &
agent_id(Me,AgId) &
- AgId mod 2 == 1 // I have an odd Id
- <- !create_exploration_gr.
-
-+!create_exploration_gr
+ AgId mod 2 == 1 & // I have an odd Id and thus have to create a exploring group
+ not .intend(create_exploration_gr)
<- .my_name(Me);
// create the team, if necessary
@@ -28,6 +30,7 @@
jmoise.create_group(team)
};
+ // create the exploration group
if( not group(exploration_grp,_)[owner(Me)] ) {
?group(team,TeamGroup); // get the team Id
jmoise.create_group(exploration_grp,TeamGroup,G);
@@ -35,41 +38,11 @@
} {
?group(exploration_grp,G)[owner(Me)]
};
-
- .print("ooo Recruiting scouters for my explorer group ",G);
-
- ?pos(MyX,MyY,_); // wait my pos
- // wait others pos
- while( .count(ally_pos(_,_,_), N) & N < 5 ) {
- .print("ooo waiting others pos ");
- .wait("+ally_pos(_,_,_)", 500, _)
- };
-
- // find distance to even agents
- .findall(ag_d(D,AgName),
- ally_pos(AgName,X,Y) & agent_id(AgName,Id) & Id mod 2 == 0 & jia.path_length(MyX, MyY, X, Y, D),
- LOdd);
- .sort(LOdd, LSOdd);
-
- // test if I received the area of my group
- ?group_area(AreaId,G,A);
- .print("ooo Scouters candidates =", LSOdd," in area ",group_area(AreaId,G,A));
-
// adopt role explorer in the group
- jmoise.adopt_role(explorer,G);
- !find_scouter(LSOdd, G).
+ !change_role(explorer,G).
++!create_exploration_gr.
-+!find_scouter([],_)
- <- .print("ooo I did not find a scouter to work with me!").
-+!find_scouter([ag_d(_,AgName)|_],GId)
- <- .print("ooo Ask ",AgName," to play scouter");
- .send(AgName, achieve, play_role(scouter,GId));
- .wait("+play(AgName,scouter,GId)",2000).
--!find_scouter([_|LSOdd],GId) // in case the wait fails, try next agent
- <- .print("ooo find_scouter failure, try another agent.");
- !find_scouter(LSOdd,GId).
-
// If if start playing explorer in a group that has no scheme, create the scheme
+play(Me,explorer,G)
: .my_name(Me) &
@@ -79,38 +52,70 @@
// If I stop playing explorer, destroy the explore groups I've created
-play(Me,explorer,_)
: .my_name(Me)
- <- .wait(4000);
- for( group(exploration_grp,G)[owner(Me)] ) {
+ <- for( group(exploration_grp,G)[owner(Me)] ) {
.print("ooo Removing group ",G," since I am not in the group anymore");
jmoise.remove_group(G);
.wait(4000)
}.
-+group(exploration_grp,_) // compute the area of the groups
+/*+group(exploration_grp,_) // compute the area of the groups
: .my_name(gaucho1) &
group(team,TeamId) &
.findall(GId, group(exploration_grp,GId)[super_gr(TeamId)], LG) &
LG = [G1,G2,G3] // there are three groups
- <- ?gsize(W,H);
- X = math.round(((W*H)/3)/H);
- +group_area(0, G1, area(0, 0, X, H-1));
- +group_area(1, G2, area(X+1, 0, W-1, H/2));
- +group_area(2, G3, area(X+1, (H/2)+1, W-1, H-1)).
+group_area(ID,G,A)[source(self)]
<- .broadcast(tell, group_area(ID,G,A)).
-
+*/
/* -- plans for the goals of role explorer -- */
++!find_scouter[scheme(Sch),group(G)]
+ <- .print("ooo Recruiting scouters for my explorer group ",G);
+
+ // test if I received the area of my group
+ //?group_area(AreaId,G,A);
+ //.print("ooo Scouters candidates =", LSOdd," in area ",group_area(AreaId,G,A));
+
+ !find_scouter([], G);
+ jmoise.set_goal_state(Sch, find_scouter, satisfied).
+
++!find_scouter(_,G) // if someone plays scouter in my group, it is ok.
+ : play(_,scouter,G).
++!find_scouter([],G)
+ <- ?pos(MyX,MyY,_); // wait my pos
+
+ // wait others pos
+ while( .count(ally_pos(_,_,_), N) & N < 5 ) {
+ .print("ooo waiting others pos ");
+ .wait("+ally_pos(_,_,_)", 500, _)
+ };
+
+ // find distance to even agents
+ .findall(ag_d(D,AgName),
+ ally_pos(AgName,X,Y) & agent_id(AgName,Id) & Id mod 2 == 0 & jia.path_length(MyX, MyY, X, Y, D),
+ LOdd);
+ .sort(LOdd, LSOdd);
+ !find_scouter(LSOdd,G).
++!find_scouter([ag_d(_,AgName)|_],GId)
+ <- .print("ooo Ask ",AgName," to play scouter");
+ .send(AgName, achieve, play_role(scouter,GId));
+ .wait("+play(AgName,scouter,GId)",2000).
+-!find_scouter([_|LSOdd],GId) // in case the wait fails, try next agent
+ <- .print("ooo find_scouter failure, try another agent.");
+ !find_scouter(LSOdd,GId).
+
+
+
{ begin maintenance_goal("+at_target") }
+!goto_near_unvisited[scheme(Sch),mission(Mission)]
<- .print("ooo I should find the nearest unvisited location and go there!");
.my_name(Me);
- ?play(Me,explorer,GroupId); // get the group where I play explorer
- ?group_area(_,GroupId, Area); // get the area of this group
+ ?agent_id(Me,MyId);
+ ?group_area(MyId div 2, Area); // get the area of my group
+
?pos(MeX, MeY, _); // get my location
jia.near_least_visited(MeX, MeY, Area, TargetX, TargetY);
-+target(TargetX, TargetY).
@@ -160,7 +165,7 @@
if( DistanceToLeader > (AGPR * 2) -3) {
.print("ooo Approaching leader.");
-+target(LX,LY)
- }{
+ } {
.print("ooo being in formation with leader.");
.send(Leader,askOne,target(_,_),target(TX,TY));
jia.scouter_pos(LX, LY, TX, TY, SX, SY);
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-20 21:35:50 UTC (rev 1299)
@@ -32,7 +32,7 @@
/* -- plans -- */
+?pos(X, Y, S) <- .wait("+pos(X,Y,S)").
-+?group_area(Id,G,A) <- .wait("+group_area(Id,G,A)").
+//+?group_area(Id,G,A) <- .wait("+group_area(Id,G,A)").
+?gsize(W,H) <- .wait("+gsize(W,H)").
+?group(team,G) <- .wait("+group(team,G)", 500, _); ?group(team,G).
+?ally_pos(Name,X,Y) : .my_name(Name) <- ?pos(X,Y,_).
@@ -90,7 +90,7 @@
+!change_role(NewRole,GT)[source(S)]
<- .my_name(Me);
- .print("ooo Adopting the role ",NewRole," in group ",GT,", as asked by ",S);
+ .print("ooo Changing to role ",NewRole," in group ",GT,", as asked by ",S);
// give up all missions
while( commitment(Me,M,Sch) ) {
@@ -99,7 +99,7 @@
};
// if I play herder in another group, ...
- if( play(Me,herder,G) & G \== GT) {
+ if( NewRole == herdboy & play(Me,herder,G) & G \== GT) {
// ask all herdboys to also change the group
.findall(Boy,play(Boy,herdboy,G),HerdBoys);
.send(HerdBoys, achieve, change_role(herdboy,GT))
@@ -112,11 +112,13 @@
jmoise.adopt_role(NewRole,GT).
+-!change_role(R,G)
+ <- !change_role(R,G).
+!play_role(R,G)
: .my_name(Me) & play(Me,R,G).
+!play_role(Role,Group)[source(Ag)]
- <- .print("ooo Adopting role ",Role," in group ",Group,", asked by ",Ag);
+ <- .print("ooo Adopting role ",Role," in group ",Group,", as asked by ",Ag);
jmoise.adopt_role(Role, Group).
// finish the scheme if it has no more players
@@ -128,17 +130,21 @@
// when I have an obligation or permission to a mission, commit to it
+obligation(Sch, Mission)
- <- jmoise.commit_mission(Mission,Sch).
+ <- .print("ooo Obligation to commit to mission ",Mission);
+ jmoise.commit_mission(Mission,Sch).
+permission(Sch, Mission)
- <- jmoise.commit_mission(Mission,Sch).
+ <- .print("ooo Permission to commit to mission ",Mission);
+ jmoise.commit_mission(Mission,Sch).
// when I am not obligated to a mission anymore, uncommit
-obligation(Sch, Mission)
: .my_name(Me) & commitment(Me,Mission,Sch)
- <- jmoise.remove_mission(Mission,Sch).
+ <- .print("ooo I don't have obligation for the mission ",Mission," anymore, remove the commit");
+ jmoise.remove_mission(Mission,Sch).
-permission(Sch, Mission)
: .my_name(Me) & commitment(Me,Mission,Sch)
- <- jmoise.remove_mission(Mission,Sch).
+ <- .print("ooo I don't have permission for the mission ",Mission," anymore, remove the commit");
+ jmoise.remove_mission(Mission,Sch).
// when I am not committed to a mission anymore, remove all goals based on that mission
-commitment(Me,Mission,Sch)
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-20 21:35:50 UTC (rev 1299)
@@ -1,10 +1,8 @@
/* -- plans for herding phase -- */
-/* -- initial beliefs -- */
/* -- plans for herding groups creation -- */
-
+!create_herding_gr
: not .intend(create_herding_gr)
<- .print("ooo Creating herding group.");
@@ -37,15 +35,21 @@
// If I stop playing herder, destroy the herding groups I've created
-play(Me,herder,_)
: .my_name(Me)
- <- .wait(4000);
- for( group(herding_grp,G)[owner(Me)] ) {
+ <- for( group(herding_grp,G)[owner(Me)] ) {
-group_leader(G,Me);
.broadcast(untell, group_leader(G,Me));
jmoise.remove_group(G);
.wait(4000)
}.
+
+// If I stop playing herboy (because the group was destroied by the herder),
+// I should try yo create my new exploration group
+-play(Me,herdboy,_)
+ : .my_name(Me)
+ <- .print("ooo I do not play herdboy anymore, try to play a role in an exploration group.");
+ !create_exploration_gr.
-
+
/* -- plans for the goals of role herder -- */
{ begin maintenance_goal("+pos(_,_,_)") }
@@ -84,8 +88,9 @@
jia.cluster(Cluster,CAsList);
-+current_cluster(CAsList);
jia.herd_position(.length(G),Cluster,L);
- .print("ooo Formation is ",L, " for agents ",G," in cluster ", Cluster);
- !alloc_all(G,L).
+ .reverse(L,RL); // use the reversed list so to priorise the border positions
+ .print("ooo Formation is ",RL, " for agents ",G," in cluster ", Cluster);
+ !alloc_all(G,RL).
{ end }
@@ -145,6 +150,23 @@
*/
+{ begin maintenance_goal("+pos(_,_,_)") }
+
++!change_to_exploring[scheme(Sch),mission(Mission)]
+ : not cow(_,_,_)
+ <- .print("ooo I see no cow anymore");
+ // wait two cycles to decide to change the formation (due to fault perception we may not see the cows)
+ .wait("+pos(_,_,_)");
+ .wait("+pos(_,_,_)");
+ if (not cow(_,_,_)) {
+ !!create_exploration_gr
+ }.
+
++!change_to_exploring[scheme(Sch),mission(Mission)].
+
+{ end }
+
+
/* -- plans for the goals of all roles (herder and herdboy) -- */
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-05-20 21:35:50 UTC (rev 1299)
@@ -59,7 +59,7 @@
String fileName = "world-status.txt";
File dirmind = null;
try {
- dirmind = new File("tmp-ag-mind");
+ dirmind = new File("mind-ag-"+owner.getAgName());
dirmind.mkdir();
} catch (Exception e) {
dirmind = null;
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-05-18 14:57:19 UTC (rev 1298)
+++ trunk/applications/jason-team/src/team-os.xml 2008-05-20 21:35:50 UTC (rev 1299)
@@ -71,19 +71,26 @@
<properties>
<property id="check-players-in-remove-responsible-group" value="false" />
<property id="only-owner-can-remove-scheme" value="false" />
+ <!--property id="check-goals-in-remove-mission" value="false" /-->
</properties>
<scheme id="explore_sch" >
<goal id="find_cows" >
<plan operator="parallel">
+ <goal id="init_scheme">
+ <plan operator="sequence">
+ <goal id="find_scouter" ds="find a scouter to help in the exploration" />
+ <goal id="change_to_herding" ds="verify if necessary to create the herding group" type="maintenance"/>
+ </plan>
+ </goal>
<goal id="goto_near_unvisited" ds="go to the near unvisited location inside the area of the group" type="maintenance"/>
<goal id="share_seen_cows" ds="share seen cows with other agents in the scheme" type="maintenance"/>
<goal id="follow_leader" ds="follows the leader of the scheme/group" type="maintenance"/>
- <goal id="change_to_herding" ds="verify if necessary to create the herding group" type="maintenance"/>
</plan>
</goal>
<mission id="explore" min="1">
+ <goal id="find_scouter" />
<goal id="goto_near_unvisited" />
<goal id="share_seen_cows" />
<goal id="change_to_herding" />
@@ -97,10 +104,11 @@
<scheme id="herd_sch" >
<goal id="herd_cows" >
<plan operator="parallel">
- <goal id="recruit" ds="recruit more herdboys depending on the size of the cows cluster" type="maintenance"/>
- <goal id="define_formation" ds="compute the ideal location of each member of the group and share this information with them" type="maintenance"/>
- <goal id="be_in_formation" ds="go to the place allocated to the agent in the formation" type="maintenance"/>
- <goal id="share_seen_cows" ds="share seen cows with other agents in the scheme" type="maintenance"/>
+ <goal id="recruit" ds="recruit more herdboys depending on the size of the cows cluster" type="maintenance"/>
+ <goal id="define_formation" ds="compute the ideal location of each member of the group and share this information with them" type="maintenance"/>
+ <goal id="be_in_formation" ds="go to the place allocated to the agent in the formation" type="maintenance"/>
+ <goal id="share_seen_cows" ds="share seen cows with other agents in the scheme" type="maintenance"/>
+ <goal id="change_to_exploring" ds="verify if necessary to finish the herding group and create the exploring groups" type="maintenance"/>
</plan>
</goal>
@@ -109,6 +117,7 @@
<goal id="define_formation" />
<goal id="be_in_formation" />
<goal id="share_seen_cows" />
+ <goal id="change_to_exploring" />
</mission>
<mission id="help_herder" >
<goal id="be_in_formation" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|