|
From: <jom...@us...> - 2008-03-16 16:29:59
|
Revision: 1153
http://jason.svn.sourceforge.net/jason/?rev=1153&view=rev
Author: jomifred
Date: 2008-03-16 09:29:57 -0700 (Sun, 16 Mar 2008)
Log Message:
-----------
update jason team run script
Modified Paths:
--------------
trunk/applications/jason-team/run.sh
trunk/applications/jason-team/src/java/arch/ACAgent.java
trunk/applications/jason-team/src/java/arch/ACProxy.java
Modified: trunk/applications/jason-team/run.sh
===================================================================
--- trunk/applications/jason-team/run.sh 2008-03-16 14:29:35 UTC (rev 1152)
+++ trunk/applications/jason-team/run.sh 2008-03-16 16:29:57 UTC (rev 1153)
@@ -1,5 +1,5 @@
#!/bin/sh
-java -cp lib/jason.jar:lib/search.jar:. \
+java -cp ../../lib/jason.jar:lib/search.jar:bin/classes \
jason.infra.centralised.RunCentralisedMAS \
- Local-JasonTeam.mas2j
+ AC-Local-JasonTeam.mas2j
Modified: trunk/applications/jason-team/src/java/arch/ACAgent.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACAgent.java 2008-03-16 14:29:35 UTC (rev 1152)
+++ trunk/applications/jason-team/src/java/arch/ACAgent.java 2008-03-16 16:29:57 UTC (rev 1153)
@@ -7,6 +7,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
+import java.net.SocketException;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -100,14 +101,8 @@
auth.setAttribute("password",password);
root.appendChild(auth);
this.sendDocument(doc);
- //transformerfactory.newTransformer().transform(new DOMSource(doc),new StreamResult(outputstream));
- //outputstream.write(0);
} catch (ParserConfigurationException e) {
logger.log(Level.SEVERE, "unable to create new document for authentication.", e);
- //} catch (TransformerConfigurationException e) {
- // logger.log(Level.SEVERE,"unable to configure transformer", e);
- //} catch (TransformerException e) {
- // logger.log(Level.SEVERE,"unable to transform document", e);
}
}
@@ -116,7 +111,8 @@
Document doc = receiveDocument();
Element root = doc.getDocumentElement();
if (root==null) return false;
- if (!root.getAttribute("type").equalsIgnoreCase("auth-response")) return false;
+ if (!root.getAttribute("type").equalsIgnoreCase("auth-response"))
+ return false;
NodeList nl = root.getChildNodes();
Element authresult = null;
@@ -127,19 +123,12 @@
break;
}
}
- if (!authresult.getAttribute("result").equalsIgnoreCase("ok")) return false;
- } catch (SAXException e) {
+ if (authresult.getAttribute("result").equalsIgnoreCase("ok"))
+ return true;
+ } catch (Exception e) {
e.printStackTrace();
- return false;
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- return false;
- } catch (SocketClosedException e) {
- e.printStackTrace();
- return false;
}
-
- return true;
+ return false;
}
public boolean doAuthentication(String username, String password) throws IOException {
@@ -160,9 +149,19 @@
return buffer.toByteArray();
}
- public Document receiveDocument() throws SAXException, IOException, ParserConfigurationException, SocketClosedException {
- byte[] raw = receivePacket();
- Document doc = documentbuilderfactory.newDocumentBuilder().parse(new ByteArrayInputStream(raw));
+ public Document receiveDocument() throws SAXException { // , IOException, ParserConfigurationException, SocketClosedException {
+ try {
+ byte[] raw = receivePacket();
+ Document doc = documentbuilderfactory.newDocumentBuilder().parse(new ByteArrayInputStream(raw));
+ return doc;
+ } catch (SocketClosedException e) {
+ logger.log(Level.SEVERE, "Socket was closed:"+e);
+ connected = false;
+ } catch (SocketException e) {
+ logger.log(Level.SEVERE, "Socket exception:"+e);
+ } catch (Exception e) {
+ logger.log(Level.SEVERE, "ACAgent receiveDocument exception", e);
+ }
/*
try {
if (logger.isLoggable(Level.FINE)) {
@@ -172,7 +171,7 @@
}
} catch (Exception e) {}
*/
- return doc;
+ return null;
}
protected boolean connect() {
@@ -190,7 +189,7 @@
logger.log(Level.SEVERE, "authentication failed");
}
} catch (Exception e) {
- logger.log(Level.SEVERE, "Exception", e);
+ logger.log(Level.SEVERE, "Connection exception "+e);
}
return connected;
}
@@ -199,15 +198,6 @@
return connected;
}
- /*
- protected void reconnect() throws Exception {
- if (socket != null) {
- socket.close();
- }
- connect();
- }
- */
-
public boolean processMessage(Element el_message) {
String type = el_message.getAttribute("type");
if (type.equals("request-action") || type.equals("sim-start") || type.equals("sim-end")) {
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-03-16 14:29:35 UTC (rev 1152)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-03-16 16:29:57 UTC (rev 1153)
@@ -5,6 +5,7 @@
import jason.asSyntax.Structure;
import jason.environment.grid.Location;
+import java.net.SocketException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -68,29 +69,26 @@
try {
if (isConnected()) {
Document doc = receiveDocument();
- Element el_root = doc.getDocumentElement();
-
- if (el_root != null) {
- if (el_root.getNodeName().equals("message")) {
- processMessage(el_root);
+ if (doc != null) {
+ Element el_root = doc.getDocumentElement();
+
+ if (el_root != null) {
+ if (el_root.getNodeName().equals("message")) {
+ processMessage(el_root);
+ } else {
+ logger.log(Level.SEVERE,"unknown document received");
+ }
} else {
- logger.log(Level.SEVERE,"unknown document received");
+ logger.log(Level.SEVERE, "no document element found");
}
- } else {
- logger.log(Level.SEVERE, "no document element found");
}
} else {
// wait auto-reconnect
logger.info("waiting reconnection...");
try { Thread.sleep(2000); } catch (InterruptedException e1) {}
}
- /*} catch (SocketClosedException e) {
- logger.log(Level.SEVERE, "Socket was closed:"+e);
- connected = false;
- } catch (SocketException e) {
- logger.log(Level.SEVERE, "Socket exception:"+e); */
} catch (Exception e) {
- logger.log(Level.SEVERE, "Exception", e);
+ logger.log(Level.SEVERE, "ACProxy run exception", e);
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-03-17 08:41:46
|
Revision: 1156
http://jason.svn.sourceforge.net/jason/?rev=1156&view=rev
Author: jomifred
Date: 2008-03-17 01:41:44 -0700 (Mon, 17 Mar 2008)
Log Message:
-----------
add massim-server and massim-agents in SVN
instructions to run the team in readme.txt
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/readme.txt
Added Paths:
-----------
trunk/applications/jason-team/massim-agents/
trunk/applications/jason-team/massim-agents/LICENSE
trunk/applications/jason-team/massim-agents/README
trunk/applications/jason-team/massim-agents/demoAgent.jar
trunk/applications/jason-team/massim-agents/startAgents.sh
trunk/applications/jason-team/massim-server/
trunk/applications/jason-team/massim-server/LICENSE
trunk/applications/jason-team/massim-server/README
trunk/applications/jason-team/massim-server/conf/
trunk/applications/jason-team/massim-server/conf/serverconfig.xml
trunk/applications/jason-team/massim-server/conf/visualconfig.xml
trunk/applications/jason-team/massim-server/lib/
trunk/applications/jason-team/massim-server/lib/batik-css.jar
trunk/applications/jason-team/massim-server/lib/batik-dom.jar
trunk/applications/jason-team/massim-server/lib/batik-ext.jar
trunk/applications/jason-team/massim-server/lib/batik-svg-dom.jar
trunk/applications/jason-team/massim-server/lib/batik-util.jar
trunk/applications/jason-team/massim-server/lib/batik-xml.jar
trunk/applications/jason-team/massim-server/lib/massimserver.jar
trunk/applications/jason-team/massim-server/lib/serializer.jar
trunk/applications/jason-team/massim-server/lib/xalan.jar
trunk/applications/jason-team/massim-server/massim/
trunk/applications/jason-team/massim-server/massim/rmi/
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServer.class
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver$SimulationStateServerImplementation.class
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver.class
trunk/applications/jason-team/massim-server/massim/rmi/StringMapServer.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver$XMLDocumentServerImplementation.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentServer.class
trunk/applications/jason-team/massim-server/output/
trunk/applications/jason-team/massim-server/startServer.sh
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-03-16 17:44:47 UTC (rev 1155)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-03-17 08:41:44 UTC (rev 1156)
@@ -11,7 +11,7 @@
agents:
dummy1 dummy.asl
- [verbose=1, gui=no, write_model=no, ac_sim_back_dir="/Users/jomi/bin/massim-server/backup",
+ [verbose=1, gui=no, write_model=no, ac_sim_back_dir="./massim-server/backup",
host="localhost", port=12300, username=participant1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
Added: trunk/applications/jason-team/massim-agents/LICENSE
===================================================================
--- trunk/applications/jason-team/massim-agents/LICENSE (rev 0)
+++ trunk/applications/jason-team/massim-agents/LICENSE 2008-03-17 08:41:44 UTC (rev 1156)
@@ -0,0 +1,353 @@
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package massim-agents #
+# LICENSE file for tha massim-agents pakage #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
\ No newline at end of file
Added: trunk/applications/jason-team/massim-agents/README
===================================================================
--- trunk/applications/jason-team/massim-agents/README (rev 0)
+++ trunk/applications/jason-team/massim-agents/README 2008-03-17 08:41:44 UTC (rev 1156)
@@ -0,0 +1,61 @@
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package MASSim server #
+# README file for the MASSim server package #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+1. Prerequisites.
+
+You only need the sun-java5 / sun-java6 (jre and jdk) installed to run the server.
+
+2. Installing and running.
+
+·Unpack the file anywhere:
+ tar xzvf massim-Server-version.tag.gz -C output_dir
+
+·Switch to the new directory:
+ cd output_dir/massim-Server
+
+·Run the script provided in the package:
+ ./startServer
+
+3. Options.
+
+You can edit the startServer script for changing the ip where the rmi registry
+ will be run (variable name), or the location of configuration file:
+
+4. Configuration files
+4.1 Server configuration
+
+The serverconfig.xml file is located inside the conf directory. There you can
+specify all the parameters refered to the simulation: from the number of agents
+to the map style.
+
+The first relevant element is the configuration one. It contains attributes like
+the grid's size, number of elements (agents, gold items, obstacles) inside the
+grid and some probability parameters.
+
+If no more is specified a random map will be created using the parameters provided.
+
+There is also the capability of creating your map, placing all the elements in their
+position.
+
+The easiest way is read the second simulation config from the serverconfig.xml fіle
+and understand the array elements.
+
+4.2 Visualization configuration
+The visualconfig.xml file is also located inside the conf directory. There you can
+specify parameters refered to the visualization (or svg output files). It allows you
+change the colors and sizes of the elements.
+
+5. Questions, problems, suggestions, ...
+
+please, ask to the Agent Contest 2008 mail-list agentcontest2008-general [at] in.tu-clausthal.de
+and for more fast communication: jens.dehnert [at] tu-clausthal.de or slawomir.deren [at] tu-clausthal.de
\ No newline at end of file
Added: trunk/applications/jason-team/massim-agents/demoAgent.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-agents/demoAgent.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-agents/startAgents.sh
===================================================================
--- trunk/applications/jason-team/massim-agents/startAgents.sh (rev 0)
+++ trunk/applications/jason-team/massim-agents/startAgents.sh 2008-03-17 08:41:44 UTC (rev 1156)
@@ -0,0 +1,33 @@
+###############################################################
+#!/bin/sh #
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package massim-demoAgents #
+# This script starts the 6 agents for 2 teams. They connect #
+# to a massim-Server running in the same host and with the #
+# username and passwords specified. For more information #
+# refer to the README file. #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+server=localhost
+
+echo "Launching Agents"
+java -jar demoAgent.jar botagent1 1 $server &
+java -jar demoAgent.jar botagent2 2 $server &
+java -jar demoAgent.jar botagent3 3 $server &
+java -jar demoAgent.jar botagent4 4 $server &
+java -jar demoAgent.jar botagent5 5 $server &
+java -jar demoAgent.jar botagent6 6 $server &
+#java -jar demoAgent.jar participant1 1 $server &
+#java -jar demoAgent.jar participant2 2 $server &
+#java -jar demoAgent.jar participant3 3 $server &
+#java -jar demoAgent.jar participant4 4 $server &
+#java -jar demoAgent.jar participant5 5 $server &
+#java -jar demoAgent.jar participant6 6 $server &
Property changes on: trunk/applications/jason-team/massim-agents/startAgents.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/applications/jason-team/massim-server/LICENSE
===================================================================
--- trunk/applications/jason-team/massim-server/LICENSE (rev 0)
+++ trunk/applications/jason-team/massim-server/LICENSE 2008-03-17 08:41:44 UTC (rev 1156)
@@ -0,0 +1,353 @@
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package massim-server #
+# LICENSE file for the massim-server package #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs,...
[truncated message content] |
|
From: <jom...@us...> - 2008-03-19 17:50:14
|
Revision: 1166
http://jason.svn.sourceforge.net/jason/?rev=1166&view=rev
Author: jomifred
Date: 2008-03-19 10:50:11 -0700 (Wed, 19 Mar 2008)
Log Message:
-----------
jason-team: write a "summary" of the world state (ag's location) in a file
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/java/arch/ACArchitecture.java
trunk/applications/jason-team/src/java/arch/CowboyArch.java
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-03-18 22:36:40 UTC (rev 1165)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-03-19 17:50:11 UTC (rev 1166)
@@ -11,7 +11,7 @@
agents:
dummy1 dummy.asl
- [verbose=1, gui=no, write_model=no, ac_sim_back_dir="./massim-server/backup",
+ [verbose=1, gui=no, write_model=yes, ac_sim_back_dir="./massim-server/backup",
host="localhost", port=12300, username=participant1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-03-18 22:36:40 UTC (rev 1165)
+++ trunk/applications/jason-team/readme.txt 2008-03-19 17:50:11 UTC (rev 1166)
@@ -36,7 +36,15 @@
5. start the simulation
go to shell running startServer.sh and press ENTER
+6. you can get the agents location with the command
+
+ tail -f world-state-dummy1.txt
+7. the get the graphical view of some agent, add gui=yes in
+ the agent's option (.mas2j file)
+
+
+
---- OLD ----
Our team can run in three configurations (Jason 1.0.2 is required):
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-03-18 22:36:40 UTC (rev 1165)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-03-19 17:50:11 UTC (rev 1166)
@@ -37,6 +37,11 @@
-- (it is a kind of persistent goal)
*/
+// if the target is changed, "restart" move
++target(_,_)
+ <- .drop_desire(move);
+ !!move.
+
// I still do not know my location
+!move
: not pos(_,_,_)
@@ -50,8 +55,9 @@
(not target(_,_) | // I have no target OR
target(X,Y) | // I am at target OR
(target(BX,BY) & jia.direction(X, Y, BX, BY, skip))) // is impossible to go to target
- <- !define_new_target;
- !move.
+ <- ?random_pos(NX,NY);
+ jia.set_target(NX,NY);
+ -+target(NX,NY).
// does one step towards target
+!move
@@ -63,20 +69,15 @@
// in case of failure, move
-!move
- <- .current_intention(I); .println("failure in move:",I);
+ <- .current_intention(I); .println("failure in move, intention: ",I);
!move.
-/* -- add a belief target random move -- */
-
-+!define_new_target
- <- ?random_pos(NX,NY);
- jia.set_target(NX,NY);
- -+target(NX,NY).
++restart
+ <- .print("*** restart ***");
+ .drop_all_desires;
+ !move.
-
-+restart <- .print("*** Restart! "); .drop_all_desires; !define_new_target; !move.
-
/* -- tests -- */
+gsize(Weight,Height) <- .println("gsize = ",Weight,",",Height).
@@ -85,4 +86,4 @@
+cell(X,Y,Type) <- .println("cell = ",X,",",Y," = ",Type).
+pratio(R) <- .println("pratio = ",R).
-+pos(X,Y,S) <- .println("pos = ",X,",",Y,"/",S).
\ No newline at end of file
++pos(X,Y,S) <- .println("pos = ",X,",",Y,"/",S).
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-03-18 22:36:40 UTC (rev 1165)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-03-19 17:50:11 UTC (rev 1166)
@@ -3,6 +3,7 @@
import jason.JasonException;
import jason.asSemantics.ActionExec;
import jason.asSyntax.Literal;
+import jason.functions.log;
import jason.mas2j.ClassParameters;
import jason.runtime.Settings;
@@ -128,6 +129,8 @@
ActionExec lastAction;
Queue<ActionExec> toExecute = new ConcurrentLinkedQueue<ActionExec>();
+ String x;
+
WaitSleep() {
super("WaitSpeepToSendAction");
}
@@ -146,7 +149,10 @@
ActionExec action = toExecute.poll();
action.setResult(true);
feedback.add(action);
- }
+ }
+
+ logger.info("last action sent is "+x);
+ x = null;
}
synchronized void go() {
@@ -163,7 +169,8 @@
lastAction = null;
waitSleep();
if (lastAction != null) {
- proxy.sendAction(lastAction.getActionTerm().getTerm(0).toString());
+ x = lastAction.getActionTerm().getTerm(0).toString();
+ proxy.sendAction(x);
toExecute.offer(lastAction);
}
} catch (InterruptedException e) {
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-03-18 22:36:40 UTC (rev 1165)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-03-19 17:50:11 UTC (rev 1166)
@@ -13,7 +13,11 @@
import jason.runtime.Settings;
import java.io.PrintWriter;
+import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -115,6 +119,8 @@
acView.setPriority(Thread.MIN_PRIORITY);
acView.start();
}
+ if (writeModelThread != null)
+ writeModelThread.reset();
}
/** The perception of the corral location is removed from the percepts list
@@ -232,7 +238,7 @@
void setCycle(int s) {
cycle = s;
if (view != null) view.setCycle(cycle);
- //if (writeModelT != null) writeModelT.writeModel();
+ if (writeModelThread != null) writeModelThread.go();
}
void setScore(int s) {
@@ -311,32 +317,72 @@
class WriteModelThread extends Thread {
+
+ Map<Integer,List<Location>> locations;
+
+ public void reset() {
+ // init locations
+ locations = new HashMap<Integer, List<Location>>();
+ for (int i=0; i<WorldModel.agsByTeam; i++) {
+ locations.put(i, new LinkedList<Location>());
+ }
+ }
+
public void run() {
+ reset();
+
String fileName = "world-state-"+getAgName()+".txt";
PrintWriter out = null;
try {
out = new PrintWriter(fileName);
while (true) {
- waitSomeTime();
- if (model != null && playing) {
- out.println("\n\n** Agent "+getAgName()+" in cycle "+cycle+"\n");
- //for (int i=0; i<model.getNbOfAgs(); i++) {
- // TODO: out.println("miner"+(i+1)+" is carrying "+model.getGoldsWithAg(i)+" gold(s), at "+model.getAgPos(i));
- //}
- out.println(model.toString());
- out.flush();
- }
+ try {
+ waitSomeTime();
+ if (model != null && playing) {
+ //out.println("\n\n** Agent "+getAgName()+" in cycle "+cycle+"\n");
+ //for (int i=0; i<model.getNbOfAgs(); i++) {
+ // out.println("miner"+(i+1)+" is carrying "+model.getGoldsWithAg(i)+" gold(s), at "+model.getAgPos(i));
+ //}
+ //out.println(model.toString());
+ StringBuilder s = new StringBuilder(String.format("Step %5d : ", cycle));
+ for (int i=0; i<WorldModel.agsByTeam; i++) {
+ Location agp = model.getAgPos(i);
+ if (agp != null) {
+ // count how long the agent is in the same location
+ int c = 0;
+ Iterator<Location> il = locations.get(i).iterator();
+ while (il.hasNext() && il.next().equals(agp) && c <= 11) {
+ c++;
+ }
+ String sc = "*";
+ if (c < 10) sc = ""+c;
+
+ locations.get(i).add(0,agp);
+ s.append(String.format("%5d,%2d/%s", agp.x, agp.y, sc));
+ }
+ }
+ logger.info(s.toString());
+ out.println(s.toString());
+ out.flush();
+ }
+ } catch (InterruptedException e) { // no problem, quit the thread
+ return;
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
- } catch (InterruptedException e) { // no problem, quit the thread
- } catch (Exception e) {
- e.printStackTrace();
+ } catch (Exception e) {
+ e.printStackTrace();
} finally {
out.close();
}
}
synchronized private void waitSomeTime() throws InterruptedException {
- wait(2000);
+ wait(4000);
}
+ synchronized private void go() {
+ notifyAll();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-09 13:28:08
|
Revision: 1208
http://jason.svn.sourceforge.net/jason/?rev=1208&view=rev
Author: jomifred
Date: 2008-04-09 06:27:38 -0700 (Wed, 09 Apr 2008)
Log Message:
-----------
improve jason team (18 cows collected!)
Modified Paths:
--------------
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/java/arch/ACArchitecture.java
trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
trunk/applications/jason-team/src/java/env/WorldModel.java
trunk/applications/jason-team/src/java/jia/Search.java
trunk/applications/jason-team/src/java/jia/herd_position.java
trunk/applications/jason-team/todo.org
Added Paths:
-----------
trunk/applications/jason-team/src/java/jia/dist.java
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-09 13:27:38 UTC (rev 1208)
@@ -24,9 +24,17 @@
// find a free random location
random_pos(X,Y) :-
pos(AgX,AgY,_) &
- jia.random(RX,40) & X = (RX-20)+AgX & X > 0 &
- jia.random(RY,40,5) & Y = (RY-20)+AgY &
- not jia.obstacle(X,Y).
+ 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).
+
+// whether some location X,Y has an agent and I am near that location
+agent_in_target :-
+ pos(AgX,AgY,_) &
+ target(TX,TY) &
+ (cell(TX,TY,ally(_)) | cell(TX,TY,enemy(_)) | cell(TX,TY,cow(_))) &
+ jia.dist(TX,TY,AgX,AgY,D) &
+ D <= 2. // this number should be the same used by A* (DIST_FOR_AG_OBSTACLE constant)
/* -- initial goal */
@@ -40,6 +48,11 @@
<- jia.herd_position(X,Y); // compute new location
.print("COWS! going to ",X,",",Y);
-+target(X,Y). // go to there
+
++pos(_,_,_)
+ : not cell(_,_,cow(_)) // I see no cow
+ <- -target(_,_);
+ !move.
/* -- what todo when arrive at location */
@@ -47,8 +60,11 @@
+!decide_target // chose a new random pos
: not cell(_,_,cow(_))
<- ?random_pos(NX,NY);
+ .print("New random target: ",NX,",",NY);
-+target(NX,NY).
-+!decide_target.
++!decide_target
+ <- .print("No need for a new target, consider last herding location.");
+ do(skip). // send an action so that the simulator does not wait for me.
/* -- plans to move to a destination represented in the belief target(X,Y)
-- (it is a kind of persistent goal)
@@ -70,8 +86,10 @@
// find a new destination
+!move
: pos(X,Y,_) &
- (not target(_,_) | // I have no target OR
- target(X,Y) | // I am at target OR
+ (not target(_,_) | // I have no target OR
+ target(X,Y) | // I am at target OR
+ jia_obstacle(X,Y) | // An obstacle was discovered in the target
+ agent_in_target | // there is an agent in the target
(target(BX,BY) & jia.direction(X, Y, BX, BY, skip))) // is impossible to go to target
<- !decide_target.
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -142,7 +142,10 @@
}
void newCycle() {
- logger.info("last action sent is "+lastActionInCurrentCycle+". The following was not sent: "+toExecute);
+ String w = "";
+ if (lastActionInCurrentCycle == null) w = "*** ";
+ logger.info(w+"Last sent action was "+lastActionInCurrentCycle+" for cycle "+getCycle()+". The following was not sent: "+toExecute);
+
setLastAct(lastActionInCurrentCycle);
lastActionInCurrentCycle = null;
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -59,7 +59,7 @@
}
public Location nearFree(Location l) throws Exception {
- int w = 1;
+ int w = 0;
while (true) {
for (int x=l.x-w; x<=l.x+w;x++)
if (isFree(x,l.y))
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -100,6 +100,7 @@
}
public String shortActionFormat(String act) {
+ 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/env/WorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/env/WorldModel.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/env/WorldModel.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -57,7 +57,7 @@
@Override
public boolean isFree(int x, int y) {
- return super.isFree(x,y) && !hasObject(ENEMY, x, y) && !hasObject(COW, x, y) && !hasObject(CORRAL, x, y);
+ return super.isFree(x,y) && !hasObject(ENEMY, x, y) && !hasObject(AGENT, x, y) && !hasObject(COW, x, y) && !hasObject(CORRAL, x, y);
}
public WorldView getView() {
Modified: trunk/applications/jason-team/src/java/jia/Search.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/Search.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/jia/Search.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -18,6 +18,8 @@
import env.WorldModel;
public class Search {
+
+ public static final int DIST_FOR_AG_OBSTACLE = 2;
final LocalWorldModel model;
final Location from, to;
@@ -187,9 +189,9 @@
return;
if (ia.considerCorralAsObstacles && ia.model.hasObject(WorldModel.CORRAL, newl))
return;
- if (ia.considerAgentsAsObstacles && ia.model.hasObject(WorldModel.AGENT,newl) && ia.from.maxBorder(newl) <= 2)
+ if (ia.considerAgentsAsObstacles && ia.model.hasObject(WorldModel.AGENT,newl) && ia.from.maxBorder(newl) <= Search.DIST_FOR_AG_OBSTACLE)
return;
- if (ia.considerCowsAsObstacles && ia.model.hasObject(WorldModel.COW,newl) && ia.from.maxBorder(newl) <= 2)
+ if (ia.considerCowsAsObstacles && ia.model.hasObject(WorldModel.COW,newl) && ia.from.maxBorder(newl) <= Search.DIST_FOR_AG_OBSTACLE)
return;
int cost = 1;
Added: trunk/applications/jason-team/src/java/jia/dist.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/dist.java (rev 0)
+++ trunk/applications/jason-team/src/java/jia/dist.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -0,0 +1,30 @@
+package jia;
+
+import java.util.logging.Level;
+
+import jason.asSemantics.*;
+import jason.asSyntax.*;
+import jason.environment.grid.Location;
+
+/**
+ * Gets the distance between two points.
+ *
+ * @author jomi
+ */
+public class dist extends DefaultInternalAction {
+
+ @Override
+ public Object execute(TransitionSystem ts, Unifier un, Term[] terms) throws Exception {
+ try {
+ int iagx = (int) ((NumberTerm) terms[0]).solve();
+ int iagy = (int) ((NumberTerm) terms[1]).solve();
+ int itox = (int) ((NumberTerm) terms[2]).solve();
+ int itoy = (int) ((NumberTerm) terms[3]).solve();
+ int dist = new Location(iagx, iagy).maxBorder(new Location(itox, itoy));
+ return un.unifies(terms[4], new NumberTermImpl(dist));
+ } catch (Throwable e) {
+ ts.getLogger().log(Level.SEVERE, "dist error: "+e, e);
+ }
+ return false;
+ }
+}
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-09 13:27:38 UTC (rev 1208)
@@ -30,9 +30,13 @@
LocalWorldModel model = ((CowboyArch)ts.getUserAgArch()).getModel();
- Location agTarget = model.nearFree(getAgTarget(model));
- return un.unifies(terms[0], new NumberTermImpl(agTarget.x)) &&
- un.unifies(terms[1], new NumberTermImpl(agTarget.y));
+
+ Location agTarget = getAgTarget(model);
+ if (agTarget != null) {
+ agTarget = model.nearFree(agTarget);
+ return un.unifies(terms[0], new NumberTermImpl(agTarget.x)) &&
+ un.unifies(terms[1], new NumberTermImpl(agTarget.y));
+ }
} catch (Throwable e) {
ts.getLogger().log(Level.SEVERE, "herd_position error: "+e, e);
}
Modified: trunk/applications/jason-team/todo.org
===================================================================
--- trunk/applications/jason-team/todo.org 2008-04-08 21:34:26 UTC (rev 1207)
+++ trunk/applications/jason-team/todo.org 2008-04-09 13:27:38 UTC (rev 1208)
@@ -1,3 +1,4 @@
+* faster simulator
* develop a team of dummies to play against
** what is a dummy strategy?
* base components
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-10 21:40:17
|
Revision: 1213
http://jason.svn.sourceforge.net/jason/?rev=1213&view=rev
Author: jomifred
Date: 2008-04-10 14:40:07 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
creates jason x dummies files (actually we have dummies x dummies)
(see readme info for how to launch)
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/java/arch/CowboyArch.java
trunk/applications/jason-team/src/java/env/ACViewer.java
Added Paths:
-----------
trunk/applications/jason-team/AC-Local-Dummies.mas2j
trunk/applications/jason-team/dummies.xml
trunk/applications/jason-team/gauchos.xml
Added: trunk/applications/jason-team/AC-Local-Dummies.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-Dummies.mas2j (rev 0)
+++ trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-04-10 21:40:07 UTC (rev 1213)
@@ -0,0 +1,46 @@
+/* Jason Team for the
+ * Multi-Agent Programming Contest 2008
+ * (http://cig.in.tu-clausthal.de/AgentContest)
+ *
+ * Configuration for contest simulator running local
+ *
+ */
+
+MAS dummies {
+ infrastructure: Centralised
+
+ agents:
+ dummy1 dummy.asl
+ [verbose=1, gui=no, write_status=no, ac_sim_back_dir="",
+ host="localhost", port=12300, username=botagent1, password="1"]
+ agentArchClass arch.ACArchitecture
+ agentClass agent.SelectEvent
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)","pratio(_)");
+ 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(_,_,_,_)","pratio(_)");
+ 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(_,_,_,_)","pratio(_)");
+ 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(_,_,_,_)","pratio(_)");
+ 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(_,_,_,_)","pratio(_)");
+ 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(_,_,_,_)","pratio(_)");
+
+ aslSourcePath: "src/asl";
+}
Property changes on: trunk/applications/jason-team/AC-Local-Dummies.mas2j
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-10 15:26:59 UTC (rev 1212)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-10 21:40:07 UTC (rev 1213)
@@ -6,37 +6,37 @@
*
*/
-MAS miners {
+MAS jason_cowboys {
infrastructure: Centralised
agents:
- dummy1 dummy.asl
+ gaucho1 dummy.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(_)");
- dummy2 dummy.asl
+ gaucho2 dummy.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(_)");
- dummy3 dummy.asl
+ gaucho3 dummy.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(_)");
- dummy4 dummy.asl
+ gaucho4 dummy.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(_)");
- dummy5 dummy.asl
+ gaucho5 dummy.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(_)");
- dummy6 dummy.asl
+ gaucho6 dummy.asl
[verbose=1,host="localhost", port=12300, username=participant6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
Added: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml (rev 0)
+++ trunk/applications/jason-team/dummies.xml 2008-04-10 21:40:07 UTC (rev 1213)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+
+ This file was generated by Jason 1.1
+ http://jason.sf.net
+
+ April 10, 2008 - 23:19:55
+-->
+
+<project name ="miners"
+ basedir="."
+ default="run">
+
+ <property name="mas2j.project.file" value="AC-Local-Dummies.mas2j"/>
+ <property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
+ <property name="build.dir" value="${basedir}/bin/classes" />
+
+ <property name="jasonJar" value="../../lib/jason.jar"/>
+
+ <path id="project.classpath">
+ <pathelement location="${basedir}"/>
+ <pathelement location="${build.dir}"/>
+ <pathelement location="${jasonJar}"/>
+ <fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
+
+ </path>
+
+ <!-- tasks the user can override in his/her c-build.xml script -->
+ <target name="user-init">
+ </target>
+ <target name="user-end">
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ <antcall target="user-init" />
+ </target>
+
+ <target name="compile" depends="init">
+ <condition property="srcdir" value="${basedir}/src/java" else="${basedir}" >
+ <available file="${basedir}/src/java" />
+ </condition>
+ <javac srcdir="${srcdir}" destdir="${build.dir}" debug="true" optimize="true" >
+ <classpath refid="project.classpath"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <delete file="${ant.project.name}.jar" />
+ <copy file="${jasonJar}" tofile="${ant.project.name}.jar" />
+ <copy file="${mas2j.project.file}" tofile="default.mas2j" />
+ <jar update="yes" jarfile="${ant.project.name}.jar" >
+ <fileset dir="${basedir}">
+ <include name="**/*.asl" />
+ <include name="**/*.mas2j" />
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="**/*.class" />
+ </fileset>
+ </jar>
+ <delete file="default.mas2j" />
+ </target>
+
+
+ <target name="jnlp" depends="jar" >
+ <mkdir dir="${basedir}/${ant.project.name}-jws"/>
+ <java classname="jason.infra.centralised.CreateJNLP"
+ failonerror="true" fork="yes" dir="${basedir}/${ant.project.name}-jws" >
+ <classpath refid="project.classpath"/>
+ <arg line="${ant.project.name} ${mas2j.project.file}"/>
+ </java>
+ <copy todir="${basedir}/${ant.project.name}-jws" failonerror="no">
+ <fileset dir="${basedir}/lib" includes="**/*.jar" />
+ <fileset dir="${basedir}" includes="${ant.project.name}.jar" />
+ <fileset dir="/Users/jomi/Jason/Jason-svn/src/images" includes="Jason-GMoreau-Icon.jpg" />
+ </copy>
+ <signjar jar="${basedir}/${ant.project.name}-jws/${ant.project.name}.jar" alias="jason"
+ storepass="rbjhja" keypass="rbjhja" keystore="/Users/jomi/Jason/Jason-svn/src/jasonKeystore" />
+ <echo message="**" />
+ <echo message="** Java Web Start application created in directory ${ant.project.name}-jws" />
+ <echo message="** Update the codebase (in the second line of the .jnlp file)" />
+ <echo message="** with the URL where you will upload the application." />
+ <echo message="**" />
+ </target>
+
+
+ <target name="run" depends="compile" >
+ <echo message="Running project ${ant.project.name}" />
+ <java classname="jason.infra.centralised.RunCentralisedMAS"
+ failonerror="true" fork="yes" dir="${basedir}" >
+ <classpath refid="project.classpath"/>
+ <arg line="${mas2j.project.file} ${debug} "/>
+ <jvmarg line="-Xmx750M"/>
+ </java>
+ <antcall target="user-end" />
+ </target>
+
+ <target name="clean" >
+ <delete failonerror="no" includeEmptyDirs="true" verbose="true">
+ <fileset dir="${basedir}" includes="**/*.class"/>
+ </delete>
+ </target>
+
+
+
+</project>
Added: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml (rev 0)
+++ trunk/applications/jason-team/gauchos.xml 2008-04-10 21:40:07 UTC (rev 1213)
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+
+ This file was generated by Jason 1.1
+ http://jason.sf.net
+
+ April 10, 2008 - 23:22:26
+-->
+
+<project name ="jason_cowboys"
+ basedir="."
+ default="run">
+
+ <property name="mas2j.project.file" value="AC-Local-JasonTeam.mas2j"/>
+ <property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
+ <property name="build.dir" value="${basedir}/bin/classes" />
+
+ <property name="jasonJar" value="../../lib/jason.jar"/>
+
+ <path id="project.classpath">
+ <pathelement location="${basedir}"/>
+ <pathelement location="${build.dir}"/>
+ <pathelement location="${jasonJar}"/>
+ <fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
+
+ </path>
+
+ <!-- tasks the user can override in his/her c-build.xml script -->
+ <target name="user-init">
+ </target>
+ <target name="user-end">
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ <antcall target="user-init" />
+ </target>
+
+ <target name="compile" depends="init">
+ <condition property="srcdir" value="${basedir}/src/java" else="${basedir}" >
+ <available file="${basedir}/src/java" />
+ </condition>
+ <javac srcdir="${srcdir}" destdir="${build.dir}" debug="true" optimize="true" >
+ <classpath refid="project.classpath"/>
+ </javac>
+ </target>
+
+ <target name="jar" depends="compile">
+ <delete file="${ant.project.name}.jar" />
+ <copy file="${jasonJar}" tofile="${ant.project.name}.jar" />
+ <copy file="${mas2j.project.file}" tofile="default.mas2j" />
+ <jar update="yes" jarfile="${ant.project.name}.jar" >
+ <fileset dir="${basedir}">
+ <include name="**/*.asl" />
+ <include name="**/*.mas2j" />
+ </fileset>
+ <fileset dir="${build.dir}">
+ <include name="**/*.class" />
+ </fileset>
+ </jar>
+ <delete file="default.mas2j" />
+ </target>
+
+
+ <target name="jnlp" depends="jar" >
+ <mkdir dir="${basedir}/${ant.project.name}-jws"/>
+ <java classname="jason.infra.centralised.CreateJNLP"
+ failonerror="true" fork="yes" dir="${basedir}/${ant.project.name}-jws" >
+ <classpath refid="project.classpath"/>
+ <arg line="${ant.project.name} ${mas2j.project.file}"/>
+ </java>
+ <copy todir="${basedir}/${ant.project.name}-jws" failonerror="no">
+ <fileset dir="${basedir}/lib" includes="**/*.jar" />
+ <fileset dir="${basedir}" includes="${ant.project.name}.jar" />
+ <fileset dir="/Users/jomi/Jason/Jason-svn/src/images" includes="Jason-GMoreau-Icon.jpg" />
+ </copy>
+ <signjar jar="${basedir}/${ant.project.name}-jws/${ant.project.name}.jar" alias="jason"
+ storepass="rbjhja" keypass="rbjhja" keystore="/Users/jomi/Jason/Jason-svn/src/jasonKeystore" />
+ <echo message="**" />
+ <echo message="** Java Web Start application created in directory ${ant.project.name}-jws" />
+ <echo message="** Update the codebase (in the second line of the .jnlp file)" />
+ <echo message="** with the URL where you will upload the application." />
+ <echo message="**" />
+ </target>
+
+
+ <target name="run" depends="compile" >
+ <echo message="Running project ${ant.project.name}" />
+ <java classname="jason.infra.centralised.RunCentralisedMAS"
+ failonerror="true" fork="yes" dir="${basedir}" >
+ <classpath refid="project.classpath"/>
+ <arg line="${mas2j.project.file} ${debug} "/>
+ <jvmarg line="-Xmx750M"/>
+ </java>
+ <antcall target="user-end" />
+ </target>
+
+ <target name="clean" >
+ <delete failonerror="no" includeEmptyDirs="true" verbose="true">
+ <fileset dir="${basedir}" includes="**/*.class"/>
+ </delete>
+ </target>
+
+
+
+</project>
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-04-10 15:26:59 UTC (rev 1212)
+++ trunk/applications/jason-team/readme.txt 2008-04-10 21:40:07 UTC (rev 1213)
@@ -13,25 +13,28 @@
To run this team:
1. update sources of Jason
- cd Jason-svn
- svn update
- ant plugin
+ cd Jason-svn
+ svn update
+ ant plugin
2. run massim-server
- cd applications/jason-team/massim-server
- ./startServer.sh
+ cd applications/jason-team/massim-server
+ ./startServer.sh
-3. run massim-agents (6 agents developed by the ContestTeam)
- cd ../massim-agents
- ./startAgents.sh
+3. run dummies (written in Jason)
+ ant -f dummies.xml
+
+ or those written by the Contest developers
+ cd ../massim-agents
+ ./startAgents.sh
-4. run Jason dummies (for now we do not have a team)
+4. run Jason team
a. by JasonIDE
../../bin/jason.sh
open an run AC-Local-JasonTeam.mas2j
- b. by Ant (only after run once by JasonIDE)
- ant -f bin/build.xml
+ b. by Ant
+ ant -f gauchos.xml
5. start the simulation
go to shell running startServer.sh and press ENTER
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-10 15:26:59 UTC (rev 1212)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-10 21:40:07 UTC (rev 1213)
@@ -111,7 +111,7 @@
if (gui) {
view = new WorldView("Herding (view of cowboy "+(getMyId()+1)+") -- against "+opponent,model);
}
- if (massimBackDir != null) {
+ if (massimBackDir != null && massimBackDir.length() > 0) {
acView = new ACViewer(massimBackDir, w, h);
acView.setPriority(Thread.MIN_PRIORITY);
acView.start();
Modified: trunk/applications/jason-team/src/java/env/ACViewer.java
===================================================================
--- trunk/applications/jason-team/src/java/env/ACViewer.java 2008-04-10 15:26:59 UTC (rev 1212)
+++ trunk/applications/jason-team/src/java/env/ACViewer.java 2008-04-10 21:40:07 UTC (rev 1213)
@@ -118,12 +118,12 @@
public void run() {
while (true) {
try {
+ sleep(500);
File lastFile = getLastFile(getLastFile(massimServerBackupDir));
if (lastFile != null) {
logger.info("getting scenario from "+lastFile);
updateWorld(lastFile);
}
- sleep(500);
} catch (InterruptedException e) {
return;
} catch (NoSuchElementException e) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-20 20:16:55
|
Revision: 1233
http://jason.svn.sourceforge.net/jason/?rev=1233&view=rev
Author: jomifred
Date: 2008-04-20 13:16:53 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
update jason team
add massim monitor
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/massim-agents/demoAgent.jar
trunk/applications/jason-team/src/asl/dummy.asl
trunk/applications/jason-team/src/java/agent/UniqueBelsBB.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/env/WorldModel.java
trunk/applications/jason-team/src/java/env/WorldView.java
trunk/applications/jason-team/src/java/jia/Search.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
Added Paths:
-----------
trunk/applications/jason-team/doc/scenario-r4.pdf
trunk/applications/jason-team/massim-server/massim/rmi/
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServer.class
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver$SimulationStateServerImplementation.class
trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver.class
trunk/applications/jason-team/massim-server/massim/rmi/StringMapServer.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver$XMLDocumentServerImplementation.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver.class
trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentServer.class
trunk/applications/jason-team/massim-servermonitor/
trunk/applications/jason-team/massim-servermonitor/LICENSE
trunk/applications/jason-team/massim-servermonitor/README
trunk/applications/jason-team/massim-servermonitor/massimServerMonitor.jar
trunk/applications/jason-team/massim-servermonitor/startMonitor.sh
Removed Paths:
-------------
trunk/applications/jason-team/doc/scenario-r3.pdf
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-20 20:13:53 UTC (rev 1232)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-04-20 20:16:53 UTC (rev 1233)
@@ -11,7 +11,7 @@
agents:
gaucho1 dummy.asl
- [verbose=1, gui=no, write_status=yes, ac_sim_back_dir="./massim-server/backup",
+ [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
Deleted: trunk/applications/jason-team/doc/scenario-r3.pdf
===================================================================
(Binary files differ)
Added: trunk/applications/jason-team/doc/scenario-r4.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/doc/scenario-r4.pdf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/applications/jason-team/massim-agents/demoAgent.jar
===================================================================
(Binary files differ)
Added: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServer.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver$SimulationStateServerImplementation.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver$SimulationStateServerImplementation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/SimulationStateServerObserver.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/StringMapServer.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/StringMapServer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver$XMLDocumentServerImplementation.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver$XMLDocumentServerImplementation.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentObserver.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentServer.class
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-server/massim/rmi/XMLDocumentServer.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-servermonitor/LICENSE
===================================================================
--- trunk/applications/jason-team/massim-servermonitor/LICENSE (rev 0)
+++ trunk/applications/jason-team/massim-servermonitor/LICENSE 2008-04-20 20:16:53 UTC (rev 1233)
@@ -0,0 +1,353 @@
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package MASSim servermonitor #
+# LICENSE file for the MASSim servermonitor package #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program 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 General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
Added: trunk/applications/jason-team/massim-servermonitor/README
===================================================================
--- trunk/applications/jason-team/massim-servermonitor/README (rev 0)
+++ trunk/applications/jason-team/massim-servermonitor/README 2008-04-20 20:16:53 UTC (rev 1233)
@@ -0,0 +1,58 @@
+###############################################################
+# Multi-Agent Programming Contest 2008 #
+# #
+# Support package MASSim servermonitor #
+# README file for the MASSim servermonitor package #
+# #
+# For the details on the contest, check the Contest website: #
+# http://cig.in.tu-clausthal.de/agentcontest2008/ #
+# #
+# Organizers: #
+# J. Dix, M. Dastani, P. Novak, T.M. Behrens #
+###############################################################
+
+MASSim servermonitor package.
+
+1. Prerequisites.
+
+You only need the sun-java5 / sun-java6 (jre and jdk) installed to run the server.
+
+2. Installing and running.
+
+·Unpack the file anywhere:
+ tar xzvf massim-ServerMonitor-version.tag.gz -C output_dir
+
+·Switch to the new directory:
+ cd output_dir/massim-ServerMonitor
+
+·Run the script provided in the package:
+ ./startMonitor.sh
+
+3. Options.
+You can pass to startMonitor.sh script any of the following parameters:
+ --help Displays the help
+ --host <RMI hostname> Hostname of the computer where the massim-server is running
+ --port <RMI port> Port of the rmiregistry
+ --service <RMI servicename> See 4 for details
+ --sleeptime <time> Thread sleeptime in ms
+ --disable-stylesheets Disables reading of configfile and stylesheet use
+ --conf <configfile>
+
+If no parameters are given default values will be used.
+Default values:
+ host = localhost
+ port = 1099
+ service = xmlsimulation
+ sleeptime = 10000ms
+ conf = configfile contained in servermonitor.jar
+
+4. RMI servicesnames
+ xmlsimulation Simulation dependend statistics (number of steps, agentscores, ...)
+ statistics Statistics for the tournament (ranking, results of simulations, ...)
+ server2 Statistics of connected agents (name, port, ip)
+
+5. Questions, problems, suggestions, ...
+
+please, ask to the Agent Contest 2008 mail-list agentcontest2008-general [at] in.tu-clausthal.de
+or for more fast communication: jens.dehnert [at] tu-clausthal.de or slawomir.deren [at] tu-clausthal.de
+
Added: trunk/applications/jason-team/massim-servermonitor/massimServerMonitor.jar
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/massim-servermonitor/massimServerMonitor.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/massim-servermonitor/startMonitor.sh
===================================================================
--- trunk/applications/jason-team/massim-servermonitor/startMonitor.sh (rev 0)
+++ trunk/applications/jason-team/massim-servermonitor/startMonitor.sh 2008-04-20 20:16:53 UTC (rev 1233)
@@ -0,0 +1,8 @@
+###################################
+#!/bin/sh #
+###################################
+
+clear
+
+echo "Launching Monitor"
+java -jar massimServerMonitor.jar $*
\ No newline at end of file
Property changes on: trunk/applications/jason-team/massim-servermonitor/startMonitor.sh
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-20 20:13:53 UTC (rev 1232)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-20 20:16:53 UTC (rev 1233)
@@ -29,44 +29,60 @@
not jia.obstacle(X,Y).
/...
[truncated message content] |
|
From: <jom...@us...> - 2008-04-21 16:47:00
|
Revision: 1236
http://jason.svn.sourceforge.net/jason/?rev=1236&view=rev
Author: jomifred
Date: 2008-04-21 09:46:57 -0700 (Mon, 21 Apr 2008)
Log Message:
-----------
minor changes in jason team
Modified Paths:
--------------
trunk/applications/jason-team/src/asl/dummy.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
trunk/applications/jason-team/src/java/env/WorldModel.java
trunk/applications/jason-team/src/java/jia/herd_position.java
trunk/applications/jason-team/todo.org
Removed Paths:
-------------
trunk/applications/jason-team/run.sh
Deleted: trunk/applications/jason-team/run.sh
===================================================================
--- trunk/applications/jason-team/run.sh 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/run.sh 2008-04-21 16:46:57 UTC (rev 1236)
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-java -cp ../../lib/jason.jar:lib/search.jar:bin/classes \
- jason.infra.centralised.RunCentralisedMAS \
- AC-Local-JasonTeam.mas2j
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-21 16:46:57 UTC (rev 1236)
@@ -6,7 +6,6 @@
gsize(Weight,Height)
steps(MaxSteps)
corral(UpperLeft.x,UpperLeft.y,DownRight.x,DownRight.y)
- pratio(Int) // ratio of perception of the agent
Step:
pos(X,Y,Step)
@@ -19,6 +18,11 @@
*/
+/* -- initial beliefs -- */
+
+ag_perception_ratio(8). // ratio of perception of the agent
+cow_perception_ratio(4).
+
/* -- useful rules */
// find a free random location
@@ -125,5 +129,4 @@
+corral(X1,Y1,X2,Y2) <- .println("corral = ",X1,",",Y1," -- ",X2,",",Y2).
//+cell(X,Y,Type) <- .println("cell = ",X,",",Y," = ",Type).
-+pratio(R) <- .println("pratio = ",R).
+pos(X,Y,S) <- .println("pos = ",X,",",Y,"/",S).
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -11,6 +11,10 @@
import java.util.List;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -24,6 +28,8 @@
*/
public class ACArchitecture extends CowboyArch {
+ public static final int actionTimeout = 1500; // timeout to send an action
+
private Logger logger;
private ACProxy proxy;
@@ -130,23 +136,29 @@
ActionExec lastAction;
String lastActionInCurrentCycle;
Queue<ActionExec> toExecute = new ConcurrentLinkedQueue<ActionExec>();
-
+ Lock lock = new ReentrantLock();
+ Condition cycle = lock.newCondition();
WaitSleep() {
super("WaitSpeepToSendAction");
}
- synchronized void addAction(ActionExec action) {
- if (lastAction != null)
- toExecute.offer(lastAction);
- lastAction = action;
+ void addAction(ActionExec action) {
+ lock.lock();
+ try {
+ if (lastAction != null)
+ toExecute.offer(lastAction);
+ lastAction = action;
+ } finally {
+ lock.unlock();
+ }
}
void newCycle() {
String w = "";
if (lastActionInCurrentCycle == null) {
+ addRestart();
w = "*** ";
- addRestart();
}
logger.info(w+"Last sent action was "+lastActionInCurrentCycle+" for cycle "+getCycle()+". The following was not sent: "+toExecute);
@@ -160,14 +172,25 @@
action.setResult(true);
feedback.add(action);
}
+ go(); // reset the wait
}
- synchronized void go() {
- notifyAll();
+ void go() {
+ lock.lock();
+ try {
+ cycle.signal();
+ } finally {
+ lock.unlock();
+ }
}
- synchronized void waitSleep() throws InterruptedException {
- // TODO: do something by timeout?
- wait();
+
+ boolean waitSleep() throws InterruptedException {
+ lock.lock();
+ try {
+ return !cycle.await(actionTimeout, TimeUnit.MILLISECONDS);
+ } finally {
+ lock.unlock();
+ }
}
@Override
@@ -175,7 +198,7 @@
while (true) {
try {
lastAction = null;
- waitSleep();
+ waitSleep();
if (lastAction != null) {
lastActionInCurrentCycle = lastAction.getActionTerm().getTerm(0).toString();
proxy.sendAction(lastActionInCurrentCycle);
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -136,9 +136,6 @@
}
}
- int maxx = 0; // max value of some cell'x
-
-
public void processRequestAction(Element perception, long currenttime, long deadline) {
try {
List<Literal> percepts = new ArrayList<Literal>();
@@ -172,9 +169,6 @@
int absx = agx + cellx;
int absy = agy + celly;
- if (cellx > maxx)
- maxx = cellx;
-
NodeList cnl = cell.getChildNodes();
for (int j=0; j < cnl.getLength(); j++) {
if (cnl.item(j).getNodeType() == Element.ELEMENT_NODE && cellx != 0 && celly != 0) {
@@ -212,7 +206,6 @@
}
- arq.perceptionRatioPerceived(maxx);
arq.sendCowsToTeam();
arq.startNextStep(step, percepts);
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -13,6 +13,7 @@
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;
@@ -140,14 +141,6 @@
model.setMaxSteps(s);
}
- /** The perception ratio is discovered */
- void perceptionRatioPerceived(int s) throws RevisionFailedException {
- if (s != model.getPerceptionRatio()) {
- model.setPerceptionRatio(s);
- getTS().getAg().addBel(Literal.parseLiteral("pratio("+s+")"));
- }
- }
-
/** update the model with obstacle and share them with the team mates */
void obstaclePerceived(int x, int y, Literal p) {
if (! model.hasObject(WorldModel.OBSTACLE, x, y)) {
@@ -249,9 +242,22 @@
}
private static final Literal cowstoclean = Literal.parseLiteral("cell(_,_,cow(_))");
- synchronized void initKnownCows() throws RevisionFailedException {
+ private boolean cleanCows = false;
+
+ @Override
+ public synchronized void agDidPerceive() {
+ super.agDidPerceive();
+ if (cleanCows) {
+ try {
+ getTS().getAg().abolish(cowstoclean, null);
+ } catch (RevisionFailedException e) {}
+ cleanCows = false;
+ }
+ }
+
+ void initKnownCows() {
model.clearCows();
- getTS().getAg().abolish(cowstoclean, null);
+ cleanCows = true;
}
void cowPerceived(int x, int y) {
model.addCow(x,y);
@@ -259,7 +265,7 @@
void sendCowsToTeam() {
try {
- Message m = new Message("tell-cows", null, null, model.getCows());
+ Message m = new Message("tell-cows", null, null, new ArrayList<Location>(model.getCows()));
broadcast(m);
} catch (Exception e) {
e.printStackTrace();
@@ -303,7 +309,7 @@
@SuppressWarnings("unchecked")
@Override
- synchronized public void checkMail() {
+ public void checkMail() {
try {
super.checkMail();
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -203,7 +203,7 @@
/** removes enemies/gold around x,y */
public void clearAgView(int x, int y) {
- int r = getPerceptionRatio();
+ int r = agPerceptionRatio;
for (int c=x-r; c<=x+r; c++) {
for (int l=y-r; l<=y+r; l++) {
if (inGrid(c, l)) {
Modified: trunk/applications/jason-team/src/java/arch/WriteStatusThread.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/arch/WriteStatusThread.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -109,7 +109,7 @@
if (act.equals(WorldModel.Move.southwest.toString())) return "sw";
if (act.equals(WorldModel.Move.north.toString())) return "n ";
if (act.equals(WorldModel.Move.south.toString())) return "s ";
- if (act.equals(WorldModel.Move.skip.toString())) return "sk";
+ if (act.equals(WorldModel.Move.skip.toString())) return "--";
return act;
}
Modified: trunk/applications/jason-team/src/java/env/WorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/env/WorldModel.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/env/WorldModel.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -21,7 +21,10 @@
public static final int nbActions = 8;
- public static final int agsByTeam = 6;
+ public static final int agsByTeam = 6;
+
+ public static final int agPerceptionRatio = 8;
+ public static final int cowPerceptionRatio = 4;
double PSim = 0.1; // probability of action/information failure
@@ -35,8 +38,6 @@
int maxSteps = 0; // number of steps of the simulation
- int pratio = -1; // perception ratio
-
private Logger logger = Logger.getLogger("jasonTeamSimLocal.mas2j." + WorldModel.class.getName());
public enum Move {
@@ -98,46 +99,6 @@
cowsRed = c;
}
- public void setPerceptionRatio(int r) {
- pratio = r;
- }
- public int getPerceptionRatio() {
- return pratio;
- }
-
- /*
- public boolean hasGold() {
- return countObjects(COW) > 0;
- }
-
- public boolean isAllGoldsCollected() {
- return goldsInDepotRed + goldsInDepotBlue == initialNbCows;
- }
-
- public void setInitialNbGolds(int i) {
- initialNbCows = i;
- }
-
- public int getInitialNbGolds() {
- return initialNbCows;
- }
-
- public boolean isCarryingGold(int ag) {
- return goldsWithAg[ag] > 0;
- }
-
- public boolean mayCarryMoreGold(int ag) {
- return goldsWithAg[ag] < AG_CAPACITY;
- }
-
- public int getGoldsWithAg(int ag) {
- return goldsWithAg[ag];
- }
- public void setGoldsWithAg(int ag, int n) {
- goldsWithAg[ag] = n;
- }
- */
-
public void setPSim(double psim) {
PSim = psim;
}
@@ -145,19 +106,6 @@
PMax = pmax;
}
- /** returns the probability of action/perception failure for an agent
- based on the number of golds it is carrying
- */
- /*
- public double getAgFatigue(int ag) {
- return getAgFatigue(ag, goldsWithAg[ag]);
- }
-
- public double getAgFatigue(int ag, int golds) {
- return PSim + ((PMax - PSim)/AG_CAPACITY) * golds;
- }
- */
-
public void setMaxSteps(int s) {
maxSteps = s;
}
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-21 16:46:57 UTC (rev 1236)
@@ -45,11 +45,13 @@
if (arch.hasGUI())
setFormationLoc(model, Formation.valueOf(terms[0].toString()));
- Location agTarget = getAgTarget(model,Formation.valueOf(terms[0].toString()), agLoc);
+ Location agTarget = getAgTarget(model, Formation.valueOf(terms[0].toString()), agLoc);
if (agTarget != null) {
agTarget = nearFreeForAg(model, agLoc, agTarget);
return un.unifies(terms[1], new NumberTermImpl(agTarget.x)) &&
un.unifies(terms[2], new NumberTermImpl(agTarget.y));
+ } else {
+ ts.getLogger().info("No target! I am at "+agLoc+" places are "+formationPlaces(model, Formation.valueOf(terms[0].toString())));
}
} catch (Throwable e) {
ts.getLogger().log(Level.SEVERE, "herd_position error: "+e, e);
@@ -60,11 +62,11 @@
public Location getAgTarget(LocalWorldModel model, Formation formation, Location ag) throws Exception {
Location r = null;
List<Location> locs = formationPlaces(model, formation);
- if (locs != null) {
- for (Location l : locs) {
- r = l;
+ if (locs != null) {
+ for (Location l : locs) {
+ r = l;
if (ag.equals(l) || // I am there
- model.countObjInArea(WorldModel.AGENT, l, 1) == 0) { // someone else is there
+ model.countObjInArea(WorldModel.AGENT, l, 1) == 0) { // no one else is there
break;
}
}
Modified: trunk/applications/jason-team/todo.org
===================================================================
--- trunk/applications/jason-team/todo.org 2008-04-21 12:59:17 UTC (rev 1235)
+++ trunk/applications/jason-team/todo.org 2008-04-21 16:46:57 UTC (rev 1236)
@@ -1,20 +1,19 @@
-* faster simulator
-* DONE develop a team of dummies to play against
- CLOSED: [2008-04-20 Sun 22:23]
-** what is a dummy strategy?
-* base components
-** DONE Vectors (operations)
- CLOSED: [2008-04-20 Sun 22:23]
-* new scenarios
* team formations (moise+ representation of the team)
** Structure (we have something from the proposal)
** Functioning (we have noting, but I not sure we need...)
** computation of ideal locations of an agent to maintain a formation (can we use maintainance goal pattern?)
-* protocols
-* exploration strategy
- details
* herding strategy
details
+* exploration strategy
+ details
+* new scenarios
+* protocols
+* faster simulator
+* DONE Vectors (operations)
+ CLOSED: [2008-04-20 Sun 22:23]
+* DONE develop a team of dummies to play against
+ CLOSED: [2008-04-20 Sun 22:23]
+** what is a dummy strategy?
* DONE A* (update previous to new directions)
CLOSED: [2008-03-16 Sun 15:29]
* DONE integration with new simulator
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-24 09:18:31
|
Revision: 1246
http://jason.svn.sourceforge.net/jason/?rev=1246&view=rev
Author: jomifred
Date: 2008-04-24 02:18:29 -0700 (Thu, 24 Apr 2008)
Log Message:
-----------
jason team: fix script for dummies
Modified Paths:
--------------
trunk/applications/jason-team/dummies.xml
trunk/applications/jason-team/readme.txt
Modified: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml 2008-04-24 09:09:25 UTC (rev 1245)
+++ trunk/applications/jason-team/dummies.xml 2008-04-24 09:18:29 UTC (rev 1246)
@@ -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>
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-04-24 09:09:25 UTC (rev 1245)
+++ trunk/applications/jason-team/readme.txt 2008-04-24 09:18:29 UTC (rev 1246)
@@ -12,15 +12,18 @@
To run this team:
-1. update sources of Jason
+1. update sources of Jason and JMoise+
cd Jason-svn
svn update
ant plugin
-
+
+ cd applications/jason-moise
+ ant jar
+
2. run massim-server
cd applications/jason-team/massim-server
- ./startServer.sh
-
+ ./startServer.sh
+
3. run dummies (written in Jason)
ant -f dummies.xml
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-27 13:25:42
|
Revision: 1270
http://jason.svn.sourceforge.net/jason/?rev=1270&view=rev
Author: jomifred
Date: 2008-04-27 06:25:39 -0700 (Sun, 27 Apr 2008)
Log Message:
-----------
Jason team: implement some changes as discussed with Rafael
Modified Paths:
--------------
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/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/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/env/WorldView.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
trunk/applications/jason-team/src/team-os.xml
Modified: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/dummies.xml 2008-04-27 13:25:39 UTC (rev 1270)
@@ -30,7 +30,6 @@
<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>
Modified: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/gauchos.xml 2008-04-27 13:25:39 UTC (rev 1270)
@@ -30,7 +30,6 @@
<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>
Modified: trunk/applications/jason-team/src/asl/dummy.asl
===================================================================
--- trunk/applications/jason-team/src/asl/dummy.asl 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/asl/dummy.asl 2008-04-27 13:25:39 UTC (rev 1270)
@@ -30,7 +30,8 @@
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).
+ not jia.obstacle(X,Y) &
+ not cell(X,Y,_).
/* -- initial goal */
@@ -47,7 +48,7 @@
// revise target each 4 steps
+pos(Step,_,_) // new cycle
- : Step mod 10 == 0
+ : Step mod 6 == 0
<- !decide_target.
@@ -66,7 +67,6 @@
-+target(X,Y).
+!decide_target // chose a new random pos
- : not cell(_,_,cow(_))
<- ?random_pos(NX,NY);
.print("New random target: ",NX,",",NY);
-+goal(search);
Modified: trunk/applications/jason-team/src/asl/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-04-27 13:25:39 UTC (rev 1270)
@@ -3,11 +3,6 @@
/* -- initial beliefs -- */
-// missions I can commit to depend on the roles I adopt
-desired_mission(explore_sch, explore) :- desired_role(exploration_grp, explorer).
-desired_mission(explore_sch, scout) :- desired_role(exploration_grp, scouter).
-
-
/* -- initial goals -- */
//!test.
@@ -19,11 +14,10 @@
*/
-/* plans for agent 1 */
+/* plans for the team's groups creation */
-+gsize(_Weight,_Height) // new match has started
- : .my_name(gaucho1) // agent 1 is responsible for the team creation
- <- //.print("oooo creating team group");
++!create_team_group
+ <- .print("oooo creating team group");
.if( group(team,Old), {
jmoise.remove_group(Old)
});
@@ -31,13 +25,13 @@
+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
+ <- jmoise.create_group(exploration_grp,GId);
+ jmoise.create_group(exploration_grp,GId);
+ jmoise.create_group(exploration_grp,GId).
++group(exploration_grp,_) // compute the area of the groups
: .my_name(gaucho1) &
- .findall(GId, group(exploration,GId), LG) &
- LG = [G1,G2,G3] // there are three groups
+ .findall(GId, group(exploration_grp,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));
@@ -51,24 +45,28 @@
/* plans for agents with odd id */
-+gsize(_,_)
++gsize(_,_) // new match has started
: .my_name(Me) &
agent_id(Me,AgId) &
AgId mod 2 == 1 // I have an odd Id
- <- .print("ooo Recruiting scouters for my explorer group....");
+ <- .if( .my_name(gaucho1), {
+ !create_team_group
+ });
+ .print("ooo Recruiting scouters for my explorer group....");
+
// wait my pos
?pos(MyX,MyY,_);
// wait others pos
- .while( .count(cell(_,_,ally(_)), N) & N < 5, {
+ .while( .count(ally_pos(_,_,_), N) & N < 5, {
.print("ooo waiting others pos ");
- .wait("+cell(_,_,ally(_))", 500, nofail)
+ .wait("+ally_pos(_,_,_)", 500, nofail)
});
// find distance to even agents
.findall(ag_d(D,AgName),
- cell(X,Y,ally(AgName)) & agent_id(AgName,Id) & Id mod 2 == 0 & jia.dist(MyX, MyY, X, Y, D),
+ ally_pos(AgName,X,Y) & agent_id(AgName,Id) & Id mod 2 == 0 & jia.dist(MyX, MyY, X, Y, D),
LOdd);
.sort(LOdd, LSOdd);
@@ -78,15 +76,13 @@
// adopt role explorer in the group
jmoise.adopt_role(explorer,G);
- +desired_role(exploration_grp, explorer); // needed for moise-common plans
- +desired_role(herding_grp, herder); // explorers will also be herders
!find_scouter(LSOdd, G).
+!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,exploration_grp));
+ .send(AgName, achieve, play_role(scouter,GId));
.wait("+play(Ag,scouter,GId)",2000).
-!find_scouter([_|LSOdd],GId) // in case the wait fails, try next agent
<- .print("ooo find_scouter failure, try another agent.");
@@ -96,23 +92,9 @@
+play(Ag,explorer,G)
: .my_name(Ag) &
not scheme_group(_,G)
- <- jmoise.create_scheme(exploring, [G]).
+ <- jmoise.create_scheme(explore_sch, [G]).
-/* plans for the others */
-
-+!play_role(Role,Group,Group_Spec)[source(Ag)]
- <- .print("ooo Adopting role ",Role,", asked by ",Ag);
- jmoise.adopt_role(Role, Group);
- +desired_role(Group_Spec, Role).
-
-// to keep plan above generic...
-// scouters will be herdboys
-// and need to tell t
-+desired_role(exploration_grp, scouter)
- <- +desired_role(herding_grp, herdboy).
-
-
/* -- plans for the goals of role explorer -- */
// TODO: make a pattern for organisational maintainance goal
@@ -120,7 +102,7 @@
+!goto_near_unvisited[scheme(Sch)]
<- .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
+ ?play(Me,explorer,GroupId); // get the group where I play explorer
?group_area(_,GroupId, Area); // get the area of this group
?pos(MeX, MeY, _); // get my location
jia.near_least_visited(MeX, MeY, Area, TargetX, TargetY);
@@ -143,17 +125,3 @@
.wait("+pos(_,_,_)"); // wait next cycle
!!follow_leader[scheme(Sch)].
-/* -- plans for the goals of all roles -- */
-
-+!share_seen_cows[scheme(Sch)]
- <- .print("ooo I should share cows!");
- ?cows_to_inform(C);
- jmoise.broadcast(Sch, tell, C);
- .wait("+pos(_,_,_)"); // wait next cycle
- !!share_seen_cows[scheme(Sch)].
-
-+cell(X,Y,cow(Id))
- <- +cow(Id,X,Y); //Jomi, tu nao vai gostar disso :D
- ?cows_to_inform(C);
- -+cows_to_inform([cow(Id,X,Y)|C]).
-
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-04-27 13:25:39 UTC (rev 1270)
@@ -44,7 +44,7 @@
+?group_area(Id,G,A) <- .wait("+group_area(Id,G,A)").
+end_of_simulation(_Result)
- <- .abolish(area(_,_,_,_,_,_)).
+ <- .abolish(group_area(_,_,_)).
+!restart
<- .print("*** restart ***");
@@ -53,10 +53,79 @@
// 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
++?my_group_players(G,R)
+ <- .my_name(Me);
+ play(Me,R,Gid);
+ .findall(P, play(P,_,Gid), G).
+
++!play_role(Role,Group)[source(Ag)]
+ : .my_name(Me) & not play(Me,_,_) // I can not play more than one role
+ <- .print("ooo Adopting role ",Role,", asked by ",Ag);
+ jmoise.adopt_role(Role, Group).
++!play_role(Role,Group)[source(Ag)]
+ <- .print("ooo Can NOT adopt role ",Role,", asked by ",Ag).
+
+/*
+
+TODO: use a list given by BUF
+
++!share_seen_cows[scheme(Sch)]
+ <- .print("ooo I should share cows!");
+ ?cows_to_inform(C);
+ jmoise.broadcast(Sch, tell, C);
+ // TODO: limpar -+cows_to_inform([])
+ .wait("+pos(_,_,_)"); // wait next cycle
+ !!share_seen_cows[scheme(Sch)].
+
++?cows_to_inform([]).
+
++cell(X,Y,cow(Id))
+ <- +cow(Id,X,Y); //Jomi, tu nao vai gostar disso :D
+ ?cows_to_inform(C);
+ -+cows_to_inform([cow(Id,X,Y)|C]).
+
+*/
+
++!share_seen_cows.
+
+// simple implementation of share_cows (see TODO above)
++cell(X,Y,cow(_))
+ : .my_name(Me) & play(Me,_,Gr)
+ <- C = cow(X,Y);
+ +C;
+ jmoise.broadcast(Gr, tell, C).
+-cell(X,Y,cow(_))
+ : .my_name(Me) & play(Me,_,Gr)
+ <- C = cow(X,Y);
+ -C;
+ jmoise.broadcast(Gr, untell, C).
+
+
+
+/* -- general organisational plans -- */
+
+// when I have an obligation or permission to a mission, commit to it
++obligation(Sch, Mission)
+ <- jmoise.commit_mission(Mission,Sch).
++permission(Sch, Mission)
+ <- jmoise.commit_mission(Mission,Sch).
+
+// if some scheme is finished, drop all intentions related to it.
+-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
{ include("exploration.asl") } // include plans for exploration
{ include("herding.asl") } // include plans for herding
-{ include("moise-common.asl") } // include common plans for MOISE+ agents
+// { include("moise-common.asl") } // include common plans for MOISE+ agents
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-04-27 13:25:39 UTC (rev 1270)
@@ -2,11 +2,7 @@
/* -- initial beliefs -- */
-// missions I can commit to
-desired_mission(herd_sch, herd) :- desired_role(herding_grp, herder).
-desired_mission(herd_sch, help_herder) :- desired_role(herding_grp, herdboy).
-
/* -- plans for the goals of role herder -- */
+!recruit[scheme(Sch)]
@@ -26,15 +22,6 @@
.wait("+pos(_,_,_)"); // wait next cycle
!!define_formation[scheme(Sch)].
-// get the list G of participants of the group where I play R
-+?my_group(G,R)
- <- .my_name(Me);
- play(Me,R,Gid);
- .findall(P, play(P,_,Gid), G);
- +my_group(G,R).
-// TODO, IMPORTANT: Quando tiver mudanca no grupo, apagar essa crenca
-// pra deixar esse plano rodar de novo.
-
+!alloc_all([],LA).
+!alloc_all([HA|TA],LA)
<- !find_closest(HA,LA,pos(X,Y),NLA);
@@ -42,21 +29,20 @@
-+alloc_target(HA,Alloc);
!alloc_all(TA,NLA).
-+!find_closest(Ag, List, Alloc, Rest)
- <- ?alloc_target(Ag,pos(X,Y));
++!find_closest(Ag, List, Alloc, Rest) // rule
+ <- ?ally_pos(Ag,XY);
!closest(List,[],Sorted,pos(X,Y),9999);
Sorted = [Alloc|Rest];
.print("FIND CLOSEST: ",Sorted).
-
+// TODO: use min
+!closest([],S,S,P,D).
+!closest([pos(XH,YH)|T],Aux,S,pos(XP,YP),LD)
- : jia.dist(XH,YH,XP,YP,D) & D < LD
+ : jia.dist(XH,YH,XP,YP,D) & D < LD // usar A*
<- !closest(T,[pos(XH,YH)|Aux],S,pos(XP,YP),D).
+!closest([pos(XH,YH)|T],Aux,S,pos(XP,YP),LD)
<- .concat(Aux,[pos(XH,YH)],Aux2);
!closest(T,Aux2,S,pos(XP,YP),LD).
-+?alloc_target(Ag,X,Y) <- .send(Ag, askOne, pos(X,Y,_), pos(X,Y,_)).
/* -- plans for the goals of all roles (herder and herdboy) -- */
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -46,15 +46,15 @@
String password = stts.getUserParameter("password");
if (password.startsWith("\"")) password = password.substring(1,password.length()-1);
+ waitSleepThread = new WaitSleep();
+ waitSleepThread.start();
+
proxy = new ACProxy( this,
stts.getUserParameter("host"),
Integer.parseInt(stts.getUserParameter("port")),
username,
password);
new Thread(proxy,"AgentProxy"+username).start();
-
- waitSleepThread = new WaitSleep();
- waitSleepThread.start();
}
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -152,9 +152,7 @@
// add location in perception
Literal lpos = new Literal("pos");
- lpos.addTerm(new NumberTermImpl(agx));
- lpos.addTerm(new NumberTermImpl(agy));
- lpos.addTerm(new NumberTermImpl(step));
+ lpos.addTerms(new NumberTermImpl(agx), new NumberTermImpl(agy), new NumberTermImpl(step));
percepts.add(lpos);
arq.initKnownCows();
Modified: trunk/applications/jason-team/src/java/arch/CowboyArch.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -9,7 +9,6 @@
import jason.asSyntax.Literal;
import jason.asSyntax.NumberTerm;
import jason.asSyntax.NumberTermImpl;
-import jason.asSyntax.Structure;
import jason.asSyntax.Term;
import jason.environment.grid.Location;
import jason.mas2j.ClassParameters;
@@ -237,9 +236,9 @@
public static Literal createCellPerception(int x, int y, Term obj) {
Literal l = new Literal("cell");
- l.addTerm(new NumberTermImpl(x));
- l.addTerm(new NumberTermImpl(y));
- l.addTerm(obj);
+ l.addTerms(new NumberTermImpl(x),
+ new NumberTermImpl(y),
+ obj);
return l;
}
@@ -358,9 +357,9 @@
if (acView != null) acView.getModel().setAgPos(agid, x, y);
model.incVisited(x, y);
//getTS().getAg().getLogger().info("ag pos "+getMinerId(m.getSender())+" = "+x+","+y);
- Structure tAlly = new Structure("ally");
- tAlly.addTerm(new Atom(m.getSender()));
- getTS().getAg().addBel( createCellPerception(x, y, tAlly));
+ Literal tAlly = new Literal("ally_pos");
+ tAlly.addTerms(new Atom(m.getSender()), new NumberTermImpl(x), new NumberTermImpl(y));
+ getTS().getAg().addBel( tAlly );
} catch (Exception e) {
e.printStackTrace();
}
Modified: trunk/applications/jason-team/src/java/env/WorldView.java
===================================================================
--- trunk/applications/jason-team/src/java/env/WorldView.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/env/WorldView.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -6,6 +6,8 @@
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
@@ -27,7 +29,7 @@
JLabel jCycle;
JLabel jCowsC;
- //JLabel jlMouseLoc;
+ JLabel jlMouseLoc;
//JComboBox scenarios;
//JSlider jSpeed;
@@ -96,16 +98,15 @@
msg.setBorder(BorderFactory.createEtchedBorder());
+ JPanel pmoise = new JPanel(new FlowLayout(FlowLayout.CENTER));
+ //p.add(new JLabel("Click on the cells to add new pieces of gold."));
+ //pmoise.add(new JLabel(" (mouse at:"));
+ jlMouseLoc = new JLabel("0,0");
+ pmoise.add(jlMouseLoc);
+ pmoise.setBorder(BorderFactory.createEtchedBorder());
+ //msg.add(p);
+
JPanel p = new JPanel(new FlowLayout(FlowLayout.CENTER));
- /*
- p.add(new JLabel("Click on the cells to add new pieces of gold."));
- p.add(new JLabel(" (mouse at:"));
- jlMouseLoc = new JLabel("0,0)");
- p.add(jlMouseLoc);
- msg.add(p);
- */
-
- p = new JPanel(new FlowLayout(FlowLayout.CENTER));
p.add(new JLabel("Cycle:"));
jCycle = new JLabel("0");
p.add(jCycle);
@@ -119,6 +120,7 @@
JPanel s = new JPanel(new BorderLayout());
s.add(BorderLayout.WEST, args);
s.add(BorderLayout.CENTER, msg);
+ s.add(BorderLayout.EAST, pmoise);
getContentPane().add(BorderLayout.SOUTH, s);
// Events handling
@@ -160,18 +162,16 @@
});
*/
- /*
getCanvas().addMouseMotionListener(new MouseMotionListener() {
public void mouseDragged(MouseEvent e) { }
public void mouseMoved(MouseEvent e) {
int col = e.getX() / cellSizeW;
int lin = e.getY() / cellSizeH;
if (col >= 0 && lin >= 0 && col < getModel().getWidth() && lin < getModel().getHeight()) {
- jlMouseLoc.setText(col+","+lin+")");
+ jlMouseLoc.setText(col+","+lin);
}
}
});
- */
}
/*
Modified: trunk/applications/jason-team/src/java/jia/Vec.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/Vec.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/jia/Vec.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -54,6 +54,16 @@
while (t < 0) t = t + PI2;
return new Vec(r*Math.cos(t), r*Math.sin(t));
}
+
+ /** turn the vec to 90 degrees clockwise */
+ public Vec turn90CW() {
+ return new Vec(y, -x);
+ }
+ /** turn the vec to 90 degrees anticlockwise */
+ public Vec turn90ACW() {
+ return new Vec(-y, x);
+ }
+
public Vec newMagnitude(double r) {
return new Vec(r*Math.cos(t), r*Math.sin(t));
}
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:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -83,8 +83,7 @@
ListTerm tail = r;
for (Location l: locs) {
Structure p = new Structure("pos",2);
- p.addTerm(new NumberTermImpl(l.x));
- p.addTerm(new NumberTermImpl(l.y));
+ p.addTerms(new NumberTermImpl(l.x), new NumberTermImpl(l.y));
tail = tail.append(p);
}
return un.unifies(args[1], r);
@@ -103,9 +102,10 @@
List<Location> locs = formationPlaces(model, formation);
if (locs != null) {
for (Location l : locs) {
- r = l;
if (ag.equals(l) || // I am there
- !model.hasObject(WorldModel.AGENT, l)) { // no one else is there
+ //model.countObjInArea(WorldModel.AGENT, l, 1) == 0) { // no one else is there
+ !model.hasObject(WorldModel.AGENT, l)) {
+ r = l;
break;
}
}
@@ -153,14 +153,20 @@
int initAgTS = 1;
for (int dist: formation.getDistances()) { // 2, -2, 6, -6, ....
Vec agTarget = agsTarget;
- Location l = agTarget.add(mean).getLocation(model);
+ //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 = new Vec( -agTarget.y, agTarget.x);
+ agTarget = agTarget.turn90CW();
else
- agTarget = new Vec( agTarget.y, -agTarget.x);
+ agTarget = agTarget.turn90ACW();
+ Location l = findFirstFreeLocTowardsTarget(agTarget, mean.add(agsTarget), initAgTS, dist, model);
+ System.out.println(" = "+dist+" result "+l);
+ if (l != null)
+ r.add(pathToNearCow(model, l));
+
+ /*
Location lastloc = null;
boolean uselast = false;
for (int agTargetSize = initAgTS; agTargetSize <= Math.abs(dist); agTargetSize++) {
@@ -175,13 +181,29 @@
}
if (!uselast)
r.add(pathToNearCow(model, l));
+ */
+
if (dist < 0)
initAgTS = Math.abs(dist)+1;
}
- //System.out.println("all places "+r);
+ System.out.println("all places "+r);
return r;
}
+ private Location findFirstFreeLocTowardsTarget(Vec target, Vec ref, int initialSize, int maxSize, LocalWorldModel 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)
+ return lastloc;
+ lastloc = l;
+ }
+ return l; //ref.getLocation(model); //target.add(ref).getLocation(model);
+ }
+
private Location pathToNearCow(LocalWorldModel model, Location t) {
Location near = null;
for (Location c: model.getCows()) {
@@ -194,7 +216,7 @@
//System.out.println("Near cow to "+t+" is "+near+" vec = "+dircow);
for (int s = 1; s <= 20; s++) {
Location l = dircow.newMagnitude(s).add(nearcv).getLocation(model);
- if (model.isFree(l))
+ if (!model.hasObject(WorldModel.COW,l))
return l;
}
}
Modified: trunk/applications/jason-team/src/java/test/TestBasicHerding.java
===================================================================
--- trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-04-27 13:25:39 UTC (rev 1270)
@@ -152,17 +152,32 @@
assertEquals(new Location(6,38), byIA);
byIA = new herd_position().getAgTarget(model, Formation.six, cowboy.getLocation(model));
- assertEquals(new Location(5,38), byIA);
+ assertEquals(new Location(6,39), byIA);
+ // add an agent in 6,39
+ model.add(WorldModel.AGENT, 6,39);
+ byIA = new herd_position().getAgTarget(model, Formation.six, cowboy.getLocation(model));
+ assertEquals(new Location(5,38), byIA);
+
// add an agent in 5,38
model.add(WorldModel.AGENT, 5,38);
- byIA = new herd_position().getAgTarget(model, Formation.six, cowboy.getLocation(model));
+ byIA = new herd_position().getAgTarget(model, Formation.six,cowboy.getLocation(model));
assertEquals(new Location(7,42), byIA);
- // add an agent in 7,42
+ // add an agent in 7,42
model.add(WorldModel.AGENT, 7,42);
byIA = new herd_position().getAgTarget(model, Formation.six,cowboy.getLocation(model));
- assertEquals(new Location(8,42), byIA);
+ assertEquals(new Location(4,38), byIA);
+
+ // add an agent in 4,38
+ model.add(WorldModel.AGENT, 4,38);
+ byIA = new herd_position().getAgTarget(model, Formation.six,cowboy.getLocation(model));
+ assertEquals(null, byIA);
+
+ // 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);
}
@Test
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-04-27 13:24:01 UTC (rev 1269)
+++ trunk/applications/jason-team/src/team-os.xml 2008-04-27 13:25:39 UTC (rev 1270)
@@ -108,10 +108,10 @@
</functional-specification>
<deontic-specification>
- <deontic-relation type="obligation" role="explorer" mission="mexplore" />
- <deontic-relation type="obligation" role="scouter" mission="mscout" />
- <deontic-relation type="obligation" role="herder" mission="mherd" />
- <deontic-relation type="obligation" role="herdboy" mission="mhelp_herder" />
+ <deontic-relation type="obligation" role="explorer" mission="explore" />
+ <deontic-relation type="obligation" role="scouter" mission="scout" />
+ <deontic-relation type="obligation" role="herder" mission="herd" />
+ <deontic-relation type="obligation" role="herdboy" mission="help_herder" />
</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-29 21:04:10
|
Revision: 1278
http://jason.svn.sourceforge.net/jason/?rev=1278&view=rev
Author: jomifred
Date: 2008-04-29 14:03:59 -0700 (Tue, 29 Apr 2008)
Log Message:
-----------
add ant for the official team
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-Dummies.mas2j
trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
trunk/applications/jason-team/src/java/jia/Search.java
Added Paths:
-----------
trunk/applications/jason-team/contest.xml
Modified: trunk/applications/jason-team/AC-Local-Dummies.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-04-28 20:54:41 UTC (rev 1277)
+++ trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-04-29 21:03:59 UTC (rev 1278)
@@ -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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,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(_,_,_,_)","pratio(_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","cell(_,_,key)","corral(_,_,_,_)");
aslSourcePath: "src/asl";
}
Added: trunk/applications/jason-team/contest.xml
===================================================================
--- trunk/applications/jason-team/contest.xml (rev 0)
+++ trunk/applications/jason-team/contest.xml 2008-04-29 21:03:59 UTC (rev 1278)
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!--
+
+ This file was generated by Jason 1.1
+ http://jason.sf.net
+
+ April 10, 2008 - 23:19:55
+-->
+
+<project name ="jason_team"
+ basedir="."
+ default="run">
+
+ <property name="mas2j.project.file" value="AC-official.mas2j"/>
+ <property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
+ <property name="build.dir" value="${basedir}/bin/classes" />
+
+ <property name="jasonJar" value="../../lib/jason.jar"/>
+
+ <path id="project.classpath">
+ <pathelement location="${basedir}"/>
+ <pathelement location="${build.dir}"/>
+ <pathelement location="${jasonJar}"/>
+ <fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
+
+ </path>
+
+ <!-- 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" />
+ </target>
+ <target name="user-end">
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build.dir}" />
+ <antcall target="user-init" />
+ </target>
+
+ <target name="compile" depends="init">
+ <condition property="srcdir" value="${basedir}/src/java" else="${basedir}" >
+ <available file="${basedir}/src/java" />
+ </condition>
+ <javac srcdir="${srcdir}" destdir="${build.dir}" debug="true" optimize="true" >
+ <classpath refid="project.classpath"/>
+ </javac>
+ </target>
+
+ <target name="run" depends="compile" >
+ <echo message="Running project ${ant.project.name}" />
+ <java classname="jason.infra.centralised.RunCentralisedMAS"
+ failonerror="true" fork="yes" dir="${basedir}" >
+ <classpath refid="project.classpath"/>
+ <arg line="${mas2j.project.file} ${debug} "/>
+ <jvmarg line="-Xmx750M"/>
+ </java>
+ <antcall target="user-end" />
+ </target>
+
+ <target name="clean" >
+ <delete failonerror="no" includeEmptyDirs="true" verbose="true">
+ <fileset dir="${basedir}" includes="**/*.class"/>
+ </delete>
+ </target>
+</project>
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-28 20:54:41 UTC (rev 1277)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-04-29 21:03:59 UTC (rev 1278)
@@ -23,30 +23,22 @@
*/
public class LocalWorldModel extends WorldModel {
- int[][] visited; // count the visited locations
- int minVisited = 0; // min value for near least visited
+ int[][] visited; // count the visited locations
+ int minVisited = 0; // min value for near least visited
- private Random random = new Random();
+ private Random random = new Random();
- Set<Vec> cows = new HashSet<Vec>();
- boolean isCowsUptodate = false;
+ Set<Vec> cows = new HashSet<Vec>();
+ boolean isCowsUptodate = false;
- int[][] cowsrep; // cows repulsion
- int[][] agsrep; // agents repulsion
- int[][] obsrep; // obstacle repulsion
+ int[][] cowsrep; // cows repulsion
+ int[][] agsrep; // agents repulsion
+ int[][] obsrep; // obstacle repulsion
- BeliefBase bb; // agent's BB
+ 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 LocalWorldModel(int w, int h) {
- // this(w, h, 6);
- //}
-
public LocalWorldModel(int w, int h, int nbAg, BeliefBase bb) {
super(w, h, nbAg);
this.bb = bb;
Modified: trunk/applications/jason-team/src/java/jia/Search.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/Search.java 2008-04-28 20:54:41 UTC (rev 1277)
+++ trunk/applications/jason-team/src/java/jia/Search.java 2008-04-29 21:03:59 UTC (rev 1278)
@@ -22,7 +22,7 @@
public static final int DIST_FOR_AG_OBSTACLE = 2;
- final LocalWorldModel model;
+ final LocalWorldModel model;
final Location from, to;
final boolean considerAgentsAsObstacles;
final boolean considerCorralAsObstacles;
@@ -69,6 +69,7 @@
}
this.maxDistFromCluster = 4;
+ model.getCows(); // to update the cows in model.
}
public void setMaxDistFromCluster(int m) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-04-29 21:13:18
|
Revision: 1279
http://jason.svn.sourceforge.net/jason/?rev=1279&view=rev
Author: jomifred
Date: 2008-04-29 14:13:16 -0700 (Tue, 29 Apr 2008)
Log Message:
-----------
fix ant scripts of jason team
Modified Paths:
--------------
trunk/applications/jason-team/contest.xml
trunk/applications/jason-team/dummies.xml
trunk/applications/jason-team/gauchos.xml
Modified: trunk/applications/jason-team/contest.xml
===================================================================
--- trunk/applications/jason-team/contest.xml 2008-04-29 21:03:59 UTC (rev 1278)
+++ trunk/applications/jason-team/contest.xml 2008-04-29 21:13:16 UTC (rev 1279)
@@ -12,7 +12,7 @@
basedir="."
default="run">
- <property name="mas2j.project.file" value="AC-official.mas2j"/>
+ <property name="mas2j.project.file" value="AC-jason-official.mas2j"/>
<property name="debug" value=""/> <!-- use "-debug" to run in debug mode -->
<property name="build.dir" value="${basedir}/bin/classes" />
@@ -23,13 +23,13 @@
<pathelement location="${build.dir}"/>
<pathelement location="${jasonJar}"/>
<fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
-
</path>
<!-- 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" />
+ <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
</target>
<target name="user-end">
</target>
Modified: trunk/applications/jason-team/dummies.xml
===================================================================
--- trunk/applications/jason-team/dummies.xml 2008-04-29 21:03:59 UTC (rev 1278)
+++ trunk/applications/jason-team/dummies.xml 2008-04-29 21:13:16 UTC (rev 1279)
@@ -23,13 +23,13 @@
<pathelement location="${build.dir}"/>
<pathelement location="${jasonJar}"/>
<fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
-
</path>
<!-- 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" />
+ <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-29 21:03:59 UTC (rev 1278)
+++ trunk/applications/jason-team/gauchos.xml 2008-04-29 21:13:16 UTC (rev 1279)
@@ -23,13 +23,13 @@
<pathelement location="${build.dir}"/>
<pathelement location="${jasonJar}"/>
<fileset dir="${basedir}/lib" > <include name="*.jar" /> </fileset>
-
</path>
<!-- 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" />
+ <ant antfile="../jason-moise/build.xml" target="jar" inheritall="false" />
</target>
<target name="user-end">
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-05-05 18:33:57
|
Revision: 1291
http://jason.svn.sourceforge.net/jason/?rev=1291&view=rev
Author: jomifred
Date: 2008-05-05 11:33:43 -0700 (Mon, 05 May 2008)
Log Message:
-----------
jason team: use target as "unique belief"
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-Dummies.mas2j
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/asl/goto.asl
trunk/applications/jason-team/src/asl/herding.asl
Modified: trunk/applications/jason-team/AC-Local-Dummies.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/AC-Local-Dummies.mas2j 2008-05-05 18:33:43 UTC (rev 1291)
@@ -15,32 +15,32 @@
host="localhost", port=12300, username=botagent1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
dummy2 dummy.asl
[host="localhost", port=12300, username=botagent2, password="2"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
dummy3 dummy.asl
[host="localhost", port=12300, username=botagent3, password="3"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
dummy4 dummy.asl
[host="localhost", port=12300, username=botagent4, password="4"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
dummy5 dummy.asl
[host="localhost", port=12300, username=botagent5, password="5"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
dummy6 dummy.asl
[host="localhost", port=12300, username=botagent6, password="6"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
aslSourcePath: "src/asl";
}
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-05 18:33:43 UTC (rev 1291)
@@ -18,32 +18,32 @@
host="localhost", port=12300, username=participant1, password="1"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
- beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
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(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
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(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
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(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
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(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
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(_,_,_,_)");
+ beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)", "target(_,_)");
directives: maintenance_goal = agent.OrgMaintenanceGoal;
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/readme.txt 2008-05-05 18:33:43 UTC (rev 1291)
@@ -12,18 +12,18 @@
To run this team:
-1. update sources of Jason and JMoise+
+1. update sources of Jason and JMoise+
cd Jason-svn
svn update
ant plugin
-
+
2. run massim-server
cd applications/jason-team/massim-server
- ./startServer.sh
-
- or some configuration for test
- ./startServerTest.sh conf/<some conf file>.xml
-
+ ./startServer.sh
+
+ or some configuration for test
+ ./startServerTest.sh conf/<some conf file>.xml
+
3. run dummies (written in Jason)
ant -f dummies.xml
@@ -32,12 +32,8 @@
./startAgents.sh
4. run Jason team
- a. by JasonIDE
- ../../bin/jason.sh
- open an run AC-Local-JasonTeam.mas2j
- b. by Ant
- ant -f gauchos.xml
+ ant -f gauchos.xml
5. start the simulation
go to shell running startServer.sh and press ENTER
@@ -45,13 +41,13 @@
6. you can get the agents location with the command
tail -f world-status.txt
-
- you can see the agent mind state with
-
- ant -f gauchos.xml mind-view
-
-7. to enable/disable the graphical view of some agent, add gui=yes
+ you can see the agent mind state with
+
+ ant -f gauchos.xml mind-view
+
+
+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/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-05 18:33:43 UTC (rev 1291)
@@ -64,10 +64,10 @@
// simple implementation of share_cows (see TODO above)
+cow(Id,X,Y)[source(percept)]
- : .desire(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
+ : .intend(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
<- jmoise.broadcast(Gr, tell, cow(Id,X,Y)).
-cow(Id,X,Y)[source(percept)]
- : .desire(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
+ : .intend(share_seen_cows) & .my_name(Me) & play(Me,_,Gr)
<- jmoise.broadcast(Gr, untell, cow(Id,X,Y)).
Modified: trunk/applications/jason-team/src/asl/goto.asl
===================================================================
--- trunk/applications/jason-team/src/asl/goto.asl 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/src/asl/goto.asl 2008-05-05 18:33:43 UTC (rev 1291)
@@ -24,8 +24,8 @@
-at_target;
!!move.
--target(_,_) // if I receive a message untell for my target, remove all target from BB
- <- .abolish(target(_,_)).
+//-target(_,_) // if I receive a message untell for my target, remove all target from BB
+// <- .abolish(target(_,_)).
// I still do not know my location
/*
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-04 21:50:33 UTC (rev 1290)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-05 18:33:43 UTC (rev 1291)
@@ -87,7 +87,7 @@
+!alloc_all([HA|TA],LA)
<- !find_closest(HA,LA,pos(X,Y),NLA);
.print("ooo Alocating position ",pos(X,Y)," to agent ",HA);
- .send(HA,untell,target(_,_));
+ //.send(HA,untell,target(_,_));
.send(HA,tell,target(X,Y));
//-+alloc_target(HA,Alloc);
!alloc_all(TA,NLA).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-05-24 17:09:52
|
Revision: 1302
http://jason.svn.sourceforge.net/jason/?rev=1302&view=rev
Author: jomifred
Date: 2008-05-24 10:09:49 -0700 (Sat, 24 May 2008)
Log Message:
-----------
jason team: fix bug broacast cows
Modified Paths:
--------------
trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/java/agent/UniqueBelsBB.java
Modified: trunk/applications/jason-team/AC-Local-JasonTeam.mas2j
===================================================================
--- trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-24 15:15:42 UTC (rev 1301)
+++ trunk/applications/jason-team/AC-Local-JasonTeam.mas2j 2008-05-24 17:09:49 UTC (rev 1302)
@@ -19,42 +19,42 @@
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
- "target(_,_)", "group_leader(key,_)", "cow(key,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(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,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(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,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(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,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(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,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(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,_,_)",
+ "target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
directives: maintenance_goal = agent.OrgMaintenanceGoal;
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-24 15:15:42 UTC (rev 1301)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-24 17:09:49 UTC (rev 1302)
@@ -43,6 +43,16 @@
!remove_org.
+!restart.
+
+/*
+se for impar
+ create_gr
+se for par
+ 1. tenta entrar explorer
+ 2.a tenta herding
+ 2.b no que tem o menor nro de vacas
+*/
+
//<- //.print("*** restart ***");
//.drop_all_desires;
//.abolish(cow(_,_,_)).
@@ -54,13 +64,16 @@
//+!share_seen_cows[scheme(Sch)] <- .print("ooo start sharing cows in scheme ",Sch); .suspend.
-// simple implementation of share_cows (see TODO above)
+// simple implementation of share_cows
+cow(Id,X,Y)[source(percept)]
- : .my_name(Me) & play(Me,_,Gr) // .intend(share_seen_cows)
- <- jmoise.broadcast(Gr, tell, cow(Id,X,Y)).
+ : .my_name(Me) & play(Me,_,Gr) & (play(Leader,explorer,Gr) | play(Leader,herder,Gr)) // .intend(share_seen_cows)
+ <- //.print("ooo broadcast ",cow(Id,X,Y));
+ //jmoise.broadcast(Gr, tell, cow(Id,X,Y)).
+ .send(Leader, tell, cow(Id,X,Y)).
-cow(Id,X,Y)[source(percept)]
- : .my_name(Me) & play(Me,_,Gr) // .intend(share_seen_cows)
- <- jmoise.broadcast(Gr, untell, cow(Id,X,Y)).
+ : .my_name(Me) & play(Me,_,Gr) & (play(Leader,explorer,Gr) | play(Leader,herder,Gr)) // .intend(share_seen_cows)
+ <- //jmoise.broadcast(Gr, untell, cow(Id,X,Y)).
+ .send(Leader, untell, cow(Id,X,Y)).
/* -- general organisational plans -- */
Modified: trunk/applications/jason-team/src/java/agent/UniqueBelsBB.java
===================================================================
--- trunk/applications/jason-team/src/java/agent/UniqueBelsBB.java 2008-05-24 15:15:42 UTC (rev 1301)
+++ trunk/applications/jason-team/src/java/agent/UniqueBelsBB.java 2008-05-24 17:09:49 UTC (rev 1302)
@@ -51,6 +51,9 @@
while (relevant.hasNext() && !remove) {
linbb = relevant.next();
+ // check equality of all terms that are "key"
+ // if some key is different, no problem
+ // otherwise, remove the current bel
boolean equals = true;
for (int i = 0; i<kbArity; i++) {
Term kbt = kb.getTerm(i);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-05-27 19:28:41
|
Revision: 1313
http://jason.svn.sourceforge.net/jason/?rev=1313&view=rev
Author: jomifred
Date: 2008-05-27 12:28:36 -0700 (Tue, 27 May 2008)
Log Message:
-----------
jason team: fix the bug in near unvisited that stop the agents sometimes
Modified Paths:
--------------
trunk/applications/jason-team/AC-jason-official.mas2j
trunk/applications/jason-team/src/asl/exploration.asl
trunk/applications/jason-team/src/asl/gaucho.asl
trunk/applications/jason-team/src/asl/goto.asl
trunk/applications/jason-team/src/asl/herding.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/jia/Search.java
trunk/applications/jason-team/src/java/jia/cluster.java
trunk/applications/jason-team/src/java/jia/herd_position.java
trunk/applications/jason-team/src/java/jia/near_least_visited.java
trunk/applications/jason-team/src/team-os.xml
Modified: trunk/applications/jason-team/AC-jason-official.mas2j
===================================================================
--- trunk/applications/jason-team/AC-jason-official.mas2j 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/AC-jason-official.mas2j 2008-05-27 19:28:36 UTC (rev 1313)
@@ -15,42 +15,42 @@
gaucho1 gaucho.asl
[verbose=1, gui=yes, write_status=yes, //ac_sim_back_dir="./massim-server/backup",
- host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason0", password="Pq600pXo"]
+ host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason0", password="Pq600pXo"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
gaucho2 gaucho.asl
- [verbose=1,host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason1", password="EjFlDB7U"]
+ [verbose=1,host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason1", password="EjFlDB7U"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
gaucho3 gaucho.asl
- [verbose=1,gui=no,host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason2", password="Jt9VNkUN"]
+ [verbose=1,gui=no,host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason2", password="Jt9VNkUN"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
gaucho4 gaucho.asl
- [verbose=1,host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason3", password="IzToicMA"]
+ [verbose=1,host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason3", password="IzToicMA"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
gaucho5 gaucho.asl
- [verbose=1,gui=no,host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason4", password="7dIx5Ioh"]
+ [verbose=1,gui=no,host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason4", password="7dIx5Ioh"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
"target(_,_)", "group_leader(key,_)", //"cow(key,_,_)",
"group_area(key, _)");
gaucho6 gaucho.asl
- [verbose=1,host="agentmaster.in.tu-clausthal.de", port=12300, username="Jason5", password="kd1u9HLi"]
+ [verbose=1,host="agentcontest1.in.tu-clausthal.de", port=12300, username="Jason5", password="kd1u9HLi"]
agentArchClass arch.ACArchitecture
agentClass agent.SelectEvent
beliefBaseClass agent.UniqueBelsBB("gsize(_,_)","steps(_)","ally_pos(key,_,_)","corral(_,_,_,_)",
Modified: trunk/applications/jason-team/src/asl/exploration.asl
===================================================================
--- trunk/applications/jason-team/src/asl/exploration.asl 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/asl/exploration.asl 2008-05-27 19:28:36 UTC (rev 1313)
@@ -78,7 +78,9 @@
!find_scouter([], G);
jmoise.set_goal_state(Sch, find_scouter, satisfied).
-
+-!find_scouter[scheme(Sch),group(G)]
+ <- .wait(1000); !find_scouter[scheme(Sch),group(G)].
+
+!find_scouter(_,G) // if someone plays scouter in my group, it is ok.
: play(_,scouter,G).
+!find_scouter([],G)
@@ -140,13 +142,43 @@
+!change_to_herding[scheme(Sch),mission(Mission)]
: cow(_,_,_)
<- .print("ooo I see some cows, create the herding group");
- !!create_herding_gr.
+ // check these cows are being herded by other group
+ .findall(L, group_leader(_,L),Leaders);
+ !ask_all_cows(Leaders,LCows);
+ .findall(cow(ID,X,Y), cow(ID,X,Y), MyCows);
+ .intersection(MyCows, LCows, Common);
+ .print("xxx all cows in herding groups are ",LCows," my are ",MyCows," intersection is ",Common);
+ if ( Common == [] ) {
+ .print("xxx start herding");
+ !!create_herding_gr
+ }{
+ !check_small_herd_grp(Leaders)
+ }.
+!change_to_herding[scheme(Sch),mission(Mission)].
{ end }
++!ask_all_cows([],[]).
++!ask_all_cows([L|Leaders],Cows)
+ <- .send(L,askAll,cow(_,_,_),LC);
+ .print("xxx cows from ",L," are ",LC);
+ !ask_all_cows(Leaders,RC);
+ .concat(LC,RC,Cows).
+
++!check_small_herd_grp([]).
++!check_small_herd_grp([L|Leaders])
+ <- .send(L,askAll,play(_, herdboy, _), LBoys);
+ .send(L,askOne,current_cluster(_),current_cluster(LCluster));
+ .print("xxx boys of ",L," are ",LBoys," his cluster size is ", .length(LCluster));
+ if (.length(LBoys) < 2 & .length(LCluster) > 10) {
+ .print("xxx start herding");
+ !!create_herding_gr
+ }{
+ !check_small_herd_grp(Leaders)
+ }.
+
/* -- plans for the goals of role scouter -- */
{ begin maintenance_goal("+pos(_,_,_)") }
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-27 19:28:36 UTC (rev 1313)
@@ -38,8 +38,7 @@
+?ally_pos(Name,X,Y) : .my_name(Name) <- ?pos(X,Y,_).
+corral(UpperLeftX,UpperLeftY,DownRightX,DownRightY)
- <- .print(UpperLeftX,UpperLeftY,DownRightX,DownRightY);
- -+corral_center( (UpperLeftX + DownRightX)/2, (UpperLeftY + DownRightY)/2).
+ <- -+corral_center( (UpperLeftX + DownRightX)/2, (UpperLeftY + DownRightY)/2).
+end_of_simulation(_Result)
@@ -52,7 +51,10 @@
: .my_name(Me) &
agent_id(Me,AgId) &
AgId mod 2 == 1 // I have an odd Id
- <- .print("*** restart -- odd ***");
+ <- .print("*** restart -- odd ***");
+ ?random_pos(X,Y);
+ +target(X,Y);
+ .wait("+at_target",10000,_);
!create_exploration_gr.
+!restart
<- .print("*** restart -- even ***");
@@ -68,7 +70,7 @@
.findall(GH, group(herding_grp,GH), LGH);
!try_adopt(herdboy,LGH)
}.
-
+
+!try_adopt(_Role,[]).
+!try_adopt(Role,[G|_])
<- .print("ooo try role ",Role, " in ",G);
@@ -136,8 +138,9 @@
!quite_all_missions_roles;
jmoise.adopt_role(NewRole,GT).
--!change_role(R,G)
- <- !change_role(R,G).
+// causes a loop:
+// -!change_role(R,G)
+// <- .wait(500); !change_role(R,G).
+!play_role(R,G)
: .my_name(Me) & play(Me,R,G).
Modified: trunk/applications/jason-team/src/asl/goto.asl
===================================================================
--- trunk/applications/jason-team/src/asl/goto.asl 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/asl/goto.asl 2008-05-27 19:28:36 UTC (rev 1313)
@@ -5,15 +5,14 @@
/* -- 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)
*/
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-27 19:28:36 UTC (rev 1313)
@@ -90,7 +90,17 @@
.wait(2000). // give some time for them to adopt the roles before check merging again
+!check_merge.
+{ begin maintenance_goal("+pos(_,_,_)") }
++!release_boys[scheme(Sch),mission(Mission),group(Gr)]
+ : .count(play(_,herdboy,Gr),N) & N > 4
+ <- .print("xxx release gaucho5 from my herding group");
+ .send(gaucho5,achieve,create_exploration_gr);
+ .send(gaucho6,achieve,restart).
++!release_boys[scheme(Sch),mission(Mission),group(Gr)].
+
+{ end }
+
{ begin maintenance_goal("+pos(_,_,_)") }
+!define_formation[scheme(Sch),mission(Mission)]
Modified: trunk/applications/jason-team/src/java/arch/ACArchitecture.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/arch/ACArchitecture.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -67,7 +67,7 @@
@Override
public List<Literal> perceive() {
- /* agDidPerceive(); // for crash control */
+ agDidPerceive(); // for crash control
return new ArrayList<Literal>(percepts); // it must be a copy!
}
Modified: trunk/applications/jason-team/src/java/arch/ACProxy.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/arch/ACProxy.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -185,14 +185,17 @@
}
} else if (type.getNodeName().equals("cow")) {
- int cowId = Integer.parseInt(type.getAttribute("ID"));
- Literal lc = new Literal("cow");
- lc.addTerms(new NumberTermImpl( cowId ), new NumberTermImpl( absx), new NumberTermImpl(absy));
- Structure stepannot = new Structure("step",1);
- stepannot.addTerm(new NumberTermImpl(step));
- lc.addAnnot(stepannot);
- percepts.add(lc);
- //arq.cowPerceived(absx, absy);
+ // ignore cows in the border, they complicate all :-)
+ if (absx < arq.getModel().getWidth()-1 && absx != 0 && absy != 00 && absy < arq.getModel().getHeight()-1) {
+ int cowId = Integer.parseInt(type.getAttribute("ID"));
+ Literal lc = new Literal("cow");
+ lc.addTerms(new NumberTermImpl( cowId ), new NumberTermImpl( absx), new NumberTermImpl(absy));
+ Structure stepannot = new Structure("step",1);
+ stepannot.addTerm(new NumberTermImpl(step));
+ lc.addAnnot(stepannot);
+ percepts.add(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-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/arch/CowboyArch.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -29,7 +29,7 @@
*
* @author Jomi
*/
-public class CowboyArch extends OrgAgent { //IdentifyCrashed {
+public class CowboyArch extends IdentifyCrashed { //IdentifyCrashed OrgAgent{
LocalWorldModel model = null;
WorldView view = null;
@@ -80,12 +80,10 @@
super.stopAg();
}
- /*
@Override
public boolean isCrashed() {
return playing && super.isCrashed();
}
- */
void setSimId(String id) {
simId = id;
@@ -380,3 +378,4 @@
}
}
+
Modified: trunk/applications/jason-team/src/java/arch/LocalWorldModel.java
===================================================================
--- trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/arch/LocalWorldModel.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -236,9 +236,12 @@
logger.info(line);
}
*/
+ Location better = null;
//int visitedTarget = 0;
- while (true) {
+ int loopcount = 0;
+ while (loopcount < 100) {
+ loopcount++;
int x = agloc.x;
int y = agloc.y;
@@ -246,9 +249,9 @@
int dx = 0;
int dy = 0;
int stage = 1;//(x % 2 == 0 ? 1 : 2);
- Location better = null;
-
+ better = null;
while (w < getWidth()) { //( (w/2+distanceToBorder) < getWidth()) {
+
switch (stage) {
case 1: if (dx < w) {
dx++;
@@ -300,6 +303,7 @@
}
minVisited++;
}
+ return better;
}
Modified: trunk/applications/jason-team/src/java/jia/Search.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/Search.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/jia/Search.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -188,8 +188,8 @@
if (ia.considerRepulsionForCows) {
// consider the cost of agents only if they are near
c += ia.model.getObsRep(pos.x, pos.y);
- if (ia.from.maxBorder(pos) <= ia.maxDistFromCluster)
- c += ia.model.getAgsRep(pos.x, pos.y);
+ //if (ia.from.maxBorder(pos) <= ia.maxDistFromCluster)
+ // c += ia.model.getAgsRep(pos.x, pos.y);
}
if (ia.considerEnemyCorralRepulsion)
Modified: trunk/applications/jason-team/src/java/jia/cluster.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/cluster.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/jia/cluster.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -29,7 +29,7 @@
*/
public class cluster extends DefaultInternalAction {
- private static final int MAXCLUSTERSIZE = 15;
+ private static final int MAXCLUSTERSIZE = 25;
@Override
public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
@@ -40,7 +40,7 @@
return false;
//Location agLoc = model.getAgPos(arch.getMyId());
- List<Location> locs = getCluster(model, WorldModel.cowPerceptionRatio);
+ List<Location> locs = getCluster(model, 3); //WorldModel.cowPerceptionRatio);
if (args.length == 1) {
return un.unifies(args[0], new ObjectTermImpl(locs));
@@ -95,7 +95,7 @@
Vec v = i.next();
Iterator<Vec> j = cs.iterator();
- while (j.hasNext()) {
+ while (j.hasNext() && cs.size() < MAXCLUSTERSIZE) {
Vec c = j.next();
if (c.sub(v).magnitude() < maxDist) {
cs.add(v);
Modified: trunk/applications/jason-team/src/java/jia/herd_position.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/herd_position.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/jia/herd_position.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -38,15 +38,15 @@
*/
public class herd_position extends DefaultInternalAction {
- public static final int agDistanceInFormation = 4;
+ public static final int agDistanceInFormation = 3;
public enum Formation {
one { Vec[] getDistances() { return new Vec[] { new Vec(0,0) }; } },
- two { Vec[] getDistances() { return new Vec[] { new Vec(sd,0), new Vec(-sd, 0) }; } },
+ two { Vec[] getDistances() { return new Vec[] { new Vec(sd+1,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, -3), new Vec(-(d+sd), -3) }; } },
+ four { Vec[] getDistances() { return new Vec[] { new Vec(sd+1,0), new Vec(-sd, 0), new Vec(d+sd, -3), new Vec(-(d+sd), -3) }; } },
five { Vec[] getDistances() { return new Vec[] { new Vec(0,0), new Vec(d, -1), new Vec(-d, -1), new Vec(d*2-1,-4), new Vec(-d*2,-4) }; } },
- six { Vec[] getDistances() { return new Vec[] { new Vec(sd,0), new Vec(-sd, 0), new Vec(d+sd, -3), new Vec(-(d+sd), -3), new Vec(d*2+sd-2, -6), new Vec(-(d*2+sd-2), -6) }; } };
+ six { Vec[] getDistances() { return new Vec[] { new Vec(sd+1,0), new Vec(-sd, 0), new Vec(d+sd, -3), new Vec(-(d+sd), -3), new Vec(d*2+sd-2, -6), new Vec(-(d*2+sd-2), -6) }; } };
abstract Vec[] getDistances();
private static final int d = agDistanceInFormation;
private static final int sd = agDistanceInFormation/2;
@@ -171,6 +171,7 @@
if (farcow == null || farcow.getLocation(model).maxBorder(model.getCorralCenter()) < c.getLocation(model).maxBorder(model.getCorralCenter()))
farcow = c;
+ //Collection<Vec> allcows = model.getCows();
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>();
@@ -181,7 +182,8 @@
if (l == null) {
l = model.nearFree(agsTarget.add(mean).getLocation(model), r);
} else {
- //l = pathToNearCow(l, clusterLocs);
+ if (clusterLocs.size() > 10)
+ l = pathToNearCow(l, clusterLocs);
if ( !model.inGrid(l) || model.hasObject(WorldModel.OBSTACLE, l) || r.contains(l))
l = model.nearFree(l, r);
}
@@ -212,10 +214,9 @@
return l;
}
- /*
- private Location pathToNearCow(Location t, List<Location> cluster) {
+ private Location pathToNearCow(Location t, List<Location> cows) {
Location near = null;
- for (Location c: cluster) {
+ for (Location c: cows) {
if (near == null || t.maxBorder(c) < t.maxBorder(near))
near = c;
}
@@ -231,7 +232,6 @@
}
return t;
}
- */
/*
public Location nearFreeForAg(LocalWorldModel model, Location ag, Location t) throws Exception {
Modified: trunk/applications/jason-team/src/java/jia/near_least_visited.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/near_least_visited.java 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/java/jia/near_least_visited.java 2008-05-27 19:28:36 UTC (rev 1313)
@@ -50,7 +50,9 @@
Location n = model.getNearLeastVisited(ag, tr, bl);
if (n != null) {
Search s = new Search(model, ag, n, ts.getUserAgArch());
- while (s.search() == null && ts.getUserAgArch().isRunning()) {
+ int loopcount = 0;
+ while (s.search() == null && ts.getUserAgArch().isRunning() && loopcount < 5) {
+ loopcount++;
// if search is null, it is impossible in the scenario to goto n, set it as obstacle
ts.getLogger().info("[near least unvisited] No possible path to "+n+" setting as obstacle.");
model.add(WorldModel.OBSTACLE, n);
Modified: trunk/applications/jason-team/src/team-os.xml
===================================================================
--- trunk/applications/jason-team/src/team-os.xml 2008-05-26 16:45:59 UTC (rev 1312)
+++ trunk/applications/jason-team/src/team-os.xml 2008-05-27 19:28:36 UTC (rev 1313)
@@ -105,6 +105,7 @@
<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="release_boys" ds="if the number of agents too much, release some boyd" 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"/>
@@ -114,6 +115,7 @@
<mission id="herd" min="1">
<goal id="recruit" />
+ <goal id="release_boys" />
<goal id="define_formation" />
<goal id="be_in_formation" />
<!--goal id="share_seen_cows" /-->
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jom...@us...> - 2008-05-29 07:05:22
|
Revision: 1315
http://jason.svn.sourceforge.net/jason/?rev=1315&view=rev
Author: jomifred
Date: 2008-05-29 00:05:19 -0700 (Thu, 29 May 2008)
Log Message:
-----------
jason team: fix minor issues in cluster alg.
Modified Paths:
--------------
trunk/applications/jason-team/gauchos.xml
trunk/applications/jason-team/readme.txt
trunk/applications/jason-team/src/asl/herding.asl
trunk/applications/jason-team/src/java/jia/cluster.java
trunk/applications/jason-team/src/java/test/TestBasicHerding.java
Modified: trunk/applications/jason-team/gauchos.xml
===================================================================
--- trunk/applications/jason-team/gauchos.xml 2008-05-28 20:05:55 UTC (rev 1314)
+++ trunk/applications/jason-team/gauchos.xml 2008-05-29 07:05:19 UTC (rev 1315)
@@ -115,7 +115,7 @@
<target name="clean" >
<delete failonerror="no" includeEmptyDirs="true" verbose="true">
- <fileset dir="${basedir}" includes="**/*.class"/>
+ <fileset dir="${basedir}/bin" includes="**/*.class"/>
</delete>
</target>
Modified: trunk/applications/jason-team/readme.txt
===================================================================
--- trunk/applications/jason-team/readme.txt 2008-05-28 20:05:55 UTC (rev 1314)
+++ trunk/applications/jason-team/readme.txt 2008-05-29 07:05:19 UTC (rev 1315)
@@ -5,7 +5,7 @@
*
* By
* Jomi F. Hubner (EMSE, France)
- * Rafael H. Bordini (Durhma, UK)
+ * Rafael H. Bordini (Durham, UK)
* Gauthier Picard (EMSE, France)
*/
Modified: trunk/applications/jason-team/src/asl/herding.asl
===================================================================
--- trunk/applications/jason-team/src/asl/herding.asl 2008-05-28 20:05:55 UTC (rev 1314)
+++ trunk/applications/jason-team/src/asl/herding.asl 2008-05-29 07:05:19 UTC (rev 1315)
@@ -82,7 +82,7 @@
//jia.path_length(TCX,TCY,CorralX,CorralY,TCD);
//.print("ooo check merging: my distance to corral = ",MCD," other group distance = ",TCD);
//if (MCD <= TCD) {
- .print("ooo Merging my herding group ",Gi," with ",Gj, " lead by ",L);
+ .print("ooo merging my herding group ",Gi," with ",Gj, " lead by ",L);
.send(L, achieve, change_role(herdboy,Gi))
//}
}
@@ -92,11 +92,36 @@
{ begin maintenance_goal("+pos(_,_,_)") }
-+!release_boys[scheme(Sch),mission(Mission),group(Gr)]
+/*+!release_boys[scheme(Sch),mission(Mission),group(Gr)]
: .count(play(_,herdboy,Gr),N) & N > 4
<- .print("xxx release gaucho5 from my herding group");
.send(gaucho5,achieve,create_exploration_gr);
.send(gaucho6,achieve,restart).
+ */
++!release_boys[scheme(Sch),mission(Mission),group(Gr)]
+ : .count(play(_,herdboy,Gr),N) &
+ (N > 3 | (N > 1 & current_cluster(CAsList) & .length(CAsList) < 5))
+
+ <- .print("xxx release an agent of my herding group");
+
+ // try an odd agent first
+ if (play(gaucho5,herdboy,Gr)) { // & agent_id(AgName,Id) & Id mod 2 == 1) {
+ .send(gaucho5,achieve,restart)
+ }{
+ if (play(gaucho6,herdboy,Gr)) { // & agent_id(AgName,Id) & Id mod 2 == 0) {
+ .send(gaucho6,achieve,restart)
+ }{
+ if (play(gaucho3,herdboy,Gr)) {
+ .send(gaucho3,achieve,restart)
+ }{
+ if (play(gaucho4,herdboy,Gr)) {
+ .send(gaucho4,achieve,restart)
+ }
+ }
+ }
+ };
+ .wait("+pos(_,_,_)"); // wait an extra step before try to release agents again
+ .wait("+pos(_,_,_)").
+!release_boys[scheme(Sch),mission(Mission),group(Gr)].
{ end }
Modified: trunk/applications/jason-team/src/java/jia/cluster.java
===================================================================
--- trunk/applications/jason-team/src/java/jia/cluster.java 2008-05-28 20:05:55 UTC (rev 1314)
+++ trunk/applications/jason-team/src/java/jia/cluster.java 2008-05-29 07:05:19 UTC (rev 1315)
@@ -13,13 +13,13 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import arch.CowboyArch;
import arch.LocalWorldModel;
+import busca.Nodo;
import env.WorldModel;
/**
@@ -29,7 +29,7 @@
*/
public class cluster extends DefaultInternalAction {
- private static final int MAXCLUSTERSIZE = 15;
+ public static final int MAXCLUSTERSIZE = 15;
@Override
public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception {
@@ -38,9 +38,8 @@
LocalWorldModel model = arch.getModel();
if (model == null)
return false;
- //Location agLoc = model.getAgPos(arch.getMyId());
- List<Location> locs = getCluster(model, 3); //WorldModel.cowPerceptionRatio);
+ List<Location> locs = getCluster(model, WorldModel.cowPerceptionRatio, arch);
if (args.length == 1) {
return un.unifies(args[0], new ObjectTermImpl(locs));
@@ -61,10 +60,10 @@
return false;
}
- public static List<Location> getCluster(LocalWorldModel model, int maxDist) {
+ public static List<Location> getCluster(LocalWorldModel model, int maxDist, CowboyArch arch) throws Exception {
/*
- Vs = set of all seen cows (sorted by distance to the centre of cluster)
- Cs = { the cow near to the center of Vs }
+ Vs = set of all seen cows
+ Cs = { the cow near to the corral }
add = true
while (add)
@@ -75,6 +74,29 @@
add = true
*/
Collection<Vec> cows = model.getCows();
+
+ // find cow near corral
+ Vec near = null;
+ int nearDist = 0;
+ for (Vec v: cows) {
+ // use A* to get the distance from this cow to corral
+ Nodo solution = new Search(model, v.getLocation(model), model.getCorralCenter(), arch).search();
+ if (solution != null) {
+ int d = solution.getProfundidade();
+ if (near == null || d < nearDist) {
+ near = v;
+ nearDist = d;
+ }
+ }
+ }
+
+ List<Vec> cs = new ArrayList<Vec>();
+ if (near != null) {
+ cs.add(near);
+ cows.remove(near);
+ }
+
+ /* OLD strategy
Vec mean = Vec.mean( cows );
List<Vec> vs = new ArrayList<Vec>();
// place all cows in ref to mean
@@ -83,15 +105,16 @@
if (vs.size() > 4)
Collections.sort(vs); // sort only big clusters (for small clusters, to sort causes a kind of oscillation)
-
- List<Vec> cs = new ArrayList<Vec>();
- if (!vs.isEmpty())
- cs.add(vs.remove(0));
+
+ if (!vs.isEmpty())
+ cs.add(vs.remove(0));
+ */
+
boolean add = true;
while (add) {
add = false;
- Iterator<Vec> i = vs.iterator();
+ Iterator<Vec> i = cows.iterator(); //vs.iterator();
while (i.hasNext()) {
Vec v = i.next();
@@ -114,9 +137,9 @@
List<Location> clusterLocs = new ArrayList<Location>();
for (Vec v: cs) {
// place all cows in ref to 0,0
- clusterLocs.add(v.add(mean).getLocation(model));
+ clusterLocs.add(v.getLocation(model));
+ //clusterLocs.add(v.add(mean).getLocation(model));
}
-
return clusterLocs;
}
Modified: trunk/applications/jason-team/src/java/test/TestBasicHerding.java
===================================================================
--- trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-05-28 20:05:55 UTC (rev 1314)
+++ trunk/applications/jason-team/src/java/test/TestBasicHerding.java 2008-05-29 07:05:19 UTC (rev 1315)
@@ -82,7 +82,7 @@
}
@Test
- public void bigCluster() {
+ public void bigCluster() throws Exception {
// big cluster
for (int x = 10; x < 30; x++) {
for (int y = 5; y < 20; y++) {
@@ -90,8 +90,8 @@
}
}
- List<Location> cowsl = cluster.getCluster(model, WorldModel.cowPerceptionRatio);
- assertEquals(model.getCows().size(), cowsl.size());
+ List<Location> cowsl = cluster.getCluster(model, WorldModel.cowPerceptionRatio, null);
+ assertEquals(cluster.MAXCLUSTERSIZE, cowsl.size());
}
private void addCowsToModel(Vec... cows) {
@@ -189,7 +189,7 @@
scenario1();
// find center/clusterise
- List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio);
+ List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio, null);
List<Vec> cowsl = cluster.location2vec(model, clusterLocs);
//Vec stddev = Vec.stddev(cowsl, Vec.mean(cowsl));
assertEquals(3, cowsl.size());
@@ -249,7 +249,7 @@
scenario2();
model.add(WorldModel.ENEMY, 11,48);
- List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio);
+ List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio, null);
List<Vec> cowsl = cluster.location2vec(model, clusterLocs);
assertEquals(9, cowsl.size());
@@ -270,7 +270,7 @@
public void formationSc3() throws Exception {
scenario3();
- List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio);
+ List<Location> clusterLocs = cluster.getCluster(model, WorldModel.cowPerceptionRatio, null);
assertEquals(6, clusterLocs.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-05-29 18:40:58
|
Revision: 1317
http://jason.svn.sourceforge.net/jason/?rev=1317&view=rev
Author: jomifred
Date: 2008-05-29 11:40:56 -0700 (Thu, 29 May 2008)
Log Message:
-----------
jason team: add some screen shots
Modified Paths:
--------------
trunk/applications/jason-team/src/asl/gaucho.asl
Added Paths:
-----------
trunk/applications/jason-team/screenshots/
trunk/applications/jason-team/screenshots/s1a.tiff
trunk/applications/jason-team/screenshots/s1b.txt
trunk/applications/jason-team/screenshots/s1c ag against their curral.txt
trunk/applications/jason-team/screenshots/s1d-full.tiff
trunk/applications/jason-team/screenshots/s2a-with-scheme-goals.tiff
trunk/applications/jason-team/screenshots/s2c-full.tiff
trunk/applications/jason-team/screenshots/s2d.tiff
trunk/applications/jason-team/screenshots/s2e -formation.tiff
trunk/applications/jason-team/screenshots/s3a.tiff
trunk/applications/jason-team/screenshots/s3b.tiff
trunk/applications/jason-team/screenshots/s3c got enemy.tiff
trunk/applications/jason-team/screenshots/s3d good moment.tiff
trunk/applications/jason-team/screenshots/s3e block.tiff
Added: trunk/applications/jason-team/screenshots/s1a.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s1a.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s1b.txt
===================================================================
--- trunk/applications/jason-team/screenshots/s1b.txt (rev 0)
+++ trunk/applications/jason-team/screenshots/s1b.txt 2008-05-29 18:40:56 UTC (rev 1317)
@@ -0,0 +1,79 @@
+|---------------------------------------------------------------------------------|
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| X XXXXXXXXX X |
+| X XXX XXX X |
+| XX XXX XXX XX |
+| XX XXX XXX XX |
+| XXX XXX XXX XXX |
+| XXXX XXX XXX XXXX |
+| XXXXXX XXXXXX |
+| X X |
+| XXXXXX X X XXXXXX |
+| X XXXXX XX XX XXXXX X |
+| XX XXXXXXXX XXXXXXXX XX |
+| X ------ XXXXXX X |
+| X ------ XXXXXX X |
+| X ------ XXXXXX X |
+| X c ------ XXXXXX X |
+| XX cc ------ XXXXXX XX |
+| XX ------ XXXXXX XX |
+| XX 1 XXX ------ XXXXXX XXX XX |
+| XX X ------ XXXXXX X XX |
+| X X |
+| X X |
+| c X X |
+| c X X 32 |
+| X X |
+| XX XX 6 |
+| c X X 4 |
+| X X |
+| XX XX |
+| X X |
+| XX XX |
+| X X |
+| XX X X XX |
+| X X X X |
+| XX XX XX XX |
+| X XXX XXX X |
+| X XXXX XXXX X |
+| X XXX XXX X |
+| X XX XX X |
+| XX XX |
+| X X X X |
+| X X |
+| XXX XXX XXX XXX |
+| X X |
+| XXXX XXXX |
+| X XXXXXXXXXX XX X |
+| XX X X XX |
+| XX XX |
+| XX XX X |
+| XXXX |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+| |
+|---------------------------------------------------------------------------------|
Added: trunk/applications/jason-team/screenshots/s1c ag against their curral.txt
===================================================================
--- trunk/applications/jason-team/screenshots/s1c ag against their curral.txt (rev 0)
+++ trunk/applications/jason-team/screenshots/s1c ag against their curral.txt 2008-05-29 18:40:56 UTC (rev 1317)
@@ -0,0 +1,64 @@
+| |
+| |
+| |
+| |
+| |
+| XXXXXXXXX |
+| XXX XXX |
+| X XXX XXX |
+| XX XXX XXX XX |
+| XXX XXX XXX XXX |
+| XXXX XXX XXX XXXX |
+| XXXXXX XXXXXX |
+| X X |
+| XXXXXX X X c XXXXXX |
+| X XXXXX XX XX c XXXXX X |
+| X XXXXXXXX XXXXXXXX XX |
+| X ------ XXXXXX X |
+| X ------ XXXXXX c X |
+| X ------ XXXXXX X |
+| X ------ XXXXXX X |
+| XX ------ XXXXXX 1 4 XX |
+| XX ------ XXXXXX E cE XX |
+| XX XXX ------ XXXXXX XXX 3 XX |
+| XX X ------ XXXXXX X XX |
+| X X |
+| X X c |
+| X X E |
+| X X |
+| X X |
+| XX XX |
+| X X |
+| X X |
+| X X |
+| X X |
+| X X |
+| XX XX |
+| XX XX |
+| X X |
+| XX XX |
+| X 2 X |
+| XX X X XX |
+| X X X X |
+| XX XX XX XX |
+| X XX XXX X |
+| X XXXX X |
+| X XXX X |
+| X XX X |
+| XX XX |
+| X X X X |
+| X X |
+| XXX XXX XXX |
+| X |
+| XXXX |
+| XXXXXXXXXX X |
+| X XX5 |
+| XX |
+| XXXX XX 6 |
+| XXXX |
+| |
+| |
+| |
+| |
+| |
+| |
Added: trunk/applications/jason-team/screenshots/s1d-full.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s1d-full.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s2a-with-scheme-goals.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s2a-with-scheme-goals.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s2c-full.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s2c-full.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s2d.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s2d.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s2e -formation.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s2e -formation.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s3a.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s3a.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s3b.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s3b.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s3c got enemy.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s3c got enemy.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s3d good moment.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s3d good moment.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/applications/jason-team/screenshots/s3e block.tiff
===================================================================
(Binary files differ)
Property changes on: trunk/applications/jason-team/screenshots/s3e block.tiff
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/applications/jason-team/src/asl/gaucho.asl
===================================================================
--- trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-29 11:49:16 UTC (rev 1316)
+++ trunk/applications/jason-team/src/asl/gaucho.asl 2008-05-29 18:40:56 UTC (rev 1317)
@@ -54,7 +54,7 @@
<- .print("*** restart -- odd ***");
?random_pos(X,Y);
+target(X,Y);
- .wait("+at_target",10000,_);
+ .wait("+at_target",1000,_);
!create_exploration_gr.
+!restart
<- .print("*** restart -- even ***");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|