=Paper= {{Paper |id=Vol-1099/paper8 |storemode=property |title=A Conceptual and Computational Model for Knowledge-based Agents in ANDROID |pdfUrl=https://ceur-ws.org/Vol-1099/paper8.pdf |volume=Vol-1099 |dblpUrl=https://dblp.org/rec/conf/aiia/SartoriMG13 }} ==A Conceptual and Computational Model for Knowledge-based Agents in ANDROID== https://ceur-ws.org/Vol-1099/paper8.pdf
           A Conceptual and Computational Model for
            Knowledge-based Agents in ANDROID
                                          Fabio Sartori, Lorenza Manenti and Luca Grazioli
                                         Department of Informatics, Systems and Communication,
                                                     University of Milano-Bicocca,
                                                Viale Sarca 336/14, 20126, Milano, Italy
                                               Email: {sartori, manenti}@disco.unimib.it,
                                                      l.grazioli3@campus.unimib.it


   Abstract—Today ANDROID is the most popular mobile operat-                 While the artifact concept is often described as the result of a
ing system in the world: the development of ANDROID, together                disciplined human activity, following rules based on training
with the performance improvement offered by modern PDAs, like                and experience, Knowledge Artifacts [11] are artifact spe-
smart-phones and tablets, has allowed many users to know new
kinds of applications that were not accessible to them in the                cializations devoted to represent expert knowledge in object–
recent past.                                                                 manufacturing or service–delivery fields. The final aim of our
   In this paper we present a framework for programming agents               Knowledge Artifact is generating executable rule–based sys-
in the ANDROID world, based on the Knowledge Artifact notion                 tems written in JESS5 , minimizing the knowledge engineering
to develop knowledge-based systems.                                          effort. To this scope, correlated tools for the representation
   This framework has been modeled as a client–server archi-
tecture, with the aim to show how the implementation of agents               of functional and structural knowledge (i.e. ontologies [8]),
modeled on the basis of Knowledge Artifacts can help everyone                procedural knowledge (i.e. influence nets [9]) and experiential
to design, implement and use decision support systems for a                  knowledge (i.e. task structures [10]) have been integrated into
specific domain, with many potential benefits in their day-by-               a unique conceptual and computational framework, providing
day activities.                                                              the user with an opportune set of primitives for designing
   The framework application will be presented in a prototype
to support operators of Italian Fire Corps and Civil Protection              and implementing decision support systems without a deep
Department in critical situations, like geographically distributed           knowledge on the specific language syntax.
fires and earthquakes management.                                               This framework has been modeled as a client–server archi-
                                                                             tecture, where the server is a knowledge-based agent having
                         I. I NTRODUCTION                                    two tasks, the creation of the rule-based system according
   Nowadays ANDROID is the most popular mobile operating                     to the user (i.e. the expert) indications and the execution
system in the world, and reaches out to touch peaks of                       of it according to the data sent it by the client, that is a
diffusion, in some countries, more than 90% of the total                     sort of reactive agent sending inputs and receiving outputs
smartphone market1 . The development of ANDROID together                     from the knowledge-based agent: in this way, it was possible
with the performance improvement offered by modern PDAs,                     to overcome the impossibility, at the current state of JESS
like smartphones and tablets, has allowed many users to                      implementation6 to import JESS library under the ANDROID
keep in touch with new kinds of applications that were not                   OS.
accessible to them in the recent past.                                          The main aim of this paper is to show how the implemen-
   Among them, applications related to the Agent Oriented                    tation of agents modeled on the basis of Knowledge Artifacts
Programming (AOP) paradigm [1] are particularly influenced                   can help everyone to design, implement and use decision
by the wide diffusion of personal devices, thanks to their                   support systems for a specific domain, with many potential
intrinsic mobile nature. Different open-source frameworks                    benefits in their day-by-day activities.
devoted to the development of agent-based programs, like                        The most interesting feature of the framework is its ca-
JADE2 [2], JASON3 [3] and CArtAgO4 [4] have been recently                    pability to act as a CAKE (Computer-Aided Knowledge
imported into ANDROID by means of the implementation of                      Engineering) environment: the implementation of KBSs has
specific add-ons or ad-hoc frameworks (e.g. [5], [6]).                       been always conceived as a very specific task, which can be
   In this paper we present a framework for programming                      only conducted by knowledge engineers with the support of
agents in the ANDROID world, making it transparent to the                    domain experts. Knowledge engineering methodologies, such
programmer, basing it on the Knowledge Artifact [7] notion.                  as CommonKads [12] and MIKE [13], have been proposed
                                                                             in the past as standard and generalized solutions to overcome
  1 Data      extracted       from      http://www.androidworld.it/2013/04/29/
android-in-italia-al-625-e-nel-mondo-al-642-secondo-le-ultime-stime-153115/      5 Acronym of Java Expert System Shell, available at http://herzberg.ca.
  2 Available at http://jade.tilab.com/
                                                                               sandia.gov
  3 Available at http://jason.sourceforge.net/wp/                                6 See    the     discussion    at    http://jess.2305737.n4.nabble.com/
  4 Available at http://cartago.sourceforge.net/                               JESS-Re-Jess-jar-on-Android-td3957868.html
the knowledge acquisition and representation bottlenecks, but        causal dependencies among the ontology elements and T S
addressed to users highly skilled in the design of complex           are task structures to represent how one or more outputs can
software systems.                                                    be produced by the system according to a rule–base system
    The rest of the paper is organized as follows: Section II        strategy.
will introduce the agent-based framework and the conceptual             In the KA model, the underlying ontology is a taxonomy:
model of Knowledge Artifact it is based on, also discussing          the root is the description of the problem to be solved, the
the computational model of the agents developed according to         inner nodes are system inputs or partial outputs and the leaves
it. Section III will present a case study to show how it can be      of the hierarchy are effective outputs of the system.
profitably used in a specific domain. In the end, in Section IV a       The Influence Net model is a structured process that allows
discussion on how this model can be implemented considering          to analyse complex problems of cause-effect type in order
the AOP paradigm will be presented along with a discussion           to determine an optimal strategy for the execution of certain
on the future developments and works.                                actions, to obtain an optimal result. The Influence Net is a
     II. T HE AGENT-BASED F RAMEWORK AND THE KA                      graphical model that describes the events and their causal
                            N OTION                                  relationships. Using information based on facts and experience
                                                                     of the expert, it is possible to analyze the uncertainties created
   In this Section we first present the agent–based framework
                                                                     by the environment in which we operate. This analysis helps
describing the main components of the model; then, we discuss
                                                                     the developer to identify the events and relationships that can
the conceptual model and the relative implementation of the
                                                                     improve or worsen the desired result. In this way you can
KA notion according to the agent–based model has been
                                                                     determine the best strategy.
developed.
                                                                        The Influence Net can be defined as a 4–tuple hI, P, O, Ai,
A. Agent-based Framework                                             where:
   In relationship with the client-server architecture, our frame-     • I is the set of input nodes, i.e. the information needed to
work is composed of two main elements:                                   the KBS to work properly;
   • simple reactive agents a1 , .., ai , .., an located on mobile     • P is the set or partial output nodes, i.e. the collection of
      devices and that perceived and collected information on            new pieces of knowledge and information elaborated by
      the “state of the world”. These information can be de-             the system to reach the desired output;
      tected by means of device sensors (e.g. GPS, barometer,          • O is the set of output nodes, i.e. the effective answers of
      pressure altimeter and so on) and directly provided by the         the system to the described problem; outputs are values
      user of the system by means of an appropriate graphic              that can be returned to the user;
      user interface (GUI);                                            • A is the set of arcs among the nodes: an arc between two
   • a knowledge-based agent KA-Agent that is responsible                nodes specifies that a causal relationship exists between
      for the management of its internal knowledge and the               them; an arc can go from an input to a partial node or
      elaboration of information received from agents ai . In            an output, as well as from partial node to another one
      particular the goal of a KA-Agent is twofold: (i) it has to        or an output. Moreover, an arc can go from an output to
      interact with the domain expert by means of a graphic              another output. Every other kind of arcs is not permitted.
      user interface (GUI), obtaining information about the
      domain in terms of concepts, relationships and rules, and         Finally, Task Structures allow to describe in a rule–based
      creating the corresponding ontology, influence network         system way how the causal process defined by a given IN can
      and rule-based system; (ii) it has to interact with agents     be modeled. Each task is devoted to define computationally
      ai and it has to elaborate the information they provide        a portion of an Influence Net: in particular, sub–tasks are
      with the expert system previously created.                     procedures to specify how a partial output is obtained, while
                                                                     tasks are used to explain how an output can be derived from
   Fig. 1 graphically represents the components and the inter-
                                                                     one or more influencing partial outputs and inputs. A task
actions in our framework: expert users interact with the KA-
                                                                     cannot be completed until all the sub–tasks influencing it have
Agent GUI in order to create the expert system, while non-
                                                                     been finished. In this way, the TS modeling allows to clearly
expert users interact with agent ai GUI in order to provide
                                                                     identify all the levels of the system. The task and sub–task bod-
information that will be used by KA-Agent in elaborating
                                                                     ies are a sequence of rules, i.e. LHS(Lef tHandSide)− >
knowledge.
                                                                     RHS(RightHandSide) constructs.
   Since the KA-Agent represents the main relevant part of our
system, in the follow we will focus on the KA notion upon               Each LHS contains the conditions that must be verified so
which it is based on, considering the conceptual model and           that the rule can be applied: it is a logic clause, which turns
the relative implementation.                                         out to be a sufficient condition for the execution of the action
                                                                     indicated in the RHS. Each RHS contains the description of
B. The Conceptual Model of Knowledge Artifact                        the actions to conduct as a result of the rule execution. The
  In our approach, the Knowledge Artifact is described as            last step of our model is then the translation of all the task and
a 3–tuple hO, IN, T Si, where O is an ontology of the in-            sub–task bodies into production rules of a specific language
vestigated domain, IN is an Influence Net to represent the           (JESS in our case).
Fig. 1: Graphical representation of the agent-based model: agents ai , KA-Agent, and interactions among them and with domain
expert


C. Knowledge Artifact Implementation: the KA-Agent                   are bounded by arcs which specify the source and the target
    The implementation of the different elements composing           nodes.
the knowledge engineering framework has exploited the XML               Finally, an XML schema for the task (subtask) element of
language. A proper schema has been developed for each of             the framework have been developed. The parser produces an
them, as well as dedicated parsers to allow the user to interact     XML file for each output considered in the Influence Net. The
with them. Following the conceptual model briefly introduced         tags input and subtask allows to define which inputs and partial
in the previous section, the first schema is the ontological one,    outputs are needed to the output represented by the task to
defining opportune tags to specify inputs, where the name of         be produced. The body tag is adopted to model the sequence
the input can be put together with a description and a value for     of rules necessary to process inputs and results returned by
it. Moreover, it is possible to define an haf f ectsi relationship   influencing subtasks: a rule is composed of an hif i ... hdoi
for each input, in order to explain how it is involved in the        construct, where the if statement permits to represent the LHS
next steps of the elaboration (i.e. which output or partial output   part of the rule, while the do statement concerns the RHS part
does it contribute to state?).                                       of the rule.
    A partial output (i.e. an inner node between an input and           The XML files introduced so far have been incorporated
a leaf of the taxonomy) is limited by a specific pair of tags.       into the KA–Agent knowledge base: they allow the definition
The fields are the same as the input case, with the difference       of a rule–based system to solve problems in specific domains.
that a partial output can be influenced by another entity too:       The developed GUI permits the user to interact with the KA–
this is the sense of the hinf luencedByi relationship. Finally,      Agent to design the underlying taxonomy, influence net and
the houtputi tag allows to describe completely an effective          tasks/subtasks. Moreover, it is possible to transform the task
output of the system, i.e. a leaf of the taxonomy developed to       into a collection of files containing rules written in the JESS
represent the problem domain.                                        language: Figure 2 shows a sketch of the supporting tool for
    To produce an Influence Net, the taxonomy is bottom–up           this scope.
parsed, in order to identify the right flow from inputs to outputs
by navigating the influencedBy relationships designed by the                              III. A C ASE S TUDY
user. In this way, different portions of the under development         Once the KA–Agent has been created and programmed as
system can be described. Outputs, partial outputs and inputs         a rule–based system, it is able to interact with one or more
                                                                            ANDROID application on his/her smartphone: this application
                                                                            has been modeled as a reactive agent, namely the STOP–
                                                                            Agent, communicating with the KA–agent via the client–server
                                                                            architecture introduced above: Figure 3 shows the interface
                                                                            for its initialization. Each STOP–Agent sends to the KA–
                                                                            agent data about the conditions of the site it is analyzing:
                                                                            according to the STOP handbook, these data allow to make
                                                                            considerations about the real conditions of the building walls
                                                                            after the earthquake in order to understand which raker or
                                                                            scaffolding to adopt.
                                                                               Exploiting the ANDROID primitives, it has been possible
                                                                            to create a stable mechanism for the communication with
                                                                            the server. In particular, the following tools were useful to
                                                                            implement the STOP–Agent:
                                                                               • activities: a class that extends an Activity class is respon-
                                                                                 sible for the communication with the user, to support
                                                                                 him/her in setting the layout, assigning the listeners to
                                                                                 the various widgets (ANDROID’s graphical tools) and
                                                                                 setting the context menu;
                                                                               • listener: a class that implements the interface OnClick-
                                                                                 Listener is a listener. An instance of this object is always
                                                                                 associated with a widget;
                                                                               • asyncTask: a class that extends AsyncTask is an asyn-
                                                                                 chronous task that performs some operations concurrently
                                                                                 with the execution of the user interface (for example the
Fig. 2: The KA–Agent GUI for supporting domain experts in                        connection to a server must be carried out in a AsyncTask
the creation of rule–based system from task structures


clients to receive inputs and send outputs. Clients are reactive
agents in our model: they are spatially distributed and detect
observations about the knowledge domain under investigation.
They can send to the KA–Agent these observations in order
to get suggestions about the action to take. These suggestions
are elaborated by the KA–Agent according to its KA model.
This scenario has been successfully tested in a case study
inspired us by the STOP7 handbook supplied to the Italian
Fire Corps and Civil Protection Department of the Presidency
of Council of Ministers for the construction of safety building
measures for some building structures that have been damaged
by an earthquake. After L’Aquila’s earthquake in 2009, this
document has been prepared in order to standardize the steps
to follow in similar situations.
   The structure of this document is suitable for the creation of
a rule-based system, being modular and with specific and well
defined cases. Using the created application, two knowledge
models have been created (the first for the safety of the walls
through rakers, the other for the safety of the openings through
special scaffoldings).
A. The STOP–Agent: an ANDROID Client
  Every operator involved in the emergency procedures to
make safe buildings and infrastructures is provided with an
  7 Acronym
                                                                            Fig. 3: The STOP–Agent GUI for the activation of the two
               of Schede Tecniche di Opere Provvisionali, see http://www.
vigilfuoco.it/aspx/notizia.aspx?codnews=8293 for details.                   application knowledge models
      instance, not in an Activity one);                           the rules describing the behavior of the rule-based system.
The typical mechanism to interface the client and the server is    A Controller class has been added to this framework to
the following one: the Activity object prepares the layout and     build up the interface between all the server’s classes and the
sets the widgets’ listeners and a container with the information   preexistent knowledge engineering environment.
useful for the server; then, it possibly starts the AsyncTask         The server, once activated, can accept both requests for the
instance for sending the correct request to the server, passing    creation of a new system and for the resolution of problems
to it the previously created container. Before starting the        on the basis of existing rule-based systems. To do this, con-
asynchronous task, in most cases, the listener activates a         current programming is used: the server manages the different
dialog window that locks the user interface in waiting for the     requests concurrently, through an opportune thread, namely
communication with the server; the AsyncTask predisposes the       MonitorThread. A MonitorThread instance starts the thread in
necessary Sockets for the communication and then performs its      charge of listening the requests for the creation of a new rule-
request to the server, sending the information about the case      based system (i.e. GestoreThread). Moreover, MonitorThread
study observation (see Figure 4) enclosed in the container.        allows to properly manage the ports on which other threads
Before concluding, it closes (dismisses) the waiting dialog        will interface, and provides methods necessary for their correct
window.                                                            startup. Another thread, namely ManagingThread is instanced
                                                                   by GestoreThread for the use of previously created rule–based
B. The KA–Agent: a JAVA Server                                     systems. This thread manages the .clp files archive, being sure
   The KA–Agent creates an instance of the KA model for            that inputs and outputs are correctly received and sent by the
each active STOP–Agents in communication with it. Then,            right system and JESS’ libraries are correctly invoked.
it executes the model according to the rule–based system
                                                                             IV. C ONCLUSION AND F UTURE W ORKS
previously generated and sends answers to the STOP–Agent
that will be able to take the proper action, as shown in Figure       This paper has presented an ongoing research project aiming
5.                                                                 to design and implement tools for supporting the user in the
   The design of the server exploits an existent framework         development of knowledge-based systems. This framework
for the rule-based systems creation. This framework allows         is based on the Knowledge Artifact conceptual model and
to produce a .clp file runnable under JESS and that contains       is general enough to be adopted in different contexts and




Fig. 4: The STOP–Agent GUI for sending information to the          Fig. 5: The KA–Agent sends characteristics on raker to use to
KA–Agent                                                           the STOP–Agent, in order to make safe a wall
programming paradigms.                                                     shadow facts and so on.
   In particular, we have integrated it into the AOP model,
                                                                                                          R EFERENCES
according to a client–server architecture, to design and im-
plement KBSs remotely exploiting the potentialities of AN-                  [1] Y. Shoham, “Agent-oriented programming,” Artificial intelligence,
                                                                                vol. 60, no. 1, pp. 51–92, 1993.
DROID OS: in this way, the framework can be executed                        [2] F. Bellifemine, A. Poggi, and G. Rimassa, “Jade–a fipa-compliant agent
from every kind of PDAs, like smartphones and tablets, with                     framework,” in Proceedings of PAAM, vol. 99, no. 97-108. London,
the possibility to create an ad–hoc KBS when necessary.                         1999, p. 33.
                                                                            [3] R. H. Bordini, J. F. Hübner, and M. Wooldridge, Programming multi-
The framework was applied in a potential collaboration with                     agent systems in AgentSpeak using Jason. Wiley. com, 2007, vol. 8.
the Italian Fire Corps and the Civil Protection Department                  [4] A. Ricci, M. Piunti, M. Viroli, and A. Omicini, “Environment program-
of the Presidency of Council of Ministers, to provide each                      ming in cartago,” in Multi-Agent Programming:. Springer, 2009, pp.
                                                                                259–288.
firemen with tools to understand how to operate in critical                 [5] M. Ughetti, T. Trucco, and D. Gotta, “Development of agent-based, peer-
situations, like geographically distributed fires and earthquakes               to-peer mobile applications on android with jade,” in Mobile Ubiquitous
management.                                                                     Computing, Systems, Services and Technologies, 2008. UBICOMM’08.
                                                                                The Second International Conference on. IEEE, 2008, pp. 287–294.
   The developed system has shown an excellent level of                     [6] A. Santi, M. Guidi, and A. Ricci, “Jaca-android: An agent-based
performance, especially about the client side of the project.                   platform for building smart mobile applications,” in Languages,
The ANDROID application requirements are minimal, espe-                         Methodologies, and Development Tools for Multi-Agent Systems, ser.
                                                                                Lecture Notes in Computer Science, M. Dastani, A. Fallah Seghrouchni,
cially considering the Internet consumption data (an actually                   J. Hbner, and J. Leite, Eds. Springer Berlin Heidelberg, JACA2011,
critical argument). On the other hand, the memory request by                    vol. 6822, pp. 95–114. [Online]. Available: http://dx.doi.org/10.1007/
the server is definitely high. This last statement also opens                   978-3-642-22723-3 6
                                                                            [7] S. Bandini and F. Sartori, “From handicraft prototypes to limited serial
the discussion on future developments which are certainly                       productions: Exploiting knowledge artifacts to support the industrial
ample and varied. The server is, without doubt, the component                   design of high quality products,” AI EDAM (Artificial Intelligence for
that needs more attention; some modifications that could be                     Engineering Design, Analysis and Manufacturing), vol. 24, no. 1, p. 17,
                                                                                2010.
made range from the addition of new JESS features to the                    [8] C. Brewster and K. O’Hara, “Knowledge representation with ontologies:
improvement of memory management and a more efficient                           the present and future,” Intelligent Systems, IEEE, vol. 19, no. 1, pp. 72–
management of concurrency.                                                      81, 2004.
                                                                            [9] J. A. Rosen and W. L. Smith, “Influence net modeling with causal
   In the introduction we have already discussed the connection                 strengths: an evolutionary approach,” in Proceedings of the Command
between AOP paradigm and the connection with ANDROID                            and Control Research and Technology Symposium, 1996, pp. 25–28.
world: an idea to implement the model is to use JADE                       [10] B. Chandrasekaran, T. R. Johnson, and J. W. Smith, “Task-structure
                                                                                analysis for knowledge modeling,” Communications of the ACM, vol. 35,
framework, for several reasons. First of all, JADE framework                    no. 9, pp. 124–137, 1992.
is a software framework fully implemented in Java language as              [11] G. Salazar-Torres, E. Colombo, F. S. C. da Silva, C. A. Noriega, and
our native project, and it implements FIPA [2] specifications to                S. Bandini, “Design issues for knowledge artifacts,” Knowl.-Based Syst.,
                                                                                vol. 21, no. 8, pp. 856–867, 2008.
support communications and interactions among agents (and                  [12] G. Schreiber, B. Wielinga, R. de Hoog, H. Akkermans, and W. Van de
we need to model interactions between simple agents ai and                      Velde, “Commonkads: A comprehensive methodology for kbs develop-
KA-Agent).                                                                      ment,” IEEE expert, vol. 9, no. 6, pp. 28–37, 1994.
                                                                           [13] J. Angele, D. Fensel, D. Landes, and R. Studer, “Developing knowledge-
   More in detail, agents ai can be programmed using the                        based systems with mike,” Automated Software Engineering, vol. 5,
JADE-ANDROID add-on8 , a JADE module that allows com-                           no. 4, pp. 389–418, 1998.
bining the expressiveness of JADE agents communication with
the power of ANDROID platform. As already stated, another
relevant feature of JADE is the integration with JESS, the
rule engine that are the basis on which the expert system is
built on according to the KA conceptual model. In fact, KA-
Agent has the capability to create the expert system on the
basis of domain expert information and it can directly execute
it according to data sent it by client. In this way, it could
be explored the possibility to import JESS under ANDROID,
moving its execution from the current KA–Agent on the server
side to the mobile environment.
   Concerning the conceptual model of KA–Agent, it should
be possible to create a multi-language environment, expanding
it to other rule–based languages, such as Drools9 .
   Furthermore, the definition of rules could be improved to
provide the user with the possibility to define new kinds of
constructs, like templates (and the relative slots), functions,

  8 Released with LGPLv2 Licence and available at http://jade.tilab.com/
  9 http://www.jboss.org/drools/