AgentManual1 Introduction

来源:http://aosgrp.com/

 

1 Introduction

1.1 Background

JACK™ Intelligent Agents (JACK) is an Agent Oriented development environment built on top of and integrated with the Java programming language. It includes all components of the Java development environment as well as offering specific extensions to implement agent behaviour. JACK's relationship to Java is analogous to the relationship between the C++ and C languages. C was developed as a procedural language and subsequently C++ was developed to provide programmers with object-oriented extensions to the existing language. Similarly, JACK has been developed to provide agent-oriented extensions to the Java programming language. JACK source code is first compiled into regular Java code before being executed.

In the same way that object-oriented programming introduces a number of key concepts that influence the entire logical and physical structure of the resulting software system, so too does agent-oriented programming. In agent-oriented programming, a system is modelled in terms of agents. These agents are autonomous reasoning entities capable of making pro-active decisions while reacting to events in their environment.

 

1.2 Agent Oriented Concepts

Agent oriented programming is an advanced software modelling paradigm that arose from research in distributed artificial intelligence. It addresses the need for software systems to exhibit rational, human-like behaviour in their respective problem domains. Traditional software systems make it difficult to model rational behaviour, and often programs written in these systems experience limitations, especially when attempting to operate in real-time environments.

Agent oriented programming is highly suited to many application areas, including distributed business systems, command and control, intelligent appliances and simulation. Although still young and under development, it has already shown particular promise in a variety of distributed problem solving tasks such as fleet organisation, air traffic management and air combat simulation. Because it offers such a modular and elegant solution to many of the problems faced in reactive processing, agent-oriented programming is ideally suited to these environments.

The Agent Oriented model follows the same underlying principle as Object Oriented programming – that reliable and scalable development can be enhanced by encapsulating the desired behaviour in modular units which contain all the definitions and structures required for them to operate independently. Agents extend the concept of encapsulation to include a representation of behaviour at a higher level than object-oriented approaches.

 

1.2.1 What is an Agent?

The term agent is widely used to describe a range of software components, varying in capability from procedural wizards, found in popular desktop applications, to information agents that are used to automate information search and retrieval, and, finally, to intelligent agents capable of reasoning in a well-defined way. The agents used in JACK are intelligent agents. They model reasoning behaviour according to the theoretical Belief Desire Intention (BDI) model of artificial intelligence.

Following the BDI model, JACK intelligent agents are autonomous software components that have explicit goals to achieve or events to handle (desires). To describe how they should achieve these desires, BDI agents are programmed with a set of plans. Each plan describes how to achieve a goal under varying circumstances. Set to work, the agent pursues its given goals (desires), adopting the appropriate plans (intentions) according to its current set of data (beliefs) about the state of the world. This combination of desires and beliefs initiating context-sensitive intended behaviour is part of what characterises a BDI agent.

A JACK agent is a software component that can exhibit reasoning behaviour under both pro-active (goal directed) and reactive (event driven) stimuli. Each agent has:

  • a set of beliefs about the world (its data set),
  • a set of events that it will respond to,
  • a set of goals that it may desire to achieve (either at the request of an external agent, as a consequence of an event, or when one or more of its beliefs change), and
  • a set of plans that describe how it can handle the goals or events that may arise.

When an agent is instantiated in a system, it will wait until it is given a goal to achieve or experiences an event that it must respond to. When such a goal or event arises, it determines what course of action it will take. If the agent already believes that the goal or event has been handled (as may happen when it is asked to do something that it believes has already been achieved), it does nothing. Otherwise, it looks through its plans to find those that are relevant to the request and applicable to the situation. If it has any problems executing this plan, it looks for others that might apply and keeps cycling through its alternatives until it succeeds or all alternatives are exhausted.

