|
From: <jom...@us...> - 2015-08-04 12:47:39
|
Revision: 1843
http://sourceforge.net/p/jason/svn/1843
Author: jomifred
Date: 2015-08-04 12:47:36 +0000 (Tue, 04 Aug 2015)
Log Message:
-----------
improve mas console stability
Modified Paths:
--------------
trunk/README
trunk/doc/mini-tutorial/src/hello-bdi/index.org
trunk/release-notes.txt
trunk/src/jason/runtime/MASConsoleColorGUI.java
trunk/src/jason/runtime/MASConsoleGUI.java
Modified: trunk/README
===================================================================
--- trunk/README 2015-08-03 14:14:51 UTC (rev 1842)
+++ trunk/README 2015-08-04 12:47:36 UTC (rev 1843)
@@ -2,7 +2,7 @@
First release: December 2003.
Jason is distributed under LGPL (see file LICENSE).
-Java 1.5 is required to run this application, it is available
+Java 1.7 is required to run this application, it is available
at http://java.sun.com.
For more information, please read doc/index.html.
Modified: trunk/doc/mini-tutorial/src/hello-bdi/index.org
===================================================================
--- trunk/doc/mini-tutorial/src/hello-bdi/index.org 2015-08-03 14:14:51 UTC (rev 1842)
+++ trunk/doc/mini-tutorial/src/hello-bdi/index.org 2015-08-04 12:47:36 UTC (rev 1843)
@@ -14,7 +14,7 @@
This programming (mini) tutorial will illustrate how the BDI model is used in the [[http://jason.sf.net][Jason]] agent-oriented programming language. We start by a very simple agent code and progress exploring the BDI features of Jason.
-We assume that the reader knows the basic concepts of the BDI model (an introduction and further references are found at the [[http://en.wikipedia.org/wiki/Belief–desire–intention_software_model][Wikipedia]]). It is important to know these concepts to be a good Jason programmer, in the same way that knowing the concepts of and objects and classes is important for a Java programmer. Very briefly, in the BDI model the agent has /beliefs/ (based on what it perceives and communicates with other agents) that can produce /desires/ (states of the world that the agent wants to achieve). The agent /deliberates/ on its desires and decides to /commit/ to some (desires to which the agent is committed become /intentions/). The satisfy its intentions, the agent executes plans that lead to action. The behaviour of the agent (i.e., its actions) is thus explained/caused by what it intends (i.e., the desires it decided to pursue). An important feature of the model is that the agent should /react/ to changes in its environment as soon as possible while keeping its /pro-active/ (i.e., desires-oriented) behaviour. (Do not worry about all these high-level anthropomorphic concepts (in italics), we will try to keep the simplicity of usual hello world programs.)
+We assume that the reader knows the basic concepts of the BDI model (an introduction and further references are found at the [[http://en.wikipedia.org/wiki/Belief–desire–intention_software_model][Wikipedia]]). It is important to know these concepts to be a good Jason programmer, in the same way that knowing the concepts of and objects and classes is important for a Java programmer. Very briefly, in the BDI model the agent has /beliefs/ (based on what it perceives and communicates with other agents) that can produce /desires/ (states of the world that the agent wants to achieve). The agent /deliberates/ on its desires and decides to /commit/ to some (desires to which the agent is committed become /intentions/). The satisfy its intentions, the agent executes plans that lead to action. The behaviour of the agent (i.e., its actions) is thus explained/caused by what it intends (i.e., the desires it decided to pursue). An important feature of architectures that implement the BDI model is that the agent should /react/ to changes in its environment as soon as possible while keeping its /pro-active/ (i.e., desires-oriented) behaviour. (Do not worry about all these high-level anthropomorphic concepts (in italics), we will try to keep the simplicity of usual hello world programs.)
* Bob (the mentalist)
@@ -80,7 +80,7 @@
The first plan has a different kind of event: the agent has started to believe something (the belief that follows =+=). So when the agent starts believing that Bob is happy, the desire to say hello (=!say(hello)=) is created. In this case, the desire is the result of changes in the agent's beliefs. The agent starts believing something when, for instance, it perceives the state of the environment or receives a message from another agent.
-The second plan has also changed: (i) the agent will decide to pursue the desire to say something on days other than Monday; (ii) after printing the message, the desire is keept, producing a loop that will end on the next Monday. In other words, the intention to achieve =!say= does not finish because that intention itself creates a new desire =!say= (here also conveniently called sub-goal). Only when this sub-goal is achieved, the intention finishes (which never happens in the above plan).
+The second plan has also changed: (i) the agent will decide to pursue the desire to say something on days other than Monday; (ii) after printing the message, the desire is kept, producing a loop that will end on the next Monday. In other words, the intention to achieve =!say= does not finish because that intention itself creates a new desire =!say= (here also conveniently called sub-goal). Only when this sub-goal is achieved, the intention finishes (which never happens in the above plan).
If you run this program, nothing happens! Different from other languages where the programmer defines a sequence of operations, in Jason the programmer /declares/ plans and the order of execution depends on the order of the events that take place on a particular environment.
@@ -208,7 +208,7 @@
At this point of the tutorial, you could try to imagine how to program
this application using conventional languages like Java and C. Even
-actor-based langages, which are also oriented to events and great
+actor-based languages, which are also oriented to events and great
tools for concurrency, will not be so reactive as Jason.
* Bob (the revisionist)
Modified: trunk/release-notes.txt
===================================================================
--- trunk/release-notes.txt 2015-08-03 14:14:51 UTC (rev 1842)
+++ trunk/release-notes.txt 2015-08-04 12:47:36 UTC (rev 1843)
@@ -17,10 +17,13 @@
New internal actions:
-- .asserta: insert a belief (or rule) in the begin of the belief base (can be used in prolog like rules)
-- .assertz: insert a belief (or rule) in the end of the belief base (can be used in prolog like rules)
+- .asserta: inserts a belief (or rule) in the begin of the belief base (can be used in prolog like rules)
+- .assertz: inserts a belief (or rule) in the end of the belief base (can be used in prolog like rules)
+- .relevant_rules: gets rules with a specified head
+New Tutorial on BDI (see doc/index.html)
+
---------------------------
version 1.4.2
Modified: trunk/src/jason/runtime/MASConsoleColorGUI.java
===================================================================
--- trunk/src/jason/runtime/MASConsoleColorGUI.java 2015-08-03 14:14:51 UTC (rev 1842)
+++ trunk/src/jason/runtime/MASConsoleColorGUI.java 2015-08-04 12:47:36 UTC (rev 1843)
@@ -80,6 +80,7 @@
synchronized (this) {
ta = new MASColorTextPane(Color.black);
ta.setEditable(false);
+ ((DefaultCaret)ta.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
agsTextArea.put(agName, ta);
int i = 0;
for (; i<tabPane.getTabCount(); i++) {
@@ -90,10 +91,9 @@
tabPane.setTitleAt(i, agName);
}
}
- if (ta != null) { // no new TA was created
+ if (ta != null) {
// print out
- int l = ta.getDocument().getLength();
- if (l > 100000) {
+ if (ta.getDocument().getLength() > 100000) {
ta.setText("");
}
ta.append(s);
@@ -102,14 +102,11 @@
// print in output
synchronized (output) {
- int l = output.getDocument().getLength();
- if (l > 60000) {
+ if (output.getDocument().getLength() > 60000) {
cleanConsole();
- //l = 0;
}
try {
output.append(c, s);
- //output.setCaretPosition(l);
} catch (IllegalArgumentException e) {
}
}
Modified: trunk/src/jason/runtime/MASConsoleGUI.java
===================================================================
--- trunk/src/jason/runtime/MASConsoleGUI.java 2015-08-03 14:14:51 UTC (rev 1842)
+++ trunk/src/jason/runtime/MASConsoleGUI.java 2015-08-04 12:47:36 UTC (rev 1843)
@@ -191,13 +191,12 @@
if (ta == null) {
ta = new JTextArea();
ta.setEditable(false);
+ ((DefaultCaret)ta.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
agsTextArea.put(agName, ta);
tabPane.add(agName, new JScrollPane(ta));
}
- if (ta != null) { // no new TA was created
- // print out
- int l = ta.getDocument().getLength();
- if (l > 100000) {
+ if (ta != null) {
+ if (ta.getDocument().getLength() > 100000) {
ta.setText("");
}
ta.append(s);
@@ -206,14 +205,11 @@
// print in output
synchronized (output) {
- int l = output.getDocument().getLength();
- if (l > 60000) {
- cleanConsole();
- //l = 0;
- }
try {
+ if (output.getDocument().getLength() > 60000) {
+ cleanConsole();
+ }
output.append(s);
- //output.setCaretPosition(l);
} catch (IllegalArgumentException e) {
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|