|
From: <jom...@us...> - 2008-04-22 21:57:22
|
Revision: 1242
http://jason.svn.sourceforge.net/jason/?rev=1242&view=rev
Author: jomifred
Date: 2008-04-22 14:57:19 -0700 (Tue, 22 Apr 2008)
Log Message:
-----------
include the moise+ spec of the team
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/OrgAgent.java
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/dummies.xml
trunk/applications/jason-team/gauchos.xml
trunk/applications/jason-team/src/java/arch/IdentifyCrashed.java
Added Paths:
-----------
trunk/applications/jason-team/src/asl/orgManager.asl
trunk/applications/jason-team/src/team-os.xml
Removed Paths:
-------------
trunk/applications/jason-moise/example/clima-contest/
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-04-22 19:02:31 UTC (rev 1241)
+++ trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-04-22 21:57:19 UTC (rev 1242)
@@ -91,7 +91,7 @@
if (m.getPropCont() instanceof OE) {
currentOE = (OE) m.getPropCont();
i.remove();
- } else {
+ } else if (m.getSender().equals(getOrgManagerName())) {
// the content is a normal predicate
final String content = m.getPropCont().toString();
final boolean isTell = m.getIlForce().equals("tell");
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-22 19:02:31 UTC (rev 1241)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-22 21:57:19 UTC (rev 1242)
@@ -10,37 +10,41 @@
infrastructure: Centralised
agents:
- gaucho1 dummy.asl
+ orgManager [osfile="src/team-os.xml",gui=yes]
+ agentArchClass jmoise.OrgManager;
+
+ gaucho1 gaucho.asl
[verbose=1, gui=yes, write_status=yes, ac_sim_back_dir="./massim-server/backup",
host="localhost", port=12300, username=participant1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
- gaucho2 dummy.asl
+ gaucho2 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant2, password="2"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
- gaucho3 dummy.asl
+ gaucho3 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant3, password="3"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
- gaucho4 dummy.asl
+ gaucho4 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant4, password="4"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
- gaucho5 dummy.asl
+ gaucho5 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant5, password="5"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
- gaucho6 dummy.asl
+ gaucho6 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
aslSourcePath: "src/asl";
+
}
Modified: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml 2008-04-22 19:02:31 UTC (rev 1241)
+++ trunk/applications/jason-team/dummies.xml 2008-04-22 21:57:19 UTC (rev 1242)
@@ -8,7 +8,7 @@
April 10, 2008 - 23:19:55
-->
-<project name ="miners"
+<project name ="dummies"
basedir="."
default="run">
Modified: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-04-22 19:02:31 UTC (rev 1241)
+++ trunk/applications/jason-team/gauchos.xml 2008-04-22 21:57:19 UTC (rev 1242)
@@ -28,6 +28,9 @@
<!-- tasks the user can override in his/her c-build.xml script -->
<target name="user-init">
+ <copy file="../jason-moise/lib/jmoise.jar" todir="lib" />
+ <copy file="../jason-moise/lib/moise.jar" todir="lib" />
+ <copy file="../jason-moise/src/asl/moise-common.asl" todir="src/asl" />
</target>
<target name="user-end">
</target>
Added: trunk/applications/jason-team/src/asl/orgManager.asl
===================================================================
--- trunk/applications/jason-team/src/asl/orgManager.asl (rev 0)
+++ trunk/applications/jason-team/src/asl/orgManager.asl 2008-04-22 21:57:19 UTC (rev 1242)
@@ -0,0 +1 @@
+/* nothing here, everything is implemented in the arhitecture */
\ No newline at end of file
Modified: trunk/applications/jason-team/src/java/arch/IdentifyCrashed.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/IdentifyCrashed.java 2008-04-22 19:02:31 UTC (rev 1241)
+++ trunk/applications/jason-team/src/java/arch/IdentifyCrashed.java 2008-04-22 21:57:19 UTC (rev 1242)
@@ -1,19 +1,20 @@
package arch;
-import java.util.List;
-
import jason.JasonException;
-import jason.architecture.AgArch;
import jason.asSyntax.Literal;
import jason.mas2j.ClassParameters;
import jason.runtime.Settings;
+import java.util.List;
+
+import jmoise.OrgAgent;
+
/**
* An agent architecture that try to identify a crashed agent and then try to fix it.
*
* @author Jomi
*/
-public class IdentifyCrashed extends AgArch {
+public class IdentifyCrashed extends OrgAgent {
private boolean didPercept = true;
private int maxCycleTime = 4000;
Added: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml (rev 0)
+++ trunk/applications/jason-team/src/team-os.xml 2008-04-22 21:57:19 UTC (rev 1242)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?xml-stylesheet href="http://moise.sourceforge.net/xml/os.xsl" type="text/xsl" ?>
+
+<organisational-specification
+
+ id="jason-cowboys"
+ os-version="0.4"
+
+ xmlns='http://moise.sourceforge.net/os'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+ xsi:schemaLocation='http://moise.sourceforge.net/os
+ http://moise.sourceforge.net/xml/os.xsd' >
+
+ <structural-specification>
+
+ <role-definitions>
+ <role id="cowboy" />
+ <role id="leader"> <extends role="cowboy"/> </role>
+ <role id="explorer"> <extends role="leader"/> </role>
+ <role id="herder"> <extends role="leader"/> </role>
+ <role id="scouter"> <extends role="cowboy"/> </role>
+ <role id="herdboy"> <extends role="cowboy"/> </role>
+ </role-definitions>
+
+ <group-specification id="team">
+ <links>
+ <link from="cowboy" to="cowboy" type="communication"
+ scope="inter-group" extends-sub-groups="true" bi-dir="false"/>
+ <link from="leader" to="cowboy" type="authority"
+ scope="intra-group" extends-sub-groups="true" bi-dir="false"/>
+ </links>
+
+ <sub-groups>
+
+ <group-specification id="exploration" >
+ <roles>
+ <role id="explorer" min="1" max="1"/>
+ <role id="scouter" />
+ </roles>
+ </group-specification>
+
+ <group-specification id="herding" >
+ <roles>
+ <role id="herder" min="1" max="1"/>
+ <role id="herdboy" />
+ </roles>
+ </group-specification>
+ </sub-groups>
+
+ <formation-constraints>
+ <!--compatibility from="cowboy" to="cowboy" type="compatibility"
+ scope="intra-group" extends-sub-groups="true"
+ bi-dir="true"/ -->
+ </formation-constraints>
+ </group-specification>
+ </structural-specification>
+
+
+
+ <functional-specification>
+ </functional-specification>
+
+ <deontic-specification>
+ </deontic-specification>
+</organisational-specification>
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-23 15:22:11
|
Revision: 1244
http://jason.svn.sourceforge.net/jason/?rev=1244&view=rev
Author: jomifred
Date: 2008-04-23 08:22:04 -0700 (Wed, 23 Apr 2008)
Log Message:
-----------
improve org. spec of the team
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/OrgManager.java
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/java/arch/CowboyArch.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/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-22 22:09:11 UTC (rev 1243)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-23 15:22:04 UTC (rev 1244)
@@ -67,9 +67,8 @@
// starts GUI
if ("yes".equals(getTS().getSettings().getUserParameter("gui"))) {
try {
- simOE = new SimOE(currentOE);
+ simOE = new SimOE(currentOE, false);
simOE.setName("OrgManager");
- simOE.frame.getContentPane().remove(simOE.frame.OESimTabPanel);
simOE.frame.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent e) {
if (simOE != null) {
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-22 22:09:11 UTC (rev 1243)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-23 15:22:04 UTC (rev 1244)
@@ -10,7 +10,7 @@
infrastructure: Centralised
agents:
- orgManager [osfile="src/team-os.xml",gui=yes]
+ orgManager [osfile="src/team-os.xml",gui=no]
agentArchClass jmoise.OrgManager;
gaucho1 gaucho.asl
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-22 22:09:11 UTC (rev 1243)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-23 15:22:04 UTC (rev 1244)
@@ -18,18 +18,40 @@
/* -- initial beliefs -- */
-/* -- create the initial exploration groups -- */
+/* -- initial goals -- */
+!test.
++!test <- +gsize(16,8).
+
+/* -- create the initial exploration groups and areas -- */
+
++gsize(_Weight,_Height) // new match've started
+ : .my_name(gaucho1)
+ <- .if( group(team,Old), {
+ jmoise.remove_group(Old)
+ });
+ .abolish(area(_,_,_,_,_));
+ jmoise.create_group(team).
+gsize(Weight,Height)
- : .my_name(gaucho1)
- <- jmoise.create_group(team).
+ <- .abolish(area(_,_,_,_,_)).
+
+group(team,GId)
: .my_name(gaucho1)
<- jmoise.create_group(exploration,GId);
jmoise.create_group(exploration,GId);
jmoise.create_group(exploration,GId).
++group(exploration,_) // compute the area of the groups
+ : .my_name(gaucho1) &
+ .findall(GId, group(exploration,GId), LG) &
+ LG = [G1,G2,G3] // there are three groups
+ <- ?gsize(W,H);
+ X = math.round(((W*H)/3)/H);
+ +area(G1, 0, 0, X, H-1);
+ +area(G2, X+1, 0, W-1, H/2);
+ +area(G3, X+1, (H/2)+1, W-1, H-1).
++area(G,A,B,C,D)[source(self)]
+ <- .broadcast(tell, area(G,A,B,C,D)).
-
// include common plans for MOISE+ agents
{ include("moise-common.asl") }
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-22 22:09:11 UTC (rev 1243)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-23 15:22:04 UTC (rev 1244)
@@ -30,7 +30,7 @@
*/
public class CowboyArch extends IdentifyCrashed {
- LocalWorldModel model = null;
+ LocalWorldModel model = new LocalWorldModel(10,10);
WorldView view = null;
String simId = null;
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-04-22 22:09:11 UTC (rev 1243)
+++ trunk/applications/jason-team/src/team-os.xml 2008-04-23 15:22:04 UTC (rev 1244)
@@ -5,7 +5,7 @@
<organisational-specification
id="jason-cowboys"
- os-version="0.4"
+ os-version="0.5"
xmlns='http://moise.sourceforge.net/os'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
@@ -13,6 +13,10 @@
http://moise.sourceforge.net/xml/os.xsd' >
<structural-specification>
+ <properties>
+ <property id="check-players-in-remove-group" value="false" />
+ <property id="check-sub-group-in-remove-group" value="false" />
+ </properties>
<role-definitions>
<role id="cowboy" />
@@ -24,6 +28,7 @@
</role-definitions>
<group-specification id="team">
+
<links>
<link from="cowboy" to="cowboy" type="communication"
scope="inter-group" extends-sub-groups="true" bi-dir="false"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-24 15:32:44
|
Revision: 1250
http://jason.svn.sourceforge.net/jason/?rev=1250&view=rev
Author: jomifred
Date: 2008-04-24 08:32:33 -0700 (Thu, 24 Apr 2008)
Log Message:
-----------
add abort_scheme in jason-moise
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/remove_mission.java
trunk/applications/jason-moise/src/jmoise/remove_scheme.java
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/team-os.xml
Added Paths:
-----------
trunk/applications/jason-moise/src/jmoise/abort_scheme.java
Modified: trunk/applications/jason-moise/lib/moise.jar
===================================================================
(Binary files differ)
Added: trunk/applications/jason-moise/src/jmoise/abort_scheme.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/abort_scheme.java (rev 0)
+++ trunk/applications/jason-moise/src/jmoise/abort_scheme.java 2008-04-24 15:32:33 UTC (rev 1250)
@@ -0,0 +1,50 @@
+package jmoise;
+
+import jason.asSemantics.TransitionSystem;
+import jason.asSemantics.Unifier;
+import jason.asSyntax.Term;
+
+/**
+
+<p>Organisational action: <b><code>jmoise.abort_scheme( SchId )</code></b>:
+ used by an agent to abort the execution of a scheme.
+ SchId is the identification of the scheme instance.
+ This organisational action does not require that no agent is committed to
+ the scheme, as does .jmoise.remove_scheme.
+
+<p>Conditions to succeed:
+<ul>
+<li>the agent performing the action is the owner of the scheme;</li>
+</ul>
+
+<p>Consequences:
+<ul>
+<li>there is no more responsible groups for the scheme;</li>
+<li>the agents of the scheme are no more obligated to achieve the scheme's goals.</li>
+</ul>
+
+<p>Examples:
+<ul>
+<li> <code>jmoise.abort_scheme(wp0)</code>:
+ removes the scheme identified by wp0 form the organisational entity.</li>
+</ul>
+
+@see jmoise.create_scheme
+@see jmoise.commit_mission
+@see jmoise.remove_mission
+@see jmoise.set_goal_arg
+@see jmoise.set_goal_state
+@see jmoise.add_responsible_group
+@see jmoise.remove_scheme
+@see <a href="http://moise.sourceforge.net/doc/tutorial.pdf">Moise+ Tutorial, chapter for J-Moise+</a>
+
+@author Jomi
+
+*/
+public class abort_scheme extends MoiseBaseIA {
+
+ @Override
+ public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
+ return super.execute(ts,un,args);
+ }
+}
Modified: trunk/applications/jason-moise/src/jmoise/remove_mission.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/remove_mission.java 2008-04-24 15:06:43 UTC (rev 1249)
+++ trunk/applications/jason-moise/src/jmoise/remove_mission.java 2008-04-24 15:32:33 UTC (rev 1250)
@@ -16,7 +16,7 @@
<p>Conditions to succeed:
<ul>
<li>the agent is committed to MissionId in SchId;</li>
-<li>all goals of the mission are satisfied; if a super goal of a mission's goal is
+<li>all achievement goals of the mission are satisfied; if a super goal of a mission's goal is
satisfied, the goal is also considered as satisfied.</li>
</ul>
Modified: trunk/applications/jason-moise/src/jmoise/remove_scheme.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/remove_scheme.java 2008-04-24 15:06:43 UTC (rev 1249)
+++ trunk/applications/jason-moise/src/jmoise/remove_scheme.java 2008-04-24 15:32:33 UTC (rev 1250)
@@ -18,7 +18,7 @@
<p>Consequences:
<ul>
-<li>there is no more responsible groups for the scheme.</li>
+<li>there is no more responsible groups for the scheme.</li>
</ul>
<p>Examples:
@@ -33,6 +33,8 @@
@see jmoise.set_goal_arg
@see jmoise.set_goal_state
@see jmoise.add_responsible_group
+@see jmoise.abort_scheme
+
@see <a href="http://moise.sourceforge.net/doc/tutorial.pdf">Moise+ Tutorial, chapter for J-Moise+</a>
@author Jomi
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-24 15:06:43 UTC (rev 1249)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-24 15:32:33 UTC (rev 1250)
@@ -32,7 +32,7 @@
});
.abolish(area(_,_,_,_,_));
jmoise.create_group(team).
-+gsize(Weight,Height)
++gsize(_Weight,_Height)
<- .abolish(area(_,_,_,_,_)).
+group(team,GId)
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-04-24 15:06:43 UTC (rev 1249)
+++ trunk/applications/jason-team/src/team-os.xml 2008-04-24 15:32:33 UTC (rev 1250)
@@ -5,7 +5,7 @@
<organisational-specification
id="jason-cowboys"
- os-version="0.5"
+ os-version="0.6"
xmlns='http://moise.sourceforge.net/os'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
@@ -64,9 +64,27 @@
<functional-specification>
+ <scheme id="exploring" >
+ <goal id="find_cows" >
+ <plan operator="parallel">
+ <goal id="goto_near_unvisited" ds="go to the near unvisited location inside the area of the group" type="maintenance"/>
+ <goal id="share_cows" ds="share seen cows with other agents in the scheme" type="maintenance"/>
+ </plan>
+ </goal>
+
+ <mission id="mscouter" >
+ <goal id="share_cows" />
+ </mission>
+ <mission id="mexplorer" min="1">
+ <goal id="goto_near_unvisited" />
+ <goal id="share_cows" />
+ </mission>
+ </scheme>
</functional-specification>
<deontic-specification>
+ <deontic-relation type="obligation" role="explorer" mission="mscouter" />
+ <deontic-relation type="obligation" role="scouter" mission="mexplorer" />
</deontic-specification>
</organisational-specification>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-24 22:26:42
|
Revision: 1252
http://jason.svn.sourceforge.net/jason/?rev=1252&view=rev
Author: jomifred
Date: 2008-04-24 15:26:31 -0700 (Thu, 24 Apr 2008)
Log Message:
-----------
create exploration groups for the team
explorer finds a scouter
gauchos code splited in many sources
Modified Paths:
--------------
trunk/applications/jason-eclipse-plugin/.project
trunk/applications/jason-eclipse-plugin/build.xml
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/java/arch/ACArchitecture.java
trunk/applications/jason-team/src/java/arch/CowboyArch.java
trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
Added Paths:
-----------
trunk/applications/jason-team/src/asl/exploration.asl
trunk/applications/jason-team/src/asl/goto.asl
trunk/applications/jason-team/src/asl/herding.asl
Modified: trunk/applications/jason-eclipse-plugin/.project
===================================================================
--- trunk/applications/jason-eclipse-plugin/.project 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-eclipse-plugin/.project 2008-04-24 22:26:31 UTC (rev 1252)
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>JasonIDE</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jason eclipse plugin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Modified: trunk/applications/jason-eclipse-plugin/build.xml
===================================================================
--- trunk/applications/jason-eclipse-plugin/build.xml 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-eclipse-plugin/build.xml 2008-04-24 22:26:31 UTC (rev 1252)
@@ -25,14 +25,6 @@
<pathelement location="${jasonJar}" />
</path>
- <condition property="parsers-ok" value="ok">
- <and>
- <uptodate property="parsers-ok" targetfile="${basedir}/src/jason/mas2j/parser/mas2j.java" srcfile="${basedir}/src/jason/mas2j/parser/MAS2JavaParser.jcc" />
- <uptodate property="parsers-ok" targetfile="${basedir}/src/jason/asSyntax/parser/as2j.java" srcfile="${basedir}/src/jason/asSyntax/parser/AS2JavaParser.jcc" />
- <uptodate property="parsers-ok" targetfile="${basedir}/doc/AS2JavaParser.html" srcfile="${basedir}/src/jason/asSyntax/parser/AS2JavaParser.jcc" />
- </and>
- </condition>
-
<target name="init">
<mkdir dir="${build.dir}" />
</target>
Modified: trunk/applications/jason-moise/lib/moise.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-24 22:26:31 UTC (rev 1252)
@@ -10,7 +10,7 @@
infrastructure: Centralised
agents:
- orgManager [osfile="src/team-os.xml",gui=no]
+ orgManager [osfile="src/team-os.xml",gui=yes]
agentArchClass jmoise.OrgManager;
gaucho1 gaucho.asl
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-24 22:26:31 UTC (rev 1252)
@@ -115,7 +115,7 @@
<- .current_intention(I); .println("failure in move, intention: ",I);
!move.
-+restart
++!restart
<- .print("*** restart ***");
.drop_all_desires;
.abolish(target(_,_));
Added: trunk/applications/jason-team/src/asl/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl (rev 0)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-04-24 22:26:31 UTC (rev 1252)
@@ -0,0 +1,82 @@
+/* -- plans for exploration phase -- */
+
+/* -- initial goals -- */
+
+//!test.
+//+!test <- +gsize(16,8).
+
+/*
+ -- plans for new match
+ -- create the initial exploration groups and areas
+*/
+
+
+/* plans for agent 1 */
+
++gsize(_Weight,_Height) // new match've started
+ : .my_name(gaucho1) // agent 1 is responsible for the team creation
+ <- .print("oooo creating team group");
+ .if( group(team,Old), {
+ jmoise.remove_group(Old)
+ });
+ jmoise.create_group(team).
+
++group(team,GId) // agent 1 is responsible for the creation of exploration groups
+ : .my_name(gaucho1)
+ <- jmoise.create_group(exploration,GId);
+ jmoise.create_group(exploration,GId);
+ jmoise.create_group(exploration,GId).
++group(exploration,_) // compute the area of the groups
+ : .my_name(gaucho1) &
+ .findall(GId, group(exploration,GId), 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 agents with even id */
+
++gsize(_,_)
+ : .my_name(Me) &
+ agent_id(Me,AgId) &
+ AgId mod 2 == 0 // I have an even Id
+ <- // wait my pos
+ .if(not pos(MyX, MyY,_), { MyX = 333; MyY = 444 }); //.wait("+pos(MyX,MyY,_)")
+ .print("oooo ",MyX, MyY); //?pos(MyX, MyY,_);
+
+ // wait others pos
+ .if(not cell(_,_,ally(_)), { .wait("+cell(_,_,ally(_))") });
+ .wait(200);
+
+ // find distance to odd agents
+ .findall(ag_d(D,AgName),
+ cell(X,Y,ally(AgName)) & .print(AgName) & agent_id(AgName,Id) & .print(AgName," ooo ",Id) & Id mod 2 == 1 & jia.dist(MyX, MyY, X, Y, D),
+ LOdd);
+ .sort(LOdd, LSOdd);
+ // test if I received the area of my group
+ .if( not group_area(AgId div 2,G,A), { .wait("+group_area(AgId div 2,G,A)") });
+ .print("oooo Ags=", LSOdd," in area ",group_area(AgId div 2,G,A));
+
+ // adopt role explorer in the group
+ jmoise.adopt_role(explorer,G);
+ !find_scouter(LSOdd, G).
+
++!find_scouter([],_)
+ <- .print("oooo I do not find a scouter to work with me!").
++!find_scouter([ag_d(_,AgName)|_],GId)
+ <- .send(AgName, achieve, play_role(scouter,GId));
+ .wait("+play(Ag,scouter,GId)",1000).
+-!find_scouter([_|LSOdd],GId) // in case the wait fails, try next agent
+ <- !find_scouter(LSOdd,GId).
+
+
+/* plans for agents the others */
+
++!play_role(Role,Group)
+ <- jmoise.adopt_role(Role,Group).
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-24 22:26:31 UTC (rev 1252)
@@ -18,40 +18,34 @@
/* -- initial beliefs -- */
+agent_id(gaucho1,0).
+agent_id(gaucho2,1).
+agent_id(gaucho3,2).
+agent_id(gaucho4,3).
+agent_id(gaucho5,4).
+agent_id(gaucho6,5).
+
+ag_perception_ratio(8). // ratio of perception of the agent
+cow_perception_ratio(4).
+
/* -- initial goals -- */
-!test.
-+!test <- +gsize(16,8).
+/* -- plans -- */
-/* -- create the initial exploration groups and areas -- */
++end_of_simulation(_Result)
+ <- .abolish(area(_,_,_,_,_,_)).
-+gsize(_Weight,_Height) // new match've started
- : .my_name(gaucho1)
- <- .if( group(team,Old), {
- jmoise.remove_group(Old)
- });
- .abolish(area(_,_,_,_,_));
- jmoise.create_group(team).
-+gsize(_Weight,_Height)
- <- .abolish(area(_,_,_,_,_)).
-
-+group(team,GId)
- : .my_name(gaucho1)
- <- jmoise.create_group(exploration,GId);
- jmoise.create_group(exploration,GId);
- jmoise.create_group(exploration,GId).
-+group(exploration,_) // compute the area of the groups
- : .my_name(gaucho1) &
- .findall(GId, group(exploration,GId), LG) &
- LG = [G1,G2,G3] // there are three groups
- <- ?gsize(W,H);
- X = math.round(((W*H)/3)/H);
- +area(G1, 0, 0, X, H-1);
- +area(G2, X+1, 0, W-1, H/2);
- +area(G3, X+1, (H/2)+1, W-1, H-1).
-+area(G,A,B,C,D)[source(self)]
- <- .broadcast(tell, area(G,A,B,C,D)).
++!restart
+ <- //.print("*** restart ***");
+ .drop_all_desires;
+ .abolish(target(_,_)).
+ // TODO: what to do?
+ //!decide_target.
-// include common plans for MOISE+ agents
-{ include("moise-common.asl") }
+/* -- includes -- */
+{ include("goto.asl") } // include plans for movimentation
+{ include("exploration.asl") } // include plans for exploration
+{ include("herding.asl") } // include plans for herding
+{ include("moise-common.asl") } // include common plans for MOISE+ agents
+
Added: trunk/applications/jason-team/src/asl/goto.asl
===================================================================
--- trunk/applications/jason-team/src/asl/goto.asl (rev 0)
+++ trunk/applications/jason-team/src/asl/goto.asl 2008-04-24 22:26:31 UTC (rev 1252)
@@ -0,0 +1,56 @@
+
+/* -- plans for movimentation -- */
+
+
+/* -- useful rules */
+
+// find a free random location
+random_pos(X,Y) :-
+ pos(AgX,AgY,_) &
+ jia.random(RX,40) & RX > 5 & X = (RX-20)+AgX & X > 0 &
+ jia.random(RY,40,5) & RY > 5 & Y = (RY-20)+AgY &
+ not jia.obstacle(X,Y).
+
+
+
+/* -- plans to move to a destination represented in the belief target(X,Y)
+ -- (it is a kind of persistent goal)
+*/
+
+// if the target is changed, "restart" move
++target(NX,NY)
+ <- .drop_desire(move);
+ jia.set_target(NX,NY);
+ !!move.
+
+// I still do not know my location
++!move
+ : not pos(_,_,_)
+ <- .print("waiting my location....");
+ .wait("+pos(_,_,_)");
+ !move.
+
++!move
+ : not target(_,_)
+ <- .print("waiting my target....");
+ .wait("+target(_,_)");
+ !move.
+
++!move
+ : pos(X,Y,_) & target(X,Y) // I am at target
+ <- -+at_target;
+ do(skip);
+ !!move.
+
+// does one step towards target
++!move
+ : pos(X,Y,_) &
+ target(BX,BY) &
+ jia.direction(X, Y, BX, BY, D) // jia.direction finds one action D (using A*) towards the target
+ <- do(D); // this action will "block" the intention until it is sent to the simulator (in the end of the cycle)
+ !!move. // continue moving
+
+// in case of failure, move
+-!move
+ <- .current_intention(I); .println("failure in move, intention: ",I);
+ !move.
Added: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl (rev 0)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-04-24 22:26:31 UTC (rev 1252)
@@ -0,0 +1 @@
+/* -- plans for herding phase -- */
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-24 22:26:31 UTC (rev 1252)
@@ -139,6 +139,7 @@
Lock lock = new ReentrantLock();
Condition cycle = lock.newCondition();
long timestartcycle = 0;
+ int cycleCounter = 0;
WaitSleep() {
super("WaitSpeepToSendAction");
@@ -156,6 +157,9 @@
}
void newCycle() {
+ cycleCounter++;
+ if (getCycle() == 1) cycleCounter = 1;
+
StringBuilder notsent = new StringBuilder();
if (toExecute.size() > 1) {
notsent.append(" The following was not sent: ");
@@ -173,7 +177,7 @@
// prepare msg to print out
String w = "";
- if (lastActionInCurrentCycle == null) {
+ if (lastActionInCurrentCycle == null && cycleCounter > 3) { // ignore problem in the first cycles (the agent is still in setup!)
addRestart();
w = "*** ";
}
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-24 22:26:31 UTC (rev 1252)
@@ -2,6 +2,7 @@
import jason.JasonException;
import jason.RevisionFailedException;
+import jason.asSemantics.Intention;
import jason.asSemantics.Message;
import jason.asSyntax.Atom;
import jason.asSyntax.Literal;
@@ -224,9 +225,7 @@
try {
logger.info("** Arch adding restart for "+getAgName());
getTS().getC().create();
-
- getTS().getAg().getBB().abolish(new Literal("restart").getPredicateIndicator());
- getTS().getAg().addBel(new Literal("restart"));
+ getTS().getC().addAchvGoal(new Literal("restart"), Intention.EmptyInt);
lo2 = new Location(-1,-1); // to not restart again in the next cycle
} catch (Exception e) {
logger.info("Error in restart!"+ e);
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-24 16:03:14 UTC (rev 1251)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-24 22:26:31 UTC (rev 1252)
@@ -67,21 +67,23 @@
//out.println(model.toString());
StringBuilder s = new StringBuilder(String.format("Step %5d : ", owner.getCycle()-1));
for (int agId=0; agId<WorldModel.agsByTeam; agId++) {
- Location agp = agents[agId].getLastLocation();
- if (agp != null) {
- // count how long the agent is in the same location
- int c = 0;
- Iterator<Location> il = locations.get(agId).iterator();
- while (il.hasNext() && il.next().equals(agp) && c <= 11) {
- c++;
- }
- String sc = "*";
- if (c < 10) sc = ""+c;
-
- locations.get(agId).add(0,agp);
- String lastAct = shortActionFormat(agents[agId].getLastAction());
- s.append(String.format("%5d,%2d/%s %s", agp.x, agp.y, sc, lastAct));
- }
+ if (agents[agId] != null) {
+ Location agp = agents[agId].getLastLocation();
+ if (agp != null) {
+ // count how long the agent is in the same location
+ int c = 0;
+ Iterator<Location> il = locations.get(agId).iterator();
+ while (il.hasNext() && il.next().equals(agp) && c <= 11) {
+ c++;
+ }
+ String sc = "*";
+ if (c < 10) sc = ""+c;
+
+ locations.get(agId).add(0,agp);
+ String lastAct = shortActionFormat(agents[agId].getLastAction());
+ s.append(String.format("%5d,%2d/%s %s", agp.x, agp.y, sc, lastAct));
+ }
+ }
}
logger.info(s.toString());
out.println(s.toString());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-26 20:32:42
|
Revision: 1265
http://jason.svn.sourceforge.net/jason/?rev=1265&view=rev
Author: jomifred
Date: 2008-04-26 13:32:39 -0700 (Sat, 26 Apr 2008)
Log Message:
-----------
fix bug in OrgManager
Modified Paths:
--------------
trunk/applications/as-unit-test/src/jason/tests/TestAll.java
trunk/applications/jason-moise/src/jmoise/OrgManager.java
Modified: trunk/applications/as-unit-test/src/jason/tests/TestAll.java
===================================================================
--- trunk/applications/as-unit-test/src/jason/tests/TestAll.java 2008-04-26 14:12:31 UTC (rev 1264)
+++ trunk/applications/as-unit-test/src/jason/tests/TestAll.java 2008-04-26 20:32:39 UTC (rev 1265)
@@ -10,7 +10,8 @@
BugVarsInInitBels.class,
TestAddLogExprInBB.class,
TestGoalSource.class,
- TestIF.class,
+ TestIF.class,
+ TestLoop.class,
TestKQML.class,
TestPlanbodyAsTerm.class,
TestPlanFailure.class,
Modified: trunk/applications/jason-moise/src/jmoise/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-26 14:12:31 UTC (rev 1264)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-26 20:32:39 UTC (rev 1265)
@@ -133,6 +133,9 @@
while (i.hasNext()) {
Message m = i.next();
i.remove(); // the agent do not receive this message
+ if (currentOE == null) break;
+ if (m.getSender() == null) break;
+
OEAgent agSender = currentOE.getAgent(m.getSender());
if (logger.isLoggable(Level.FINE)) logger.fine("Processing '" + m + "' for " + agSender);
try {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-27 14:10:21
|
Revision: 1271
http://jason.svn.sourceforge.net/jason/?rev=1271&view=rev
Author: jomifred
Date: 2008-04-27 07:10:17 -0700 (Sun, 27 Apr 2008)
Log Message:
-----------
the creation of groups/schemes for exploration are ok
start coding the scouter (not finished)
Modified Paths:
--------------
trunk/applications/jason-moise/src/jmoise/OrgAgent.java
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/java/jia/herd_position.java
Modified: trunk/applications/jason-moise/src/jmoise/OrgAgent.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-04-27 14:10:17 UTC (rev 1271)
@@ -30,10 +30,12 @@
import java.util.logging.Logger;
import moise.oe.GoalInstance;
+import moise.oe.GroupInstance;
import moise.oe.MissionPlayer;
import moise.oe.OE;
import moise.oe.OEAgent;
import moise.oe.Permission;
+import moise.oe.RolePlayer;
import moise.oe.SchemeInstance;
import moise.os.fs.Goal;
import moise.os.fs.Goal.GoalType;
@@ -185,8 +187,9 @@
}
private void generateOrgGoalEvents() {
- for (GoalInstance gi : getMyOEAgent().getPossibleGoals()) {
- if (!alreadyGeneratedEvents.contains(gi)) {
+ OEAgent me = getMyOEAgent();
+ for (GoalInstance gi : getMyOEAgent().getPossibleGoals()) {
+ if (!alreadyGeneratedEvents.contains(gi)) {
alreadyGeneratedEvents.add(gi);
Literal l = Literal.parseLiteral(gi.getAsProlog());
@@ -203,13 +206,25 @@
// add source annot
l.addAnnot(managerSource);
- // "role(notimplemented),group(notimplemented)"+
- // TODO: add annots: role, group (percorrer as missoes do ag que
- // em GI, procurar os papel com obrigacao para essa missao)
+ // try to find the role/group of this goal
+ // (the first all resp group of the scheme where I am)
+ for (GroupInstance g: gi.getScheme().getResponsibleGroups()) {
+ for (RolePlayer rp: g.getPlayers()) {
+ if (rp.getPlayer().equals(me)) {
+ Structure role = new Structure("role");
+ role.addTerm(new Atom(rp.getRole().getId()));
+ l.addAnnot(role);
+
+ Structure group = new Structure("group");
+ group.addTerm(new Atom(rp.getGroup().getId()));
+ l.addAnnot(group);
+ }
+ }
+ }
getTS().updateEvents(new Event(new Trigger(TEOperator.add, TEType.achieve, l), Intention.EmptyInt));
if (logger.isLoggable(Level.FINE)) logger.fine("New goal: " + l);
- }
- }
+ }
+ }
}
private static final Atom aAchievementGoal = new Atom(GoalType.achievement.toString());
Modified: trunk/applications/jason-team/src/asl/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-04-27 14:10:17 UTC (rev 1271)
@@ -119,9 +119,23 @@
/* -- plans for the goals of role scouter -- */
-+!follow_leader[scheme(Sch)]
- <- .print("ooo I should follow the leader!");
- // TODO:
++!follow_leader[scheme(Sch),group(Gr)]
+ : play(Leader, explorer, Gr)
+ <- .print("ooo I should follow the leader ",Leader);
+ ?pos(MyX,MyY,_);
+ ?ally_pos(Leader,LX,LY);
+ ?ag_perception_ratio(AGPR);
+ jia.dist(MyX, MyY, LX, LY, DistanceToLeader);
+
+ // If I am far from him, go to him
+ .if( DistanceToLeader > (AGPR * 2) -3, {
+ .print("ooo Approaching leader.");
+ -+target(LX,LY)
+ }, {
+ .print("ooo being in formation with leader.");
+ do(skip)
+ });
+
.wait("+pos(_,_,_)"); // wait next cycle
- !!follow_leader[scheme(Sch)].
+ !!follow_leader[scheme(Sch),group(Gr)].
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-27 14:10:17 UTC (rev 1271)
@@ -46,14 +46,15 @@
+end_of_simulation(_Result)
<- .abolish(group_area(_,_,_)).
-+!restart
- <- .print("*** restart ***");
++!restart.
+
+/* <- .print("*** restart ***").
//.drop_all_desires;
- .abolish(target(_,_)).
+ //.abolish(target(_,_)).
// TODO: what to do?
//!decide_target.
+*/
-
/* -- plans for the goals of all roles -- */
// get the list G of participants of the group where I play R
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-04-27 14:10:17 UTC (rev 1271)
@@ -14,9 +14,8 @@
+!define_formation[scheme(Sch)]
<- .print("ooo I should define the formation of my group!");
- ?my_group(G, herder);
- .length(G,NumP);
- jia.herd_position(NumP,L);
+ ?my_group_players(G, herder);
+ jia.herd_position(.length(G),L);
.print("ooo formation is ",L);
!alloc_all(G,L);
.wait("+pos(_,_,_)"); // wait next cycle
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-27 14:10:17 UTC (rev 1271)
@@ -102,7 +102,7 @@
}
public String shortActionFormat(String act) {
- if (act == null) return "";
+ if (act == null) return " ";
if (act.equals(WorldModel.Move.east.toString())) return "e ";
if (act.equals(WorldModel.Move.northeast.toString())) return "ne";
if (act.equals(WorldModel.Move.southeast.toString())) return "se";
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-27 13:25:39 UTC (rev 1270)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-27 14:10:17 UTC (rev 1271)
@@ -155,14 +155,14 @@
Vec agTarget = agsTarget;
//Location l = agTarget.add(mean).getLocation(model);
- System.out.println("....... "+dist+" antes angle "+agTarget);
+ //System.out.println("....... "+dist+" antes angle "+agTarget);
if (dist >= 0)
agTarget = agTarget.turn90CW();
else
agTarget = agTarget.turn90ACW();
Location l = findFirstFreeLocTowardsTarget(agTarget, mean.add(agsTarget), initAgTS, dist, model);
- System.out.println(" = "+dist+" result "+l);
+ //System.out.println(" = "+dist+" result "+l);
if (l != null)
r.add(pathToNearCow(model, l));
@@ -196,7 +196,7 @@
Location l = ref.getLocation(model);;
for (int s = initialSize; s <= maxSize; s++) {
l = target.newMagnitude(s).add(ref).getLocation(model);
- System.out.println("pos angle "+s+" = "+l);
+ //System.out.println("pos angle "+s+" = "+l);
if ( (!model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l)) && lastloc != null)
return lastloc;
lastloc = l;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-28 20:54:44
|
Revision: 1277
http://jason.svn.sourceforge.net/jason/?rev=1277&view=rev
Author: jomifred
Date: 2008-04-28 13:54:41 -0700 (Mon, 28 Apr 2008)
Log Message:
-----------
jason team: improve share_cows alg
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/OrgManager.java
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/massim-server/conf/serverconfig.xml
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/java/agent/SelectEvent.java
trunk/applications/jason-team/src/java/arch/ACArchitecture.java
trunk/applications/jason-team/src/java/arch/ACProxy.java
trunk/applications/jason-team/src/java/arch/CowboyArch.java
trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
trunk/applications/jason-team/src/java/jia/Vec.java
trunk/applications/jason-team/src/java/jia/herd_position.java
trunk/applications/jason-team/src/java/test/TestBasicHerding.java
Modified: trunk/applications/jason-moise/lib/moise.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jason-moise/src/jmoise/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -194,7 +194,7 @@
}
// notify others in the group about this new player
- updateMembersOE(gr.getAgents(), "play(" + sender + "," + roleId + "," + grId + ")", true, true);
+ updateMembersOE(gr.getAgentsInThisGroupAndSubGroups(), "play(" + sender + "," + roleId + "," + grId + ")", true, true);
// send players of this group to sender
for (RolePlayer rp : gr.getPlayers()) {
@@ -216,7 +216,7 @@
GroupInstance gr = currentOE.findGroup(grId);
// notify other players
- updateMembersOE(gr.getAgents(), "play(" + sender + "," + roleId + "," + grId + ")", false, false);
+ updateMembersOE(gr.getAgentsInThisGroupAndSubGroups(), "play(" + sender + "," + roleId + "," + grId + ")", false, false);
}
}
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-28 20:54:41 UTC (rev 1277)
@@ -1,3 +1,4 @@
+
/* Jason Team for the
* Multi-Agent Programming Contest 2008
* (http://cig.in.tu-clausthal.de/AgentContest)
Modified: trunk/applications/jason-team/massim-server/conf/serverconfig.xml
===================================================================
--- trunk/applications/jason-team/massim-server/conf/serverconfig.xml 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/massim-server/conf/serverconfig.xml 2008-04-28 20:54:41 UTC (rev 1277)
@@ -266,52 +266,52 @@
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent1" password="1" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent2" password="2" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent3" password="3" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent4" password="4" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent5" password="5" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="botagent6" password="6" team="bot" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant1" password="1" team="participant" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant2" password="2" team="participant" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant3" password="3" team="participant" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant4" password="4" team="participant" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant5" password="5" team="participant" />
<account actionclassmap="Grid"
defaultactionclass="massim.simulation.GridSimulationAgentAction"
- timeout="8000" auxtimeout="500" maxpacketlength="65536"
+ timeout="4000" auxtimeout="500" maxpacketlength="65536"
username="participant6" password="6" team="participant" />
</accounts>
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-28 20:54:41 UTC (rev 1277)
@@ -50,8 +50,12 @@
+pos(Step,_,_) // new cycle
: Step mod 6 == 0
<- !decide_target.
-
+
+// add all cows in BB (used by the arch)
++cell(X,Y,cow(_)) <- +cow(X,Y).
+-cell(X,Y,cow(_)) <- -cow(X,Y).
+
/* -- decide a new target -- */
+!decide_target
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-28 20:54:41 UTC (rev 1277)
@@ -94,16 +94,16 @@
+!share_seen_cows.
// simple implementation of share_cows (see TODO above)
-+cell(X,Y,cow(_))
++cell(X,Y,cow(_))[source(percept)]
: .my_name(Me) & play(Me,_,Gr)
<- C = cow(X,Y);
+C;
- jmoise.broadcast(Gr, tell, C).
--cell(X,Y,cow(_))
+ jmoise.broadcast(Gr, tell, C).
+-cell(X,Y,cow(_))[source(percept)]
: .my_name(Me) & play(Me,_,Gr)
<- C = cow(X,Y);
-C;
- jmoise.broadcast(Gr, untell, C).
+ jmoise.broadcast(Gr, untell, C).
Modified: trunk/applications/jason-team/src/java/agent/SelectEvent.java
===================================================================
--- trunk/applications/jason-team/src/java/agent/SelectEvent.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/agent/SelectEvent.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -10,14 +10,13 @@
import java.util.Queue;
/**
- * change the default select event function to prefer cell(_,_,gold) events.
+ * change the default select event function to prefer cell(_,_,cow(_)) events.
*
* @author Jomi
*/
public class SelectEvent extends Agent {
- private Trigger gold = Trigger.parseTrigger("+cell(_,_,gold)");
- private Trigger restart = Trigger.parseTrigger("+restart");
+ private Trigger cow = Trigger.parseTrigger("+cell(_,_,cow(_))");
private Unifier un = new Unifier();
public Event selectEvent(Queue<Event> events) {
@@ -25,14 +24,11 @@
while (ie.hasNext()) {
un.clear();
Event e = ie.next();
- if (un.unifies(gold, e.getTrigger()) || un.unifies(restart, e.getTrigger())) {
- //getTS().getLogger().info("custom select event "+e);
+ if (un.unifies(cow, e.getTrigger())) {
ie.remove();
return e;
}
}
return super.selectEvent(events);
}
-
-
}
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -131,7 +131,7 @@
}
*/
- class WaitSleep extends Thread {
+ class WaitSleep extends Thread {
ActionExec lastAction;
String lastActionInCurrentCycle;
@@ -141,6 +141,7 @@
long timestartcycle = 0;
int cycleCounter = 0;
+
WaitSleep() {
super("WaitSpeepToSendAction");
}
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -188,8 +188,8 @@
int cowId = Integer.parseInt(type.getAttribute("ID"));
Structure lc = new Literal("cow");
lc.addTerm(new NumberTermImpl( cowId ));
- percepts.add(CowboyArch.createCellPerception(cellx, celly, lc));
- arq.cowPerceived(absx, absy);
+ percepts.add(CowboyArch.createCellPerception(absx, absy, lc));
+ //arq.cowPerceived(absx, absy);
} else if (type.getNodeName().equals("obstacle")) {
arq.obstaclePerceived(absx, absy, CowboyArch.createCellPerception(absx, absy, CowboyArch.aOBSTACLE));
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -14,8 +14,6 @@
import jason.mas2j.ClassParameters;
import jason.runtime.Settings;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -31,7 +29,7 @@
*/
public class CowboyArch extends IdentifyCrashed {
- LocalWorldModel model = new LocalWorldModel(10,10);
+ LocalWorldModel model = null;
WorldView view = null;
String simId = null;
@@ -57,6 +55,8 @@
@Override
public void initAg(String agClass, ClassParameters bbPars, String asSrc, Settings stts) throws JasonException {
super.initAg(agClass, bbPars, asSrc, stts);
+
+ model = new LocalWorldModel(10,10, WorldModel.agsByTeam, getTS().getAg().getBB()); // just to have a default model
gui = "yes".equals(stts.getUserParameter("gui"));
if ("yes".equals(stts.getUserParameter("write_status"))) {
writeStatusThread = WriteStatusThread.create(this);
@@ -68,7 +68,6 @@
if (massimBackDir != null && massimBackDir.startsWith("\""))
massimBackDir = massimBackDir.substring(1,massimBackDir.length()-1);
logger = Logger.getLogger(CowboyArch.class.getName() + ".CA-" + getAgName());
-
}
@Override
@@ -110,7 +109,7 @@
/** The perception of the grid size is removed from the percepts list
and "directly" added as a belief */
void gsizePerceived(int w, int h, String opponent) throws RevisionFailedException {
- model = new LocalWorldModel(w, h);
+ model = new LocalWorldModel(w, h, WorldModel.agsByTeam, getTS().getAg().getBB());
getTS().getAg().addBel(Literal.parseLiteral("gsize("+w+","+h+")"));
playing = true;
@@ -242,9 +241,10 @@
return l;
}
- private static final Literal cowstoclean = Literal.parseLiteral("cell(_,_,cow(_))");
- private boolean cleanCows = false;
+ //private static final Literal cowstoclean = Literal.parseLiteral("cell(_,_,cow(_))");
+ //private boolean cleanCows = false;
+ /*
@Override
public synchronized void agDidPerceive() {
super.agDidPerceive();
@@ -255,15 +255,18 @@
cleanCows = false;
}
}
+ */
void initKnownCows() {
model.clearCows();
- cleanCows = true;
+ //cleanCows = true;
}
- void cowPerceived(int x, int y) {
- model.addCow(x,y);
- }
+ //void cowPerceived(int x, int y) {
+ // model.addCow(x,y);
+ //}
+
+ /*
void sendCowsToTeam() {
try {
Message m = new Message("tell-cows", null, null, new ArrayList<Location>(model.getCows()));
@@ -272,6 +275,7 @@
e.printStackTrace();
}
}
+ */
void enemyPerceived(int x, int y) {
model.add(WorldModel.ENEMY, x, y);
@@ -327,11 +331,13 @@
Message m = im.next();
if (m.getIlForce().equals("tell-cows")) {
im.remove();
+ /* not used anymore
if (model != null) {
for (Location l: (Collection<Location>)m.getPropCont()) {
cowPerceived(l.x, l.y);
}
}
+ */
} else {
String ms = m.getPropCont().toString();
if (ms.startsWith("cell") && ms.endsWith("obstacle)") && model != null) {
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -1,14 +1,18 @@
package arch;
+import jason.asSyntax.Literal;
+import jason.asSyntax.NumberTerm;
+import jason.bb.BeliefBase;
import jason.environment.grid.Location;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.Set;
+import jia.Vec;
import env.WorldModel;
@@ -24,24 +28,28 @@
private Random random = new Random();
- Set<Location> cows = new HashSet<Location>();
+ Set<Vec> cows = new HashSet<Vec>();
+ boolean isCowsUptodate = false;
int[][] cowsrep; // cows repulsion
int[][] agsrep; // agents repulsion
int[][] obsrep; // obstacle repulsion
+ BeliefBase bb; // agent's BB
+
//private Logger logger = Logger.getLogger("jasonTeamSimLocal.mas2j." + LocalWorldModel.class.getName());
- public static LocalWorldModel create(int w, int h, int nbAg) {
- return new LocalWorldModel(w,h,nbAg);
- }
+ //public static LocalWorldModel create(int w, int h, int nbAg) {
+ // return new LocalWorldModel(w,h,nbAg);
+ //}
- public LocalWorldModel(int w, int h) {
- this(w, h, 6);
- }
+ //public LocalWorldModel(int w, int h) {
+ // this(w, h, 6);
+ //}
- public LocalWorldModel(int w, int h, int nbAg) {
+ public LocalWorldModel(int w, int h, int nbAg, BeliefBase bb) {
super(w, h, nbAg);
+ this.bb = bb;
visited = new int[getWidth()][getHeight()];
for (int i = 0; i < getWidth(); i++)
@@ -81,40 +89,52 @@
}
}
-
+ // cows methods
+
public void clearCows() {
- removeAll(WorldModel.COW);
+ isCowsUptodate = false;
+ }
+
+ public Set<Vec> getCows() {
+ if (!isCowsUptodate)
+ updateCowsFromBB();
+ return cows;
+ }
- for (int i = 0; i < getWidth(); i++)
+ private static final Literal cowLiteral = Literal.parseLiteral("cow(_,_)");
+
+ private void updateCowsFromBB() {
+ if (bb == null) return;
+
+ // clean
+ removeAll(WorldModel.COW);
+
+ for (int i = 0; i < getWidth(); i++)
for (int j = 0; j < getHeight(); j++)
- cowsrep[i][j] = 0;
-
+ cowsrep[i][j] = 0;
+
cows.clear();
+
+ // rebuild
+ Iterator<Literal> i = bb.getCandidateBeliefs(cowLiteral, null);
+ if (i != null) {
+ while (i.hasNext()) {
+ Literal c = i.next();
+ int x = (int)((NumberTerm)c.getTerm(0)).solve();
+ int y = (int)((NumberTerm)c.getTerm(1)).solve();
+ addCow(x,y);
+ }
+ }
+ isCowsUptodate = true;
}
public void addCow(int x, int y) {
add(WorldModel.COW, x, y);
- cows.add(new Location(x,y));
-
+ cows.add(new Vec( this, x, y));
increp(cowsrep, x, y, 2, 1);
}
- private void increp(int[][] m, int x, int y, int maxr, int value) {
- for (int r = 1; r <= maxr; r++)
- for (int c = x-r; c <= x+r; c++)
- for (int l = y-r; l <= y+r; l++)
- if (inGrid(c,l))
- m[c][l] += value;
- }
-
- public void addCow(Location l) {
- addCow(l.x, l.y);
- }
-
- public Collection<Location> getCows() {
- return cows;
- }
-
+
public int getCowsRep(int x, int y) {
return cowsrep[x][y];
}
@@ -125,6 +145,14 @@
return obsrep[x][y];
}
+ private void increp(int[][] m, int x, int y, int maxr, int value) {
+ for (int r = 1; r <= maxr; r++)
+ for (int c = x-r; c <= x+r; c++)
+ for (int l = y-r; l <= y+r; l++)
+ if (inGrid(c,l))
+ m[c][l] += value;
+ }
+
public Location nearFree(Location l) throws Exception {
int w = 0;
List<Location> options = new ArrayList<Location>();
Modified: trunk/applications/jason-team/src/java/jia/Vec.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/Vec.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/jia/Vec.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -3,6 +3,7 @@
import jason.environment.grid.Location;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import arch.LocalWorldModel;
@@ -31,6 +32,14 @@
this.t = Math.atan2(y,x);
}
+ /** create a vector based on a location in the model */
+ public Vec(LocalWorldModel model, int x, int y) {
+ this.x = x;
+ this.y = model.getHeight()-y-1;
+ this.r = Math.sqrt(x*x + this.y*this.y);
+ this.t = Math.atan2(this.y,x);
+ }
+
public int getX() { return (int)Math.round(x); }
public int getY() { return (int)Math.round(y); }
public double magnitude() { return r; }
@@ -91,6 +100,10 @@
return ((int)(temp/(Math.PI/2))%4);
}
+ @Override
+ public int hashCode() {
+ return (int)((x + y) * 37);
+ }
@Override
public boolean equals(Object o) {
@@ -123,7 +136,7 @@
// Useful static methods for list of vecs
//
- public static Vec max(List<Vec> vs) {
+ public static Vec max(Collection<Vec> vs) {
Vec max = null;
for (Vec v: vs) {
if (max == null || max.r < v.r)
@@ -132,7 +145,7 @@
return max;
}
- public static List<Vec> sub(List<Vec> vs, Vec ref) {
+ public static List<Vec> sub(Collection<Vec> vs, Vec ref) {
List<Vec> r = new ArrayList<Vec>(vs.size());
for (Vec v: vs) {
r.add(v.sub(ref));
@@ -157,7 +170,7 @@
}
*/
- public static Vec mean(List<Vec> vs) {
+ public static Vec mean(Collection<Vec> vs) {
if (vs.isEmpty())
return new Vec(0,0);
double x = 0, y = 0;
@@ -168,7 +181,7 @@
return new Vec(x/vs.size(), y/vs.size());
}
- public static Vec stddev(List<Vec> vs, Vec mean) {
+ public static Vec stddev(Collection<Vec> vs, Vec mean) {
if (vs.isEmpty())
return new Vec(0,0);
double x = 0, y = 0;
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -12,6 +12,7 @@
import jason.environment.grid.Location;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
@@ -50,6 +51,7 @@
};
LocalWorldModel model;
+ List<Location> lastCluster = null;
public void setModel(LocalWorldModel model) {
this.model = model;
@@ -84,7 +86,7 @@
return un.unifies(args[1], new NumberTermImpl(agTarget.x)) &&
un.unifies(args[2], new NumberTermImpl(agTarget.y));
} else {
- ts.getLogger().info("No target! I am at "+agLoc+" places are "+formationPlaces(formation));
+ ts.getLogger().info("No target! I am at "+agLoc+" places are "+formationPlaces(formation)+" cluster is "+lastCluster);
}
} else {
// return all the locations for the formation
@@ -139,20 +141,18 @@
}
private List<Location> formationPlaces(Formation formation) throws Exception {
- List<Vec> cows = new ArrayList<Vec>();
- for (Location c: model.getCows()) {
- cows.add(new Vec(model, c));
- }
- if (cows.isEmpty())
- return null;
-
//cows = Vec.cluster(cows, 2); // find center/clusterise
- cows = cluster(cows, WorldModel.cowPerceptionRatio);
+ List<Vec>cows = cluster(model.getCows(), WorldModel.cowPerceptionRatio);
+
List<Location> clusterLocs = new ArrayList<Location>();
for (Vec v: cows) {
clusterLocs.add(v.getLocation(model));
}
+ lastCluster = clusterLocs;
+
+ if (cows.isEmpty())
+ return null;
Vec mean = Vec.mean(cows);
int stepsFromCenter = (int)Math.round(Vec.max(cows).sub(mean).magnitude())+1;
@@ -240,7 +240,7 @@
return t;
}
- public static List<Vec> cluster(List<Vec> cows, int maxDist) {
+ public static List<Vec> cluster(Collection<Vec> cows, int maxDist) {
/*
Vs = set of all seen cows (sorted by distance to the centre of cluster)
Cs = { the cow near to the center of Vs }
Modified: trunk/applications/jason-team/src/java/test/TestBasicHerding.java
===================================================================
--- trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-04-28 17:38:52 UTC (rev 1276)
+++ trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-04-28 20:54:41 UTC (rev 1277)
@@ -22,13 +22,12 @@
public class TestBasicHerding {
- Vec[] cows;
Vec cowboy;
LocalWorldModel model;
@Before
public void scenario() {
- model = new LocalWorldModel(50,50);
+ model = new LocalWorldModel(50,50, WorldModel.agPerceptionRatio, null);
model.setCorral(new Location(0,49), new Location(2,49));
model.wall(7, 44, 7, 49);
}
@@ -37,38 +36,51 @@
cowboy = new Vec(3,5);
model.add(WorldModel.AGENT, cowboy.getLocation(model));
- cows = new Vec[5];
- cows[0] = new Vec(6,7);
- cows[1] = new Vec(5,30);
- cows[2] = new Vec(4,8);
- cows[3] = new Vec(5,10);
- cows[4] = new Vec(0,1);
-
- for (int i=0; i<cows.length; i++)
- model.addCow(cows[i].getLocation(model));
-
+ addToModel(
+ new Vec(6,7),
+ new Vec(5,30),
+ new Vec(4,8),
+ new Vec(5,10),
+ new Vec(0,1));
}
public void scenario2() {
cowboy = new Vec(11,3);
model.add(WorldModel.AGENT, cowboy.getLocation(model));
- cows = new Vec[9];
- cows[0] = new Vec(8,0);
- cows[1] = new Vec(9,0);
- cows[2] = new Vec(10,0);
- cows[3] = new Vec(8,1);
- cows[4] = new Vec(9,1);
- cows[5] = new Vec(10,1);
- cows[6] = new Vec(8,2);
- cows[7] = new Vec(9,2);
- cows[8] = new Vec(10,2);
+ addToModel(
+ new Vec(8,0),
+ new Vec(9,0),
+ new Vec(10,0),
+ new Vec(8,1),
+ new Vec(9,1),
+ new Vec(10,1),
+ new Vec(8,2),
+ new Vec(9,2),
+ new Vec(10,2));
+ }
- for (int i=0; i<cows.length; i++)
- model.addCow(cows[i].getLocation(model));
+ @Test
+ public void bigCluster() {
+ // big cluster
+ for (int x = 10; x < 30; x++) {
+ for (int y = 5; y < 20; y++) {
+ addToModel(new Vec(model,x,y));
+ }
+ }
+ List<Vec> cowsl = herd_position.cluster(model.getCows(), WorldModel.cowPerceptionRatio);
+ assertEquals(model.getCows().size(), cowsl.size());
}
+
+ private void addToModel(Vec... cows) {
+ for (int i=0; i<cows.length; i++) {
+ Location l = cows[i].getLocation(model);
+ model.addCow(l.x, l.y);
+ }
+ }
+
@Test
public void testVec() {
scenario1();
@@ -85,10 +97,7 @@
public void testVecSort() {
scenario1();
- List<Vec> cowsl = new ArrayList<Vec>();
- for (int i=0; i<cows.length; i++) {
- cowsl.add(cows[i]);
- }
+ List<Vec> cowsl = new ArrayList<Vec>(model.getCows());
Collections.sort(cowsl);
assertEquals(new Vec(0,1), cowsl.get(0));
assertEquals(new Vec(4,8), cowsl.get(1));
@@ -146,13 +155,8 @@
public void moveCows2() throws Exception {
scenario1();
- List<Vec> cowsl = new ArrayList<Vec>();
- for (int i=0; i<cows.length; i++) {
- cowsl.add(cows[i]);
- }
-
// find center/clusterise
- cowsl = herd_position.cluster(cowsl, WorldModel.cowPerceptionRatio);
+ List<Vec> cowsl = herd_position.cluster(model.getCows(), WorldModel.cowPerceptionRatio);
//Vec stddev = Vec.stddev(cowsl, Vec.mean(cowsl));
assertEquals(3, cowsl.size());
@@ -205,12 +209,7 @@
scenario2();
model.add(WorldModel.ENEMY, 11,48);
- List<Vec> cowsl = new ArrayList<Vec>();
- for (int i=0; i<cows.length; i++) {
- cowsl.add(cows[i]);
- }
-
- cowsl = herd_position.cluster(cowsl, WorldModel.cowPerceptionRatio);
+ List<Vec> cowsl = herd_position.cluster(model.getCows(), WorldModel.cowPerceptionRatio);
assertEquals(9, cowsl.size());
herd_position hp = new herd_position();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-30 17:21:34
|
Revision: 1281
http://jason.svn.sourceforge.net/jason/?rev=1281&view=rev
Author: jomifred
Date: 2008-04-30 10:21:29 -0700 (Wed, 30 Apr 2008)
Log Message:
-----------
jason team: several changes!
Modified Paths:
--------------
trunk/applications/as-unit-test/src/jason/tests/TestLoop.java
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-moise/src/jmoise/OrgManager.java
trunk/applications/jason-moise/src/jmoise/broadcast.java
trunk/applications/jason-team/AC-Local-Dummies.mas2j
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/dummies.xml
trunk/applications/jason-team/gauchos.xml
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/java/arch/ACArchitecture.java
trunk/applications/jason-team/src/java/arch/ACProxy.java
trunk/applications/jason-team/src/java/arch/CowboyArch.java
trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
Added Paths:
-----------
trunk/applications/jason-team/src/java/test/MindView.java
Modified: trunk/applications/as-unit-test/src/jason/tests/TestLoop.java
===================================================================
--- trunk/applications/as-unit-test/src/jason/tests/TestLoop.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/as-unit-test/src/jason/tests/TestLoop.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -17,21 +17,40 @@
// defines the agent's AgentSpeak code
ag.parseAScode(
"b(1). "+
+ "p(1,a). p(2,a). p(3,b). p(4,b). p(6,a). "+
"+!test1 <- .while( .count(b(_),N) & N < 4, {+b(N+1) })."+
- "+!test2 <- L=4; .while( .count(b(_)) < L, { ?b(X); +b(X+1) }); jason.asunit.print(end)."
+ "+!test2 <- L=4; .while( .count(b(_)) < L, { ?b(X); +b(X+1) }); jason.asunit.print(end). "+
+
+ "+!test3 <- L=4; .for( p(N,a) & N < L, { jason.asunit.print(N) }); jason.asunit.print(end). "+
+
+ "+!test4 <- .for( .member(N, [1,3,4]), { jason.asunit.print(N) }); jason.asunit.print(end). "
);
}
@Test
- public void test1() {
+ public void testWhile1() {
ag.addGoal("test1");
ag.assertBel("b(4)", 20);
}
@Test
- public void test2() {
+ public void testWhile2() {
ag.addGoal("test2");
ag.assertBel("b(4)", 30);
}
+
+ @Test
+ public void testFor1() {
+ ag.addGoal("test3");
+ ag.assertPrint("2", 10);
+ ag.assertPrint("end", 10);
+ }
+
+ @Test
+ public void testFor2() {
+ ag.addGoal("test4");
+ ag.assertPrint("4", 10);
+ ag.assertPrint("end", 10);
+ }
}
Modified: trunk/applications/jason-moise/lib/moise.jar
===================================================================
(Binary files differ)
Modified: trunk/applications/jason-moise/src/jmoise/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -194,10 +194,10 @@
}
// notify others in the group about this new player
- updateMembersOE(gr.getAgentsInThisGroupAndSubGroups(), "play(" + sender + "," + roleId + "," + grId + ")", true, true);
+ updateMembersOE(gr.getAgents(true), "play(" + sender + "," + roleId + "," + grId + ")", true, true);
// send players of this group to sender
- for (RolePlayer rp : gr.getPlayers()) {
+ for (RolePlayer rp : gr.getPlayers(null, true)) {
if (!rp.getPlayer().getId().equals(sender)) {
updateMembersOE(sender, "play(" + rp.getPlayer().getId() + "," + rp.getRole().getId() + "," + grId + ")", false, true);
}
@@ -216,7 +216,7 @@
GroupInstance gr = currentOE.findGroup(grId);
// notify other players
- updateMembersOE(gr.getAgentsInThisGroupAndSubGroups(), "play(" + sender + "," + roleId + "," + grId + ")", false, false);
+ updateMembersOE(gr.getAgents(true), "play(" + sender + "," + roleId + "," + grId + ")", false, false);
}
}
Modified: trunk/applications/jason-moise/src/jmoise/broadcast.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/broadcast.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-moise/src/jmoise/broadcast.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -58,7 +58,7 @@
// try group
GroupInstance gi = oag.getOE().findGroup(target.toString());
if (gi != null) {
- for (OEAgent ag: gi.getAgents()) {
+ for (OEAgent ag: gi.getAgents(true)) {
if (!ag.getId().equals(oag.getAgName())) {
oag.sendMsg(new Message(ilf.toString(), null, ag.getId(), pcnt));
}
Modified: trunk/applications/jason-team/AC-Local-Dummies.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-04-30 17:21:29 UTC (rev 1281)
@@ -15,32 +15,32 @@
host="localhost", port=12300, username=botagent1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
dummy2 dummy.asl
[verbose=1,host="localhost", port=12300, username=botagent2, password="2"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
dummy3 dummy.asl
[verbose=1,host="localhost", port=12300, username=botagent3, password="3"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
dummy4 dummy.asl
[verbose=1,host="localhost", port=12300, username=botagent4, password="4"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
dummy5 dummy.asl
[verbose=1,host="localhost", port=12300, username=botagent5, password="5"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
dummy6 dummy.asl
[verbose=1,host="localhost", port=12300, username=botagent6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
aslSourcePath: "src/asl";
}
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-30 17:21:29 UTC (rev 1281)
@@ -19,32 +19,32 @@
host="localhost", port=12300, username=participant1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
gaucho2 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant2, password="2"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
gaucho3 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant3, password="3"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
gaucho4 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant4, password="4"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
gaucho5 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant5, password="5"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
gaucho6 gaucho.asl
[verbose=1,host="localhost", port=12300, username=participant6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
aslSourcePath: "src/asl";
Modified: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/dummies.xml 2008-04-30 17:21:29 UTC (rev 1281)
@@ -27,9 +27,9 @@
<!-- tasks the user can override in his/her c-build.xml script -->
<target name="user-init">
+ <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
<copy file="../jason-moise/lib/jmoise.jar" todir="lib" />
<copy file="../jason-moise/lib/moise.jar" todir="lib" />
- <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
</target>
<target name="user-end">
</target>
Modified: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/gauchos.xml 2008-04-30 17:21:29 UTC (rev 1281)
@@ -27,9 +27,14 @@
<!-- tasks the user can override in his/her c-build.xml script -->
<target name="user-init">
+ <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
<copy file="../jason-moise/lib/jmoise.jar" todir="lib" />
<copy file="../jason-moise/lib/moise.jar" todir="lib" />
- <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
+
+ <mkdir dir="tmp-ag-mind" />
+ <!--delete failonerror="no" includeEmptyDirs="true" verbose="false">
+ <fileset dir="tmp-ag-mind" includes="*.xml"/>
+ </delete-->
</target>
<target name="user-end">
</target>
@@ -98,6 +103,13 @@
<antcall target="user-end" />
</target>
+ <target name="mind-view" depends="compile" >
+ <java classname="test.MindView" failonerror="true" fork="yes" dir="${basedir}" >
+ <classpath refid="project.classpath"/>
+ <arg line="0"/>
+ </java>
+ </target>
+
<target name="clean" >
<delete failonerror="no" includeEmptyDirs="true" verbose="true">
<fileset dir="${basedir}" includes="**/*.class"/>
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-30 17:21:29 UTC (rev 1281)
@@ -7,11 +7,11 @@
steps(MaxSteps)
corral(UpperLeft.x,UpperLeft.y,DownRight.x,DownRight.y)
- Step:
+ Each step:
pos(X,Y,Step)
- cell(X,Y,Type)
- Type in { cow(Id), ally(Name), enemy(Id) }
- // the Id of enemy is not working
+ cow(Id,X,Y)
+ apply_pos(Name,X,Y)
+
End:
end_of_simulation(Result)
@@ -52,10 +52,6 @@
<- !decide_target.
-// add all cows in BB (used by the arch)
-+cell(X,Y,cow(_)) <- +cow(X,Y).
--cell(X,Y,cow(_)) <- -cow(X,Y).
-
/* -- decide a new target -- */
+!decide_target
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-30 17:21:29 UTC (rev 1281)
@@ -5,11 +5,10 @@
steps(MaxSteps)
corral(UpperLeft.x,UpperLeft.y,DownRight.x,DownRight.y)
- Step:
+ Each step:
pos(X,Y,Step)
- cell(X,Y,Type)
- Type in { cow(Id), ally(Name), enemy(Id) }
- // the Id of enemy is not working
+ cow(Id,X,Y)
+ apply_pos(Name,X,Y)
End:
end_of_simulation(Result)
@@ -94,16 +93,12 @@
+!share_seen_cows.
// simple implementation of share_cows (see TODO above)
-+cell(X,Y,cow(_))[source(percept)]
++cow(Id,X,Y)[source(percept)]
: .my_name(Me) & play(Me,_,Gr)
- <- C = cow(X,Y);
- +C;
- jmoise.broadcast(Gr, tell, C).
--cell(X,Y,cow(_))[source(percept)]
+ <- jmoise.broadcast(Gr, tell, cow(Id,X,Y)).
+-cow(Id,X,Y)[source(percept)]
: .my_name(Me) & play(Me,_,Gr)
- <- C = cow(X,Y);
- -C;
- jmoise.broadcast(Gr, untell, C).
+ <- jmoise.broadcast(Gr, untell, cow(Id,X,Y)).
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -139,6 +139,7 @@
Lock lock = new ReentrantLock();
Condition cycle = lock.newCondition();
long timestartcycle = 0;
+ long timeLastAction = 0;
int cycleCounter = 0;
@@ -183,13 +184,13 @@
w = "*** ";
}
- long timetoact = 0;
- if (timestartcycle > 0) {
- timetoact = System.currentTimeMillis() - timestartcycle;
+ String timetoact = ". ";
+ if (lastActionInCurrentCycle != null && timestartcycle > 0) {
+ timetoact = " (act in "+ (timeLastAction - timestartcycle) +" ms)";
}
timestartcycle = System.currentTimeMillis();
- logger.info(w+"Last sent action was "+lastActionInCurrentCycle+" for cycle "+getCycle()+ " (act in "+timetoact+" ms). "+notsent);
+ logger.info(w+"Last sent action was "+lastActionInCurrentCycle+" for cycle "+getCycle()+ timetoact + notsent);
setLastAct(lastActionInCurrentCycle);
lastActionInCurrentCycle = null;
}
@@ -213,7 +214,7 @@
}
@Override
- synchronized public void run() {
+ public void run() {
while (true) {
try {
lastAction = null;
@@ -222,6 +223,7 @@
lastActionInCurrentCycle = lastAction.getActionTerm().getTerm(0).toString();
proxy.sendAction(lastActionInCurrentCycle);
toExecute.offer(lastAction);
+ timeLastAction = System.currentTimeMillis();
}
} catch (InterruptedException e) {
return; // condition to stop the thread
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -2,7 +2,6 @@
import jason.asSyntax.Literal;
import jason.asSyntax.NumberTermImpl;
-import jason.asSyntax.Structure;
import jason.environment.grid.Location;
import java.util.ArrayList;
@@ -157,7 +156,8 @@
arq.initKnownCows();
- int enemyId = 1;
+ //int enemyId = 1;
+
// add in perception what is around
NodeList nl = perception.getElementsByTagName("cell");
for (int i=0; i < nl.getLength(); i++) {
@@ -178,17 +178,17 @@
// allies are managed by communication
//percepts.add(CowboyArch.createCellPerception(cellx, celly, CowboyArch.aALLY));
} else if (type.getAttribute("type").equals("enemy")) {
- Structure le = new Literal("enemy");
- le.addTerm(new NumberTermImpl( (enemyId++) )); // we need an id to work with UniqueBB
- percepts.add(CowboyArch.createCellPerception(cellx, celly, le));
+ //Structure le = new Literal("enemy");
+ //le.addTerm(new NumberTermImpl( (enemyId++) )); // we need an id to work with UniqueBB
+ //percepts.add(CowboyArch.createCellPerception(cellx, celly, le));
arq.enemyPerceived(absx, absy);
}
} else if (type.getNodeName().equals("cow")) {
int cowId = Integer.parseInt(type.getAttribute("ID"));
- Structure lc = new Literal("cow");
- lc.addTerm(new NumberTermImpl( cowId ));
- percepts.add(CowboyArch.createCellPerception(absx, absy, lc));
+ Literal lc = new Literal("cow");
+ lc.addTerms(new NumberTermImpl( cowId ), new NumberTermImpl( absx), new NumberTermImpl(absy));
+ percepts.add( lc); //CowboyArch.createCellPerception(absx, absy, lc));
//arq.cowPerceived(absx, absy);
} else if (type.getNodeName().equals("obstacle")) {
@@ -208,7 +208,7 @@
arq.startNextStep(step, percepts);
//if (logger.isLoggable(Level.FINE))
- logger.info("Request action for "+lpos+" / percepts: "+percepts);
+ logger.info("Request action for "+lpos+" / rid: "+rid+" / percepts: "+percepts);
} catch (Exception e) {
logger.log(Level.SEVERE, "error processing request",e);
}
@@ -216,7 +216,7 @@
public void sendAction(String action) {
try {
- logger.info("sending action "+action+" for step "+rid+" at "+arq.model.getAgPos(arq.getMyId()) );
+ logger.info("sending action "+action+" for rid "+rid+" at "+arq.model.getAgPos(arq.getMyId()) );
Document doc = documentbuilder.newDocument();
Element el_response = doc.createElement("message");
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -225,7 +225,7 @@
protected void addRestart() {
try {
logger.info("** Arch adding restart for "+getAgName());
- getTS().getC().create();
+ //getTS().getC().create();
getTS().getC().addAchvGoal(new Literal("restart"), Intention.EmptyInt);
lo2 = new Location(-1,-1); // to not restart again in the next cycle
} catch (Exception e) {
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -93,7 +93,7 @@
return cows;
}
- private static final Literal cowLiteral = Literal.parseLiteral("cow(_,_)");
+ private static final Literal cowLiteral = Literal.parseLiteral("cow(Id,X,Y)");
private void updateCowsFromBB() {
if (bb == null) return;
@@ -112,8 +112,8 @@
if (i != null) {
while (i.hasNext()) {
Literal c = i.next();
- int x = (int)((NumberTerm)c.getTerm(0)).solve();
- int y = (int)((NumberTerm)c.getTerm(1)).solve();
+ int x = (int)((NumberTerm)c.getTerm(1)).solve();
+ int y = (int)((NumberTerm)c.getTerm(2)).solve();
addCow(x,y);
}
}
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-30 15:33:32 UTC (rev 1280)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -1,7 +1,10 @@
package arch;
import jason.environment.grid.Location;
+import jason.util.asl2xml;
+import java.io.File;
+import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Iterator;
@@ -54,6 +57,14 @@
reset();
String fileName = "world-status.txt";
+ File dirmind = null;
+ try {
+ dirmind = new File("tmp-ag-mind");
+ dirmind.mkdir();
+ } catch (Exception e) {
+ dirmind = null;
+ }
+
PrintWriter out = null;
try {
out = new PrintWriter(fileName);
@@ -85,6 +96,15 @@
}
}
}
+
+ // store the agent'd mind
+ if (dirmind != null) {
+ String agmind = new asl2xml().transform(owner.getTS().getAg().getAgState());
+ FileWriter outmind = new FileWriter(new File(dirmind.getName()+"/"+owner.getCycle()+".xml"));
+ outmind.write(agmind);
+ outmind.close();
+ }
+
logger.info(s.toString());
out.println(s.toString());
out.flush();
Added: trunk/applications/jason-team/src/java/test/MindView.java
===================================================================
--- trunk/applications/jason-team/src/java/test/MindView.java (rev 0)
+++ trunk/applications/jason-team/src/java/test/MindView.java 2008-04-30 17:21:29 UTC (rev 1281)
@@ -0,0 +1,136 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2003 Rafael H. Bordini, Jomi F. Hubner, et al.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://www.dur.ac.uk/r.bordini
+// http://www.inf.furb.br/~jomi
+//
+//----------------------------------------------------------------------------
+
+package test;
+
+import jason.util.asl2html;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextPane;
+import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+
+public class MindView {
+
+ public static void main(String[] args) throws Exception {
+ new MindView(Integer.parseInt(args[0]));
+ }
+
+ private int step = 1;
+ private asl2html agTransformerHtml = new asl2html("/xml/agInspection.xsl");
+ private DocumentBuilder builder;
+
+
+ public MindView(int step) throws ParserConfigurationException {
+ this.step = step;
+ builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ initComponents();
+ show();
+ }
+
+ // Interface components
+ JTextPane jTA = null;
+ JFrame frame;
+
+ void initComponents() {
+ frame = new JFrame();
+
+ JButton jBtNext = new JButton("Next");
+ jBtNext.setEnabled(true);
+ jBtNext.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ step++;
+ show();
+ }
+ });
+ }
+ });
+ JButton jBtPrev = new JButton("Previous");
+ jBtPrev.setEnabled(true);
+ jBtPrev.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ step--;
+ show();
+ }
+ });
+ }
+ });
+
+ jTA = new JTextPane();
+ jTA.setEditable(false);
+ jTA.setContentType("text/html");
+ jTA.setAutoscrolls(false);
+
+ JPanel spTA = new JPanel(new BorderLayout());
+ spTA.add(BorderLayout.CENTER, new JScrollPane(jTA));
+ spTA.setBorder(BorderFactory.createTitledBorder(BorderFactory
+ .createEtchedBorder(), "Agent Inspection", TitledBorder.LEFT, TitledBorder.TOP));
+
+ JPanel pAg = new JPanel(new BorderLayout());
+ pAg.add(BorderLayout.CENTER, spTA);
+
+
+ JPanel pButtons = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ pButtons.add(jBtPrev);
+ pButtons.add(jBtNext);
+
+ frame.getContentPane().add(BorderLayout.SOUTH, pButtons);
+ frame.getContentPane().add(BorderLayout.CENTER, pAg);
+ frame.pack();
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ int height = (int)(screenSize.height * 0.618);
+ frame.setBounds(80, 30, (int)(height*1.2), height);
+
+ frame.setVisible(true);
+ }
+
+ private void show() {
+ try {
+ frame.setTitle(":: Jason Mind Inspector :: "+step+" ::");
+ Document agState = builder.parse("tmp-ag-mind/"+step+".xml");
+ jTA.setText(agTransformerHtml.transform(agState));
+ } catch (Exception et) {
+ et.printStackTrace();
+ }
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-05-08 15:50:58
|
Revision: 1297
http://jason.svn.sourceforge.net/jason/?rev=1297&view=rev
Author: jomifred
Date: 2008-05-08 08:50:39 -0700 (Thu, 08 May 2008)
Log Message:
-----------
jason team: improve merging of teams and formation
Modified Paths:
--------------
trunk/applications/jason-moise/src/jmoise/OrgAgent.java
trunk/applications/jason-moise/src/jmoise/OrgManager.java
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/asl/herding.asl
trunk/applications/jason-team/src/java/arch/ACProxy.java
trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
trunk/applications/jason-team/src/java/jia/herd_position.java
trunk/applications/jason-team/src/java/jia/scouter_pos.java
trunk/applications/jason-team/src/java/test/TestBasicHerding.java
trunk/applications/jason-team/src/team-os.xml
Modified: trunk/applications/jason-moise/src/jmoise/OrgAgent.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-moise/src/jmoise/OrgAgent.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -189,7 +189,7 @@
// fail the IA
PlanBody pbody = pi.peek().getPlan().getBody();
pbody.add(0, new PlanBodyImpl(BodyType.internalAction, new InternalActionLiteral(".fail")));
- getTS().getLogger().warning("Error in organisational action: "+content);
+ getTS().getLogger().warning("Error in organisational action '"+body+"': "+content);
} else {
// try to unify the return value
//System.out.println("answer is "+content+" or "+DefaultTerm.parse(content)+" with body "+body);
Modified: trunk/applications/jason-moise/src/jmoise/OrgManager.java
===================================================================
--- trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-moise/src/jmoise/OrgManager.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -289,18 +289,18 @@
mpi = sender.getMissions().iterator();
String evUnCom = "commitment(" + sender + "," + mp.getMission().getId() + "," + sch.getId() + ")";
updateMembersOE(sch.getPlayers(), evUnCom, false, false);
- if (!sch.isPlayer(sender)) {
+ //if (!sch.isPlayer(sender)) {
updateMembersOE(sender, evUnCom, false, false);
- }
+ //}
}
} else {
sch = currentOE.findScheme(schId);
sender.removeMission(misId, schId);
String evUnCom = "commitment(" + sender + "," + misId + "," + sch.getId() + ")";
updateMembersOE(sender, evUnCom, false, false);
- if (!sch.isPlayer(sender)) {
+ //if (!sch.isPlayer(sender)) {
updateMembersOE(sch.getPlayers(), evUnCom, false, false);
- }
+ //}
}
updateMembersOE(sender, (String) null, true, true);
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-08 15:50:39 UTC (rev 1297)
@@ -29,14 +29,6 @@
/* -- initial goals -- */
-/* Testing alloc
-alloc_target(a1,pos(10,10)).
-alloc_target(a2,pos(20,20)).
-alloc_target(a3,pos(30,30)).
-!test.
-+!test <- !alloc_all([a1,a2,a3],[pos(31,31),pos(21,21),pos(11,11)]).
-*/
-
/* -- plans -- */
+?pos(X, Y, S) <- .wait("+pos(X,Y,S)").
@@ -50,10 +42,10 @@
.drop_all_desires;
!remove_org.
-+!restart
- <- //.print("*** restart ***");
++!restart.
+ //<- //.print("*** restart ***");
//.drop_all_desires;
- .abolish(cow(_,_,_)).
+ //.abolish(cow(_,_,_)).
// TODO: what to do?
//!decide_target.
@@ -85,12 +77,6 @@
}.
+!remove_org.
-// finish the scheme if it has no more players
-// and it was created by me
-+sch_players(Sch,0)
- : .my_name(Me) & scheme(_, Sch)[owner(Me)]
- <- jmoise.remove_scheme(Sch).
-
// get the list G of participants of the group where I play R
+?my_group_players(G,R)
@@ -108,6 +94,7 @@
// give up all missions
.while( commitment(Me,M,Sch) ) {
+ .print("ooo removing my mission ",M," in ",Sch);
jmoise.remove_mission(M,Sch)
};
@@ -125,16 +112,20 @@
jmoise.adopt_role(NewRole,GT).
-//+!change_role(NewRole,GT)[source(S)]
-// <- .print("ooo I cannot adopt the role ",NewRole," in group ",GT,", as asked by ",S).
-
+!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);
jmoise.adopt_role(Role, Group).
+
+// finish the scheme if it has no more players
+// and it was created by me
++sch_players(Sch,0)
+ : .my_name(Me) & scheme(_, Sch)[owner(Me)]
+ <- jmoise.remove_scheme(Sch).
+
// when I have an obligation or permission to a mission, commit to it
+obligation(Sch, Mission)
<- jmoise.commit_mission(Mission,Sch).
@@ -143,8 +134,10 @@
// 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).
-permission(Sch, Mission)
+ : .my_name(Me) & commitment(Me,Mission,Sch)
<- jmoise.remove_mission(Mission,Sch).
// when I am not committed to a mission anymore, remove all goals based on that mission
@@ -156,10 +149,7 @@
-scheme(_Spec,Id)
<- .drop_desire(_[scheme(Id)]).
-+error(M)[source(orgManager)]
- <- .print("Error in organisational action: ",M); -error(M)[source(orgManager)].
-
/* -- includes -- */
{ include("goto.asl") } // include plans for moving around
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-08 15:50:39 UTC (rev 1297)
@@ -12,6 +12,7 @@
<- !create_herding_gr.
+!create_herding_gr
+ : not .intend(create_herding_gr)
<- .print("ooo Creating herding group.");
.my_name(Me);
@@ -66,7 +67,7 @@
play(Me, herder, Gi) &
current_cluster(MyC)
<- // for all other groups
- .for( group_leader(Gj, L) & L \== Me & Me < L) {
+ .for( group_leader(Gj, L) & L \== Me & Me < L & not play(L,herdboy,Gi)) {
.print("ooo Checking merging with ",Gj);
// ask their cluster
.send(L, askOne, current_cluster(_), current_cluster(TC));
@@ -76,7 +77,8 @@
.print("ooo Merging my herding group ",Gi," with ",Gj, " lead by ",L);
.send(L, achieve, change_role(herdboy,Gi))
}
- }.
+ };
+ .wait(2000). // give some time for them to adopt the roles before check merging again
+!check_merge.
@@ -85,15 +87,37 @@
+!define_formation[scheme(Sch),mission(Mission)]
<- .print("ooo I should define the formation of my group!");
?my_group_players(G, herder);
- jia.cluster(Cluster,CAsList);
- -+current_cluster(CAsList);
- jia.herd_position(.length(G),Cluster,L);
+ 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).
+ !alloc_all(G,L).
{ end }
-+!alloc_all([],_).
+// version "near agent of each position
++!alloc_all([],[]).
++!alloc_all([],L) <- .print("ooo there is no agent for the formation ",L).
++!alloc_all(G,[]) <- .print("ooo there is no place in the formation for ",G).
++!alloc_all(Agents,[pos(X,Y)|TLoc])
+ <- !find_closest(Agents,pos(X,Y),HA);
+ .print("ooo Allocating position ",pos(X,Y)," to agent ",HA);
+ .send(HA,tell,target(X,Y));
+ .delete(HA,Agents,TAg);
+ !alloc_all(TAg,TLoc).
+
++!find_closest(Agents, pos(FX,FY), NearAg) // find the agent near to pos(X,Y)
+ <- .my_name(Me);
+ .findall(d(D,Ag),
+ .member(Ag,Agents) & (ally_pos(Ag,AgX,AgY) | Ag == Me & pos(AgX,AgY,_)) & jia.path_length(FX,FY,AgX,AgY,D),
+ Distances);
+ //.print("Distances for ",pos(FX,FY)," are ",Distances);
+ .min(Distances,d(_,NearAg)).
+
+/*
+// version "near place of the agent"
++!alloc_all([],[]).
++!alloc_all(G,[]) <- .print("ooo there is no place in the formation for ",G).
+!alloc_all([HA|TA],LA)
<- !find_closest(HA,LA,pos(X,Y),NLA);
.print("ooo Alocating position ",pos(X,Y)," to agent ",HA);
@@ -111,10 +135,10 @@
.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))
:- jia.path_length(Fx,Fy,AgX,AgY,D) & calc_distances(TP, TD, pos(AgX,AgY)).
+*/
/*
+!closest([],S,S,_,_).
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -172,7 +172,6 @@
if (cnl.item(j).getNodeType() == Element.ELEMENT_NODE && cellx != 0 && celly != 0) {
Element type = (Element)cnl.item(j);
-
if (type.getNodeName().equals("agent")) {
if (type.getAttribute("type").equals("ally")) {
// allies are managed by communication
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -124,7 +124,7 @@
public void addCow(int x, int y) {
add(WorldModel.COW, x, y);
cows.add(new Vec( this, x, y));
- increp(cowsrep, x, y, 2, 1);
+ increp(cowsrep, x, y, 3, 1);
}
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -41,13 +41,13 @@
public static final int agDistanceInFormation = 4;
public enum Formation {
- one { int[] getDistances() { return new int[] { 0 }; } },
- two { int[] getDistances() { return new int[] { sd, -sd }; } },
- three { int[] getDistances() { return new int[] { 0, d, -d }; } },
- four { int[] getDistances() { return new int[] { sd, -sd, d+sd, -(d+sd) }; } },
- five { int[] getDistances() { return new int[] { 0, d, -d, d*2, -d*2 }; } },
- six { int[] getDistances() { return new int[] { sd, -sd, d+sd, -(d+sd), d*2+sd, -(d*2+sd) }; } };
- abstract int[] getDistances();
+ one { Vec[] getDistances() { return new Vec[] { new Vec(0,0) }; } },
+ two { Vec[] getDistances() { return new Vec[] { new Vec(sd,0), new Vec(-sd, 0) }; } },
+ three { Vec[] getDistances() { return new Vec[] { new Vec(0,0), new Vec(d, -1), new Vec(-d, -1) }; } },
+ four { Vec[] getDistances() { return new Vec[] { new Vec(sd,0), new Vec(-sd, 0), new Vec(d+sd, -2), new Vec(-(d+sd), -2) }; } },
+ five { Vec[] getDistances() { return new Vec[] { new Vec(0,0), new Vec(d, -1), new Vec(-d, -1), new Vec(d*2,-3), new Vec(-d*2,-3) }; } },
+ six { Vec[] getDistances() { return new Vec[] { new Vec(sd,0), new Vec(-sd, 0), new Vec(d+sd, -2), new Vec(-(d+sd), -2), new Vec(d*2+sd, -4), new Vec(-(d*2+sd), -4) }; } };
+ abstract Vec[] getDistances();
private static final int d = agDistanceInFormation;
private static final int sd = agDistanceInFormation/2;
};
@@ -165,66 +165,54 @@
int n = Math.min(stepsFromCenter, np.size());
Vec cowstarget = new Vec(model, s.getNodeLocation(np.get(n)));
- Vec agsTarget = mean.sub(cowstarget);
+
+ // find cow farthest of corral
+ Vec farcow = null;
+ for (Vec c: cows)
+ if (farcow == null || farcow.getLocation(model).maxBorder(model.getCorralCenter()) < c.getLocation(model).maxBorder(model.getCorralCenter()))
+ farcow = c;
+
+
+ Vec agsTarget = mean.sub(cowstarget).newMagnitude(farcow.sub(mean).magnitude()+1);
+ //System.out.println("Ags target = "+agsTarget+" mean = "+mean + " far cow is "+farcow);
List<Location> r = new ArrayList<Location>();
- int initAgTS = 1;
- for (int dist: formation.getDistances()) { // 2, -2, 6, -6, ....
- Vec agTarget = agsTarget;
- //Location l = agTarget.add(mean).getLocation(model);
-
- //System.out.println("....... "+dist+" antes angle "+agTarget);
- if (dist >= 0)
- agTarget = agTarget.turn90CW();
- else
- agTarget = agTarget.turn90ACW();
-
- Location l = findFirstFreeLocTowardsTarget(agTarget, mean.add(agsTarget), initAgTS, dist, model);
+ for (Vec position: formation.getDistances()) { // 2, -2, 6, -6, ....
+ //System.out.println("....... "+position+" + "+agsTarget+" = " + agTarget);
+ Location l = findFirstFreeLocTowardsTarget(agsTarget, position, mean, model);
//System.out.println(" = "+dist+" result "+l);
- if (l != null) {
- l = pathToNearCow(l, clusterLocs);
- if ( !model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l) || r.contains(l))
- l = model.nearFree(l, r);
- r.add( l );
+ if (l == null) {
+ l = model.nearFree(agsTarget.add(mean).getLocation(model), r);
+ } else {
+ //l = pathToNearCow(l, clusterLocs);
+ if ( !model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l) || r.contains(l))
+ l = model.nearFree(l, r);
}
-
- /*
- Location lastloc = null;
- boolean uselast = false;
- for (int agTargetSize = initAgTS; agTargetSize <= Math.abs(dist); agTargetSize++) {
- l = agTarget.newMagnitude(agTargetSize).add(mean).add(agsTarget).getLocation(model);
- //System.out.println("pos angle "+agTargetSize);
- uselast = (!model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l)) && lastloc != null;
- if (uselast) {
- r.add(pathToNearCow(model, lastloc));
- break;
- }
- lastloc = l;
- }
- if (!uselast)
- r.add(pathToNearCow(model, l));
- */
-
- if (dist < 0)
- initAgTS = Math.abs(dist)+1;
+ r.add( l );
}
//System.out.println("all places "+r);
return r;
}
- public static Location findFirstFreeLocTowardsTarget(Vec target, Vec ref, int initialSize, int maxSize, LocalWorldModel model) {
+ public static Location findFirstFreeLocTowardsTarget(Vec start, Vec direction, Vec ref, LocalWorldModel model) {
+ Vec startandref = start.add(ref);
+ Vec t = start.turn90CW();
+ t = t.newAngle(t.angle()+direction.angle());
+
+ //System.out.println(start + " to "+ direction + " = " + end);
+ Location l = start.add(ref).getLocation(model);
Location lastloc = null;
- maxSize = Math.abs(maxSize);
- Location l = ref.getLocation(model);
- for (int s = initialSize; s <= maxSize; s++) {
- l = target.newMagnitude(s).add(ref).getLocation(model);
- //System.out.println("pos angle "+s+" = "+l);
- if ( (!model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l)) && lastloc != null)
+ int maxSize = (int)direction.magnitude();
+ for (int s = 1; s <= maxSize; s++) {
+ l = t.newMagnitude(s).add(startandref).getLocation(model);
+ //System.out.println(" test "+s+" = "+l+" -- ");
+ if ( (!model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l) || model.hasObject(WorldModel.CORRAL, l)) && lastloc != null)
return lastloc;
lastloc = l;
}
- return l; //ref.getLocation(model); //target.add(ref).getLocation(model);
+ return l;
}
+ /*
private Location pathToNearCow(Location t, List<Location> cluster) {
Location near = null;
for (Location c: cluster) {
@@ -243,6 +231,7 @@
}
return t;
}
+ */
/*
public Location nearFreeForAg(LocalWorldModel model, Location ag, Location t) throws Exception {
Modified: trunk/applications/jason-team/src/java/jia/scouter_pos.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/scouter_pos.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/java/jia/scouter_pos.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -56,8 +56,8 @@
public Location getScouterTarget(LocalWorldModel model, Location leaderPos, Location leaderTarget) throws Exception {
Vec leader = new Vec(model, leaderPos);
Vec target = new Vec(model, leaderTarget).sub(leader);
- target = target.turn90CW();
- return herd_position.findFirstFreeLocTowardsTarget(target, leader, 1, WorldModel.agPerceptionRatio*2-3, model);
+ Vec me = new Vec(WorldModel.agPerceptionRatio*2-3,0);
+ return herd_position.findFirstFreeLocTowardsTarget(target, me, leader, model);
}
}
Modified: trunk/applications/jason-team/src/java/test/TestBasicHerding.java
===================================================================
--- trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-05-08 15:50:39 UTC (rev 1297)
@@ -1,6 +1,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import jason.environment.grid.Location;
import java.util.ArrayList;
@@ -110,10 +111,10 @@
@Test
public void testCowsRepMat() throws Exception {
scenario1();
- assertEquals(2, model.getCowsRep(5,38));
- assertEquals(1, model.getCowsRep(5,37));
- assertEquals(0, model.getCowsRep(5,36));
- assertEquals(5, model.getCowsRep(5,40));
+ assertEquals(4, model.getCowsRep(5,38));
+ assertEquals(2, model.getCowsRep(5,37));
+ assertEquals(1, model.getCowsRep(5,36));
+ assertEquals(8, model.getCowsRep(5,40));
}
@Test
@@ -149,7 +150,7 @@
scenario1();
Search s = new Search(model, cowboy.getLocation(model), new Location(8,37), null, true, true, true, false, null);
Nodo path = s.search();
- assertEquals(13, s.normalPath(path).size());
+ assertEquals(15, s.normalPath(path).size());
}
@Test
@@ -176,10 +177,15 @@
Location byIA = hp.getAgTarget(clusterLocs, Formation.one, cowboy.getLocation(model));
assertEquals(new Location(6,38), byIA);
+
+ assertEquals("[6,38, 9,41, 3,37, 11,45, 0,37]", hp.formationPlaces(clusterLocs, Formation.five).toString());
byIA = hp.getAgTarget(clusterLocs, Formation.six, cowboy.getLocation(model));
- assertEquals(new Location(6,39), byIA);
-
+ assertEquals(new Location(8,39), byIA);
+
+ assertEquals("[8,39, 5,37, 10,43, 1,37, 12,46, 0,37]", hp.formationPlaces(clusterLocs, Formation.six).toString());
+
+ /*
// add an agent in 6,39
model.add(WorldModel.AGENT, 6,39);
byIA = hp.getAgTarget(clusterLocs, Formation.six, cowboy.getLocation(model));
@@ -203,7 +209,8 @@
// add an agent in 5,37
//model.add(WorldModel.AGENT, 5,37);
//byIA = new herd_position().getAgTarget(model, Formation.six,cowboy.getLocation(model));
- //assertEquals(new Location(5,37), byIA);
+ //assertEquals(new Location(5,37), byIA);
+ */
}
@Test
@@ -222,20 +229,20 @@
assertEquals(new Location(11,49), byIA);
List<Location> form = hp.formationPlaces(clusterLocs, Formation.four);
- assertEquals("[6,48, 11,49, 6,49, 12,48]", form.toString());
+ assertTrue(form.contains(new Location(11,49)));
+ assertTrue(form.contains(new Location(6,49)));
+ assertTrue(form.contains(new Location(6,48)));
+ assertTrue(form.contains(new Location(15,48)));
}
@Test
public void scouterPos() throws Exception {
scenario1();
- Location byIA = new scouter_pos().getScouterTarget(model, new Location(2,46), new Location(6,42));
- assertEquals(new Location(5,49), byIA);
+ Location byIA = new scouter_pos().getScouterTarget(model, new Location(2,46), new Location(5,44));
+ assertEquals(new Location(6,46), byIA);
- byIA = new scouter_pos().getScouterTarget(model, new Location(2,46), new Location(3,42));
- assertEquals(new Location(6,47), byIA);
-
byIA = new scouter_pos().getScouterTarget(model, new Location(9,46), new Location(9,42));
- assertEquals(new Location(22,46), byIA);
+ assertEquals(new Location(22,42), byIA);
}
/*
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-05-07 21:24:45 UTC (rev 1296)
+++ trunk/applications/jason-team/src/team-os.xml 2008-05-08 15:50:39 UTC (rev 1297)
@@ -38,7 +38,7 @@
<sub-groups>
- <group-specification id="exploration_grp" min="3" max="3" >
+ <group-specification id="exploration_grp" min="0" max="3" >
<roles>
<role id="explorer" min="1" max="1"/>
<role id="scouter" min="0" max="1"/>
@@ -48,7 +48,7 @@
<group-specification id="herding_grp" min="0" max="6" >
<roles>
<role id="herder" min="1" max="1"/>
- <role id="herdboy" min="0" max="3"/>
+ <role id="herdboy" min="0" max="5"/>
</roles>
</group-specification>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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 plat...
[truncated message content] |
|
From: <jom...@us...> - 2008-05-24 15:15:45
|
Revision: 1301
http://jason.svn.sourceforge.net/jason/?rev=1301&view=rev
Author: jomifred
Date: 2008-05-24 08:15:42 -0700 (Sat, 24 May 2008)
Log Message:
-----------
jason team: dump the mind of all agents
Modified Paths:
--------------
trunk/applications/jason-moise/lib/moise.jar
trunk/applications/jason-team/gauchos.xml
trunk/applications/jason-team/src/asl/exploration.asl
trunk/applications/jason-team/src/asl/gaucho.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-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-05-24 13:26:51 UTC (rev 1300)
+++ trunk/applications/jason-team/gauchos.xml 2008-05-24 15:15:42 UTC (rev 1301)
@@ -93,7 +93,7 @@
<target name="run" depends="compile" >
<delete failonerror="no" includeEmptyDirs="true" verbose="false">
- <fileset dir="mind-ag-gaucho1" includes="*.xml"/>
+ <fileset dir="mind-ag" includes="**/*.xml"/>
</delete>
<echo message="Running project ${ant.project.name}" />
Modified: trunk/applications/jason-team/src/asl/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl 2008-05-24 13:26:51 UTC (rev 1300)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-05-24 15:15:42 UTC (rev 1301)
@@ -23,9 +23,7 @@
agent_id(Me,AgId) &
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
+ <- // create the team, if necessary
if( Me == gaucho1 & not group(team,_) ) {
jmoise.create_group(team)
};
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-24 13:26:51 UTC (rev 1300)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-24 15:15:42 UTC (rev 1301)
@@ -52,14 +52,14 @@
/* -- plans for the goals of all roles -- */
-+!share_seen_cows[scheme(Sch)] <- .print("ooo start sharing cows in scheme ",Sch); .suspend.
+//+!share_seen_cows[scheme(Sch)] <- .print("ooo start sharing cows in scheme ",Sch); .suspend.
// simple implementation of share_cows (see TODO above)
+cow(Id,X,Y)[source(percept)]
- : .intend(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
+ : .my_name(Me) & play(Me,_,Gr) // .intend(share_seen_cows)
<- jmoise.broadcast(Gr, tell, cow(Id,X,Y)).
-cow(Id,X,Y)[source(percept)]
- : .intend(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
+ : .my_name(Me) & play(Me,_,Gr) // .intend(share_seen_cows)
<- jmoise.broadcast(Gr, untell, cow(Id,X,Y)).
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-05-24 13:26:51 UTC (rev 1300)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-05-24 15:15:42 UTC (rev 1301)
@@ -57,16 +57,11 @@
reset();
String fileName = "world-status.txt";
- File dirmind = null;
- try {
- dirmind = new File("mind-ag-"+owner.getAgName());
- dirmind.mkdir();
- } catch (Exception e) {
- dirmind = null;
- }
PrintWriter out = null;
try {
+ asl2xml transformer = new asl2xml();
+
out = new PrintWriter(fileName);
PrintWriter map = new PrintWriter("map-status.txt");
while (true) {
@@ -111,19 +106,26 @@
out.flush();
- // store the agent'd mind
- if (dirmind != null) {
- String agmind = new asl2xml().transform(owner.getTS().getAg().getAgState());
- String filename = String.format("%5d.xml",owner.getCycle()).replaceAll(" ","0");
- FileWriter outmind = new FileWriter(new File(dirmind.getName()+"/"+filename));
- outmind.write(agmind);
- outmind.close();
+ // store the agents' mind
+ for (CowboyArch arch : agents) {
+ try {
+ File dirmind = new File("mind-ag/"+arch.getAgName());
+ if (!dirmind.exists())
+ dirmind.mkdirs();
+ String agmind = transformer.transform(arch.getTS().getAg().getAgState());
+ String filename = String.format("%5d.xml",arch.getCycle()).replaceAll(" ","0");
+ FileWriter outmind = new FileWriter(new File(dirmind+"/"+filename));
+ outmind.write(agmind);
+ outmind.close();
+ } catch (Exception e) {
+ System.out.println("error getting agent status "+e);
+ }
}
} catch (InterruptedException e) { // no problem, quit the thread
return;
} catch (Exception e) {
- System.out.println("error getting agent status "+e);
+ System.out.println("error in writing status "+e);
sleep(1000);
}
}
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-05-24 13:26:51 UTC (rev 1300)
+++ trunk/applications/jason-team/src/team-os.xml 2008-05-24 15:15:42 UTC (rev 1301)
@@ -92,12 +92,12 @@
<mission id="explore" min="1">
<goal id="find_scouter" />
<goal id="goto_near_unvisited" />
- <goal id="share_seen_cows" />
+ <!--goal id="share_seen_cows" /-->
<goal id="change_to_herding" />
</mission>
<mission id="scout" >
<goal id="follow_leader" />
- <goal id="share_seen_cows" />
+ <!--goal id="share_seen_cows" /-->
</mission>
</scheme>
@@ -116,12 +116,12 @@
<goal id="recruit" />
<goal id="define_formation" />
<goal id="be_in_formation" />
- <goal id="share_seen_cows" />
+ <!--goal id="share_seen_cows" /-->
<goal id="change_to_exploring" />
</mission>
<mission id="help_herder" >
<goal id="be_in_formation" />
- <goal id="share_seen_cows" />
+ <!--goal id="share_seen_cows" /-->
</mission>
</scheme>
</functional-specification>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <tom...@us...> - 2008-06-09 19:58:46
|
Revision: 1330
http://jason.svn.sourceforge.net/jason/?rev=1330&view=rev
Author: tomklapiscak
Date: 2008-06-09 12:58:41 -0700 (Mon, 09 Jun 2008)
Log Message:
-----------
Fixed bug caused by use of URI specific to my file system structure.
Modified Paths:
--------------
trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceModel.java
trunk/applications/owl2mas/src/owl2mas/model/Model.java
Modified: trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceModel.java
===================================================================
--- trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceModel.java 2008-06-09 19:31:35 UTC (rev 1329)
+++ trunk/applications/jasdl-owlapi/examples/commerce/src/java/commerce/model/CommerceModel.java 2008-06-09 19:58:41 UTC (rev 1330)
@@ -5,6 +5,7 @@
import java.awt.Dimension;
import java.awt.Point;
+import java.net.URI;
import java.util.HashSet;
import java.util.Set;
@@ -22,7 +23,7 @@
private CommerceView view;
public CommerceModel(Environment env, Dimension gridSize) throws OWL2MASInvalidMASOntologyException {
- super(env);
+ super(env, "soc", URI.create("file:onts/society.owl"));
this.gridSize = gridSize;
initCatalogues();
}
Modified: trunk/applications/owl2mas/src/owl2mas/model/Model.java
===================================================================
--- trunk/applications/owl2mas/src/owl2mas/model/Model.java 2008-06-09 19:31:35 UTC (rev 1329)
+++ trunk/applications/owl2mas/src/owl2mas/model/Model.java 2008-06-09 19:58:41 UTC (rev 1330)
@@ -28,7 +28,7 @@
*/
private List<ObjectModel> removeQueue;
- public Model(Environment env) throws OWL2MASInvalidMASOntologyException{
+ public Model(Environment env, String socName, URI o_uri) throws OWL2MASInvalidMASOntologyException{
objects = new HashSet<ObjectModel>();
addQueue = new Vector<ObjectModel>();
removeQueue = new Vector<ObjectModel>();
@@ -36,21 +36,12 @@
ModelLoader loader = new ModelLoader(this, env);
objects.addAll(
loader.load(
- "soc",
- URI.create("file:///home/tom/workspace/jason/applications/jasdl-owlapi/examples/commerce/onts/society.owl")));
+ socName,
+ o_uri));
}
- public static void main(String[] args){
- try {
- Model model = new Model(new Environment());
- } catch (OWL2MASInvalidMASOntologyException e) {
- throw new RuntimeException(e);
- }
-
- }
-
public ObjectModel getObjectById(Atom id){
for(ObjectModel o : getObjects()){
if(o.getId().equals(id)){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|