Thus, an agent can be thought of as analogous to a person with access to a Procedures Manual. The Procedures Manual (set of plans) describes the steps that the agent should take when a certain event arises or when it wants to achieve a certain outcome. At first glance, this may seem like ordinary Expert System behaviour – with all the limitations that this implies. However, the crucial difference in agent-oriented systems is that the agent is able to be programmed to execute these plans just as a rational person would. In particular, it is able to exhibit the following properties associated with rational behaviour:

Goal-directed focus – the agent focuses on the objective and not the method chosen to achieve it.
Real-time context sensitivity – the agent will keep track of which options are applicable at each given moment, and make decisions about what to try and retry based on present conditions.
Real-time validation of approach – the agent will ensure that a chosen course of action is pursued only for as long as certain maintenance conditions continue to be true.
Concurrency – the agent system is multi-threaded. If new goals and events arise, the agent will be able to prioritise between them and multi-task as required.

 

1.2.2 Why program using Agents?

The capability of intelligent agents to autonomously perform simple tasks has aroused much interest. The key characteristics that make them attractive are their:

  • ability to act autonomously,
  • high-level representation of behaviour – a level of abstraction above object-oriented constructs,
  • flexibility, combining pro-active and reactive behavioural characteristics,
  • real-time performance,
  • suitability for distributed applications, and
  • ability to work co-operatively in teams.

JACK agents are highly suited to the development of time and mission-critical systems, as the BDI approach provides for the verification and validation of the model. The agent's goals may include keeping human users informed of what the agent is trying to achieve, what its current intentions are, and what progress it has been able to make. Giving BDI agents pre-compiled plans is a method of ensuring predictable behaviour under critical operational conditions, and of ensuring performance.

 

1.3 The Components of JACK
1.3.1 The JACK Agent Language

The JACK Agent Language is the actual programming language used to describe an agent-oriented software system. The JACK Agent Language is a super-set of Java – encompassing the Java syntax while extending it with constructs to represent agent-oriented features.

Each of the Java extensions that are included in JACK, along with their expected usage and semantic behaviour, are described in detail in the following chapters.

 

1.3.2 The JACK Agent Compiler

The JACK Agent Compiler pre-processes JACK Agent Language source files and converts them into pure Java. This Java source code can then be compiled into Java virtual machine code to run on the target system.

 

1.3.3 The JACK Agent Kernel

The JACK Agent Kernel is the runtime engine for programs written in the JACK Agent Language. It provides a set of classes that give JACK Agent Language programs their agent-oriented functionality. Most of these classes run behind the scenes and implement the underlying infrastructure and functionality that agents require, while others are used explicitly in JACK Agent Language programs, inherited from and supplemented with callbacks as required to provide agents with their own unique functionality.

 

1.4 Developing a JACK Application

An integrated development environment known as the JACK Development Environment is available for the development of JACK applications. Use of the JACK development environment is described in a separate manual. Alternatively, JACK applications can be developed from the command line using an editor of choice and explicitly invoking the JACK Agent compiler.

If the latter choice is used, the environment will need to be set up. The following section explains how this is done for the more common operating environments. The instructions that follow assume that all commands are invoked from a command line. Thus, under Windows or NT, a DOS window will need to be created.

 

1.4.1 Setting up your Environment

Before a JACK application can be compiled and run, ensure that the PATH and CLASSPATH variables are set correctly. PATH needs to be set so that java and javac are accessible. CLASSPATH needs to be set so that java and javac can access the JACK class files and the classes that are created.

The actual settings for PATH and CLASSPATH will depend upon where the java executables and JACK classes have been installed. It is assumed that:

  1. The PATH variable is set correctly.
  2. The CLASSPATH variable has not been set. (If it has, it may need to be extended. This procedure is operating system dependent.)
  • DOS / Windows / NT
    In this example, it is assumed that the JACK classes are installed in C:\aos\lib. Within a session the CLASSPATH can be set by typing:
    set CLASSPATH=C:\aos\lib\jack.jar;.

