|
From: <jom...@us...> - 2008-12-04 10:10:57
|
Revision: 1417
http://jason.svn.sourceforge.net/jason/?rev=1417&view=rev
Author: jomifred
Date: 2008-12-04 10:10:55 +0000 (Thu, 04 Dec 2008)
Log Message:
-----------
update getting started
Modified Paths:
--------------
trunk/doc/faq/faq.tex
trunk/doc/mini-tutorial/src/getting-started/Makefile
trunk/doc/mini-tutorial/src/getting-started/VacuumCleaning-1/VCWorld.java
trunk/doc/mini-tutorial/src/getting-started/getting-started.tex
trunk/examples/cleaning-robots/logging.properties
trunk/release-notes.txt
Modified: trunk/doc/faq/faq.tex
===================================================================
--- trunk/doc/faq/faq.tex 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/doc/faq/faq.tex 2008-12-04 10:10:55 UTC (rev 1417)
@@ -812,8 +812,88 @@
situations in which the agent can find itself when attempting to
achieve the goal.
+\subsection{Which information is available to failure handling plans ?}
+When a plan fails, the plan that handles the corresponding event (in the form
+\texttt{-!g}) may use failure information to provide a suitable solution. This
+information is provided by two means:
+\begin{description}
+\item[Internal actions:] the internal action \texttt{.current\_intention(I)}
+ unifies in \texttt{I} the stack of the current intention. By inspecting this
+ stack, the context of the failure can be discovered.
+ It follows an example of \texttt{I} (provided by the execution of the
+ example available in \texttt{demos/failure}):
+\begin{verbatim}
+intention(1,
+ [
+ im("l__6[source(self)]",[".current_intention(I)", .....]),
+ im("l__5[source(self)]",[".fail"]),
+ im("l__4[source(self)]",["!g5(X)[source(self)]",".print(endg4)"]),
+ im("l__3[source(self)]",["!g4(X)[source(self)]",".print(endg3)"]),
+ im("l__2[source(self)]",["!g3(X)[source(self)]",".print(endg2)"]),
+ im("l__1[source(self)]",["!g2(X)[source(self)]",".print(endg1)"]),
+ im("l__0[source(self)]",["!g1(X)[source(self)]",".print("End, X=",X)"])
+ ]
+)
+\end{verbatim}
+
+ You find more information in the documentation of the \htlink{current\_intention}{http://jason.sourceforge.net/api/classjason_1_1stdlib_1_1current__intention.html}.
+
+
+\item[Annotations:] every failure event is annotated with at least the
+ following information:
+ \begin{itemize}
+ \item \texttt{error(<atom: error id>)}: the identification of the type of
+ failure, values used by \Jason are
+ \begin{itemize}
+ \item \texttt{no\_applicable}: failure caused by no applicable plan
+ \item \texttt{no\_relevant}: failure caused by no relevant plan
+ \item \texttt{no\_option}: failure caused by no option being selected by
+ selectOption funtion
+ \item \texttt{constraint\_failed}: failure caused by a constraint in the
+ plan that is not satisfied
+ \item \texttt{ia\_failed}: failure caused by an error in an internal
+ action (it throws an exception or returned false)
+ \item \texttt{action\_failed}: the failure is caused by a failure in the
+ execution of an action in the environment
+ \item \texttt{ask\_failed}: the failure is caused by the lack of response
+ to an ask message
+ \item \texttt{wrong\_arguments}: failure caused by wrong number of type of
+ arguments given to an internal action
+ \item \texttt{unknown}: other causes.
+ \end{itemize}
+
+ \item \texttt{error\_msg(<string>)}: the human readable message of the error
+ \item \texttt{code(<literal>)}: the plan's body operator that failed
+ \item \texttt{code\_src(<string>)}: the file's name where the plan that
+ fails is defined
+ \item \texttt{code\_line(<int>)}: the line in the file
+ \end{itemize}
+
+ An example of failure event and its annotations:
+\begin{verbatim}
+-!g[error(ia_failed),
+ error_msg("internal action .my_name failed"),
+ code(".my_name(bob)"),
+ code_src("/tmp/x.asl"),
+ code_line(18)]
+\end{verbatim}
+
+ Note that the plan that handle this event is not obliged to use these
+ annotations, for example:
+\begin{verbatim}
+-!g[error(ia_failed)] <- ... plan to handle error of type \ia_failed' ....
+-!g[error(no_applicable)] <- ... plan to handle error of type 'no_applicable'
+-!g[code_src("/tmp/x.asl")] <- ... plan to handle error in plans of file x.asl
+\end{verbatim}
+
+ The internal actions defined by the user can add new annotations to indicate
+ particular types of errors (see the API documentation of \htlink{JasonException}{http://jason.sourceforge.net/api/classjason_1_1JasonException.html} for
+ more information about that).
+\end{description}
+
+
\section{Developing Jason}
\subsection{How to build \jason from SourceForge SVN (subversion)?}
Modified: trunk/doc/mini-tutorial/src/getting-started/Makefile
===================================================================
--- trunk/doc/mini-tutorial/src/getting-started/Makefile 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/doc/mini-tutorial/src/getting-started/Makefile 2008-12-04 10:10:55 UTC (rev 1417)
@@ -9,4 +9,4 @@
zip -r ../../getting-started/VacuumCleaning-1.zip VacuumCleaning-1/*.asl VacuumCleaning-1/*.mas2j VacuumCleaning-1/*.java
publish:
- scp ../../getting-started/* jom...@ss...:/home/groups/j/ja/jason/htdocs/mini-tutorial/getting-started
+ scp ../../getting-started/* jomifred,ja...@we...:/home/groups/j/ja/jason/htdocs/mini-tutorial/getting-started
Modified: trunk/doc/mini-tutorial/src/getting-started/VacuumCleaning-1/VCWorld.java
===================================================================
--- trunk/doc/mini-tutorial/src/getting-started/VacuumCleaning-1/VCWorld.java 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/doc/mini-tutorial/src/getting-started/VacuumCleaning-1/VCWorld.java 2008-12-04 10:10:55 UTC (rev 1417)
@@ -21,7 +21,7 @@
private int vcx = 0; // the vacuum cleaner location
private int vcy = 0;
- private boolean running = true;
+ private boolean running = true;
private HouseGUI gui = new HouseGUI();
@@ -31,8 +31,8 @@
createPercept();
gui.paint();
- // create a thread to add dirty
- new Thread() {
+ // create a thread to add dirty
+ new Thread() {
public void run() {
try {
while (running) {
@@ -46,8 +46,7 @@
}
} catch (Exception e) {}
}
- }.start();
-
+ }.start();
}
Random r = new Random();
@@ -57,12 +56,6 @@
// remove previous perception
clearPercepts();
- // add dirty first, it has priority
- if (dirty[vcx][vcy]) {
- addPercept(Literal.parseLiteral("dirty"));
- } else {
- addPercept(Literal.parseLiteral("clean"));
- }
if (vcx == 0 && vcy == 0) {
addPercept(Literal.parseLiteral("pos(1)"));
} else if (vcx == 1 && vcy == 0) {
@@ -72,14 +65,26 @@
} else if (vcx == 1 && vcy == 1) {
addPercept(Literal.parseLiteral("pos(4)"));
}
+
+ if (dirty[vcx][vcy]) {
+ addPercept(Literal.parseLiteral("dirty"));
+ } else {
+ addPercept(Literal.parseLiteral("clean"));
+ }
}
@Override
public boolean executeAction(String ag, Structure action) {
+
+ try { Thread.sleep(500);} catch (Exception e) {} //show down the execution
+
// Change the world model based on action
if (action.getFunctor().equals("suck")) {
if (dirty[vcx][vcy]) {
dirty[vcx][vcy] = false;
+ } else {
+ logger.info("suck in a clean location!");
+ Toolkit.getDefaultToolkit().beep();
}
} else if (action.getFunctor().equals("left")) {
if (vcx > 0) {
@@ -105,26 +110,25 @@
createPercept(); // update agents perception for the new world state
gui.paint();
- try { Thread.sleep(500);} catch (Exception e) {}
return true;
}
@Override
public void stop() {
- running = false;
- super.stop();
- gui.setVisible(false);
- }
+ running = false;
+ super.stop();
+ gui.setVisible(false);
+ }
/* a simple GUI */
- class HouseGUI extends JFrame {
+ class HouseGUI extends JFrame {
JLabel[][] labels;
HouseGUI() {
- super("Domestic Robot");
+ super("Domestic Robot");
labels = new JLabel[dirty.length][dirty.length];
- getContentPane().setLayout(new GridLayout(labels.length, labels.length));
+ getContentPane().setLayout(new GridLayout(labels.length, labels.length));
for (int j = 0; j < labels.length; j++) {
for (int i = 0; i < labels.length; i++) {
labels[i][j] = new JLabel();
@@ -133,14 +137,14 @@
labels[i][j].setBorder(new EtchedBorder());
getContentPane().add(labels[i][j]);
}
- }
- pack();
- setVisible(true);
- paint();
- }
+ }
+ pack();
+ setVisible(true);
+ paint();
+ }
- void paint() {
- for (int i = 0; i < labels.length; i++) {
+ void paint() {
+ for (int i = 0; i < labels.length; i++) {
for (int j = 0; j < labels.length; j++) {
String l = "<html><center>";
if (vcx == i && vcy == j) {
@@ -152,9 +156,8 @@
l += "</center></html>";
labels[i][j].setText(l);
}
- }
- }
- }
-
+ }
+ }
+ }
}
Modified: trunk/doc/mini-tutorial/src/getting-started/getting-started.tex
===================================================================
--- trunk/doc/mini-tutorial/src/getting-started/getting-started.tex 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/doc/mini-tutorial/src/getting-started/getting-started.tex 2008-12-04 10:10:55 UTC (rev 1417)
@@ -395,7 +395,7 @@
You will soon realise that this reactive approach has some limitation
-in defining a good behaviour for our vacuum clearer. In fact, this agent
+in defining a good behaviour for our vacuum cleaner. In fact, this agent
should be defined has having \emph{goals}, in particular, a persistent
goal of maintaining the house clean. The easiest way to define a
persistent goal is by a recursive plan; for example, the code below
Modified: trunk/examples/cleaning-robots/logging.properties
===================================================================
--- trunk/examples/cleaning-robots/logging.properties 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/examples/cleaning-robots/logging.properties 2008-12-04 10:10:55 UTC (rev 1417)
@@ -27,7 +27,7 @@
# Jason Handler parameters
jason.runtime.MASConsoleLogHandler.level = ALL
jason.runtime.MASConsoleLogHandler.formatter = jason.runtime.MASConsoleLogFormatter
-jason.runtime.MASConsoleLogHandler.tabbed = true
+jason.runtime.MASConsoleLogHandler.tabbed = false
# default file output is in project's directory.
java.util.logging.FileHandler.pattern = mas-%u.log
Modified: trunk/release-notes.txt
===================================================================
--- trunk/release-notes.txt 2008-11-27 18:40:36 UTC (rev 1416)
+++ trunk/release-notes.txt 2008-12-04 10:10:55 UTC (rev 1417)
@@ -6,12 +6,13 @@
. customised belief bases can be organised in a chain so
that several functionalities can be composed. For more
information
- see/run the demo/chain-bb
+ see the demo/chain-bb
see API doc of ChainBB and ChainBBAdapter
. annotations in failure events. All failure events are now
annotated with:
- error(<atom: error id>): values used by Jason are
+ error(<atom: error id>): the identification of the type of error,
+ values used by Jason are
no_applicable: no applicable plan
no_relevant: no relevant plan
no_option: no option selected
@@ -27,6 +28,7 @@
code_src(<string>): the file where the command is
code_line(<int>): the line in the file
see demo/failure for an example
+ see FAQ for more details
see code of JasonException and TS for more information
. the version of JADE is upgraded to 3.6
@@ -65,6 +67,7 @@
see discussion about the Literal class in the
jason-developers list.
+
-------------
version 1.1.2
-------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|