1 Welcome to CSE41MAS MultiAgent Systems LAB 4. Objectives Demonstration of how to implement agents using JACK 2.

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
SELBO Agent Ivan Minov University of Plovdiv “Paisii Hilendarski“
How do we make our Welcome.java program do something? The java in our Welcome.java file won’t do anything by itself. We need to tell the computer to execute.
JACK Intelligent Agents and Applications Hitesh Bhambhani CSE 6362, SPRING 2003 Dr. Lawrence B. Holder.
CS 106 Introduction to Computer Science I 02 / 12 / 2007 Instructor: Michael Eckmann.
CS220 Software Development Lecture: Multi-threading A. O’Riordan, 2009.
Datalogi A 1: 8/9. Book: Cay Horstmann: Big Java or Java Consepts.
01 Introduction1June Introduction CE : Fundamental Programming Techniques.
Computer Science A 1: 3/2. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Welcome to the Lecture Series on “Introduction to Programming With Java”
1 Introduction to Java Brief history of Java Sample Java Program Compiling & Executing Reading: => Section 1.1.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
The Java Programming Language
Java Applets. 2 Introduction to Java Applet Programs  Applications are stand alone programs executed with Java interpreter executed with Java interpreter.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Lecture 2: Classes and Objects, using Scanner and String.
Clement Allen, PhD Florida A&M University SUMMER 2006.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Active-HDL Interfaces Building VHPI Applications C Compilation Course 9.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
Java Applets. 2 Introduction to Java Applet Programs Applications are ___________________ programs –executed with Java interpreter Applet is a small program.
FIRST JAVA PROGRAM. JAVA PROGRAMS Every program may consist of 1 or more classes. Syntax of a class: Each class can contain 1 or more methods. public.
Working with arrays (we will use an array of double as example)
Programming Life Cycle Problem analysisunderstand the problem Requirements definition specify what program will do High- and low-level designhow it meets.
JAVA COURSE LESSON2 BY OMPUTER ENGINEEING ASSOCIATION.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
IBM TSpaces Lab 3 Transactions Event Registration.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
CSI 3125, Preliminaries, page 1 Compiling the Program.
Introduction to Computing Concepts Note Set 15. JOptionPane.showMessageDialog Message Dialog Allows you to give a brief message to the user Can be used.
Computer Science I Programming in Java (programming using Processing IN Java, using IntelliJ IDE) Classwork/Homework: copy your Processing projects over.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 19 Generics.
Chapter11 Concurrent. 集美大学 计算机工程学院 Java 程序设计 年 第二版 Concurrent ●Computer users take it for granted that their systems can do more than one thing.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Exceptions. Exception  Abnormal event occurring during program execution  Examples Manipulate nonexistent files FileReader in = new FileReader("mumbers.txt“);
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Object Oriented Programming in Java Habib Rostami Lecture 10.
Object Oriented Programming Object and Classes Lecture 3 MBY.
Computer Science A 1. Course plan Introduction to programming Basic concepts of typical programming languages. Tools: compiler, editor, integrated editor,
Cs205: engineering software university of virginia fall 2006 Programming Exceptionally David Evans
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Data Structures and Algorithms in JAVA Chapter 2.
Introduction to Object Oriented
Introduction to Computers, the Internet and the World Wide Web
C++ Plus Data Structures
Introduction to.
CompSci 230 Software Construction
Testing and Exceptions
Multithreading in Java
ATS Application Programming: Java Programming
How to Run a Java Program
An Introduction to Java – Part I, language basics
Java Applets.
Constructors, GUI’s(Using Swing) and ActionListner
Week 4 Lecture-2 Chapter 6 (Methods).
Introduction to Java Brief history of Java Sample Java Program
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
F II 2. Simple Java Programs Objectives
JACK® Intelligent Agents
Presentation transcript:

1 Welcome to CSE41MAS MultiAgent Systems LAB 4

Objectives Demonstration of how to implement agents using JACK 2

Contents A brief introduction to JACK and how to implement agents in JACK Examples 3

4 JACK Java Agent Compiler & Kernel

5 JACK JACK is an environment for developing agent-oriented systems. JACK is built on top of and fully integrated with the Java programming language. JACK is a product of Agent Oriented Software (AOS) Group. Download JACK for 60-day trial personal use:

6 Components of JACK The JACK Agent Language –Used to develop agent-oriented systems. It is a ‘super-set’ of Java, extending it with agent-oriented constructs. The JACK Agent Compiler –Debugs and converts JACK files into Java files. The JACK Agent Kernel –Runtime engine for JACK based agents. The JACK Development Environment (JDE) –A graphical development environment that can be used to develop JACK based applications. (not covered in this course)

Three basic files to constitute an agent in JACK The.agent file (The file extension is ‘.agent’, e.g., VacuumAgent.agent) –Specifies the agent’s name, the events the agent can handle, and the plans the agent uses to react to these events… The.event file (The file extension is ‘.event’, e.g., VacuumEvent.event) –Declare events an agent can handle The.plan file (The file extension is ‘.plan’, e.g., VacuumPlan.plan) –Describes a sequence of actions that an agent can take when an event occurs 7

8 Event template event SomeEvent extends Event { //Events are originators of all activity within JACK int count; //It is necessary to specify at least one posting method for the event #posted as go(int cnt) { count = cnt; }

9 Plan template plan SomePlan extends Plan { //Plan describes a sequence of actions that // an agent can take when an event occurs. #handles event SomeEvent e; //Each plan is capable of handling a single event. body() { //Actual steps performed when plan is executed. //… maybe do some actions here if( /*some condition*/) another event*/); //issue another event to keep the //agent working if not finish its tasks } //… maybe do some actions here }

10 Agent template agent Robot extends Agent [implements SomeInterface] { //The agent handles events of SomeEvent #handles event SomeEvent; //The agent uses a plan of SomePlan #uses plan SomePlan; //The agent posts events of SomeEvent #posts event SomeEvent ev; public Robot(String name) { super(name);//give a name for the agent postEvent( ev.go(99) ); //issue an event to start the agent }

Compilation In your current directory containing your source code, use the command: java aos.main.JackBuild 11.. Robot.agent SomeEvent.event SomePlan.plan Before compilation.. Robot.agent Robot.java Robot.class SomeEvent.event SomeEvent.java SomeEvent.class SomePlan.plan SomePlan.java SomePlan.class After successful compilation compile You need to correct your source code until so see [JackBuild Done] on the screen after compiling

How to make use of an agent Two ways: 1.Create an agent which can run by itself 2.Instantiate an agent inside another java class 12

Create a runnable agent Like a normal agent, but implementing the method called ‘main’ inside the file.agent, e.g.: … public static void main(String[] args) { … Robot robot = new Robot(“My Robot”); … } … 13

Instantiate an agent inside another class Create a java class, e.g., AgentSystem.java Implement the ‘main’ method inside this class, e.g.: … public static void main(java.lang.String[] args){ … Robot robot= new Robot(“My Robot”); … } … 14

Examples Implement an agent which autonomously counts integer numbers from 1 to 10 Download this example from: 15

16 CounterEvent.event file event CounterEvent extends Event { public int someNumber; #posted as doCount(int number) { someNumber = number; System.out.println(“The event occurs…”); }

17 CounterPlan.plan file plan CounterPlan extends Plan { #handles event CounterEvent e; body() { System.out.println(“Current number is ” + for 2 seconds if(e.someNumber == 10){ System.out.println(“Count to 10! The agent finished its job!”); System.exit(0); + 1)); }

18 CounterAgent.agent file agent CounterAgent extends Agent { #handles event CounterEvent; #uses plan CounterPlan; #posts event CounterEvent ev; public CounterAgent(String name){ super(name); //give a name for the agent postEvent( ev.doCount(1) ); //fire an event for starting to count } public static void main(String[] args){ CounterAgent counterAgent = new CounterAgent(“My Counter Agent”); }

19 Reading JACK TM Intelligent Agents Agent Manual ( dex.html)