at a DOS prompt.
This should be added to the C:\AUTOEXEC.BAT file so that this setting is permanently available. In Windows/DOS, this can be done using SYSEDIT. In NT it can be changed via <Control Panel> -> <System> -> <Environment>. Note that the CLASSPATH should be specified in lower case.

  • UNIX
    In this example, it is assumed that the JACK classes are installed in /aos/jack/lib. Within a session, the CLASSPATH can then be set by typing:
      CLASSPATH=/aos/jack/lib/jack.jar:.
      export CLASSPATH

If using csh, to make the setting permanent, add:

      setenv CLASSPATH=/usr/local/aos/jack/lib/jack.jar:.

to the .cshrc file.

 

1.4.2 Source Code Creation

This can be achieved either using the JACK development environment, or an editor of choice. When developing a JACK application, source code will be created for some or all of the following entities:

  • JACK event(s);
  • JACK plan(s);
  • JACK agent(s);
  • JACK capability(s);
  • JACK view(s);
  • JACK beliefset(s);

plus a Java class that contains the application main() function that is the entry point for the Java virtual machine and any other Java file required by this application.

The files that are created for these entities must have the same base name as the entity defined in the file. They may have an extension designating the type of JACK entity contained, or simply a .jack extension.

Extension

Usage

.jack

Any JACK object definition.

.agent

JACK agent definition.

.cap

JACK capability definition.

.plan

JACK plan definition.

.event

JACK event definition.

.bel

JACK beliefset definition.

.view

JACK view definition.

.java

Java class or interface definition.

Table 1-1: JACK file extensions

 

1.4.3 Compilation

Assuming that all the source files are in your current directory, the application can be compiled by invoking JackBuild:

    java aos.main.JackBuild

This runs the JackBuild utility which in this invocation compiles all of the JACK source files in the current directory into Java source. The Java compiler is then automatically invoked on all Java source files in the current directory. JackBuild recognises JACK files by their file name extensions as listed in the previous section.

Without arguments, the JackBuild utility assumes that all files in the directory belong to the application. If the application is organised into subdirectories, it can be compiled by invoking JackBuild from the parent directory as follows:

    java aos.main.JackBuild -r

The -r option recursively enters subdirectories to compile code.

Refer to Appendix A for more information about JackBuild.

 

1.4.4 Running a JACK Application

If one assumes that the main() method was in a file called Test.java, the compilation process will have produced a file called Test.class. The application can then be run from the directory containing Test.class by typing

    java Test

Note: It is possible to configure Windows so that files with the extension .class are runnable by point-and-click.


The programmer can specify command line arguments for use within an application. Note that there are some command line arguments which are processed internally by JACK. In particular, a DCI network from the command line can be set up (this is discussed further in the chapter on Inter-agent Communication). If such arguments are present, the method aos.jack.Kernel.init() must be used to process these arguments before any user specified command line arguments are processed. init() extracts and processes command line arguments intended for JACK, then returns a modified argument list containing the remaining user defined arguments. This list can then be accessed in the normal way, as shown in the example below:

    public class Example
    {
      // The user supplies a single numeric command line argument
      // in addition to those which will be handled by JACK
      public static void main(String args[])
      {
        args = aos.jack.Kernel.init(args);
 
        int snum = Integer.parseInt(args[0]);
         :
         :
      }
    }

All the standard Java command options are available. Some JACK functionality such as the interaction diagram and debugging is configurable via the system properties file. The -D option can be used in these circumstances to set properties. For more details on the interaction diagram and debugging refer to the Tracing and Logging Manual.

 

1.4.5 Debugging a JACK Application

There are a number of tools available to assist the developer during application development. These range from graphical tracing tools to logging tools which provide a detailed trace of system execution. These tracing and logging tools are described in the Tracing and Logging Manual.

转载于:https://www.cnblogs.com/6DAN_HUST/archive/2012/04/07/2435768.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值