06-09-2012, 02:47 PM
Object-Agent Oriented Programming
1Object-Agent.pdf (Size: 93.92 KB / Downloads: 24)
Abstract
Object-oriented programming has been used for building
intelligent agents, with the limitation it cannot represent
complex mental attitudes. With logic programming it is
possible to represent and infer relationships among mental
attitudes such as intentions, goals and beliefs, with limitations
in the usage of capabilities of action.
This paper presents two alternatives for integrating objectoriented
with logic programming, which enable agent
programming. Java and Smalltalk have been used for
providing one typed and another non-typed integration with
Prolog.
Introduction
Agent-oriented programming (AOP) has been presented by Y. Shoham [Shoham, 1993]
as a specialization of object-oriented programming (OOP). In this context, objects are
considered the base for the design of intelligent agents.
The definition of objects as base for agent design is specially supported by two facts. The
first, agents possess a bounded set of action abilities that can be mapped to a set of
objects classes methods. The second, agents maintain an internal private state known as
mental state, which is equivalent to the internal and private state of the objects.
Far from Shoham's definition, many languages designed for agent programming (i.e.
AgentSpeak [Weerasooriya, 1995], Daisy [Poggi, 1995], Metatem [Fisher, 1994],
CooL [Kolb, 1995]) have been built using concepts from object-oriented paradigm and
many specific agents (such as [Vere, 1990] [Ciancarini, 1997]) have been implemented
in object oriented languages such as C++, Smalltalk or Java.
These experiences of agent language definitions based on concepts of object-orientation
and the development of multi-agent systems using object-oriented languages put in
evidence one limitation in the possibilities for managing mental attitudes. In those
experiences, mental attitudes are manipulated as simple data whose relationships are
freely interpreted in decision algorithms used by agents.
Integration of Objects and Logic
In the tentative of taking advantages of the modularization and reusability provided by
object-oriented languages and of the inference of knowledge provided by logic
languages, several alternatives has been analyzed. These alternatives of integration can
be characterized in two main lines: extension of logic programming with object-oriented
programming concepts and extension of object-oriented programming languages with
logic programming concepts.
JavaLog: integrating Java and Prolog
JavaLog is an integration of Java and Prolog that allows the resolution of problems using
both languages. This capability of interaction between Prolog and Java enable us to take
advantageous of the facilities of both paradigms.
This integration has been entirely developed in Java. The development of JavaLog has
been made in two stages. In the first stage, a Prolog interpreter was designed and
implemented in Java. In the second stage, the machinery that supports the codification of
Java methods in Prolog and the use of Java objects in Prolog programs was developed.
The next two subsections present the integration from Java to Prolog and from Prolog to
Java.
Java using Prolog
The possibility of writing Prolog code inside Java programs allows the production of
natural solutions to problems that requires logic inference. These problems are common
in intelligent agents since the mental attitudes of agents are supported by particular
logics.
By means of a preprocessor is possible to embed Prolog into a Java program. JavaLog
marks between the strings ”{%” and “%}” the Prolog code included in Java methods.
For example, the code below shows a Java method that is part of the implementation of
an intelligent agent. These intelligent agents generate plans to achieve their goals. Here,
the Prolog code between the marks generates an agent plan. A planning algorithm
written in Prolog generates the plan. In the example, the characters “#” are used to
include Java variables in the Prolog code.