SDSU CS 696 Emerging Technologies: Java Distributed Computing
Spring Semester, 1999
Agents & Voyager
Previous    Lecture Notes Index    Next    
© 1999, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 29-Apr-99

Contents of Doc 31, Agents & Voyager


References


Agents in Tank Battle Simulations, Baxter and Hepplewhite, Communication of the ACM, March 1999, Vol. 42, No 3, pp. 74-75

Agents That Buy and Sell, Maes, Guttman, Moukas, Communication of the ACM, March 1999, Vol. 42, No 3, pp. 81-87, 90-91

Agents with Power, Gustavsson, Communication of the ACM, March 1999, Vol. 42, No. 3, pp. 41-47
MIT Media Lab’s Agent Project List at http://agents.www.media.mit.edu/groups/agents/projects/

Multiagent Data Collection in Lycos, Green and Pant, Communication of the ACM, March 1999, Vol. 42, No 3, pp. 70

ObjectSpace Voyager Core Technology 2.0 User Guide. ObjectSpace, 1998. Available at: http://www.objectspace.com/developers/voyager/white/index.html

Seven Good Reasons for Mobile Agents, Lange and Oshima, Communication of the ACM, March 1999, Vol. 42, No. 3, pp. 88-89

Simulations in Economics and Management, Chaturvedi and Mehta, Communication of the ACM, March 1999, Vol. 42, No 3, pp. 60-61

Software Agents - A Study of Definitions and Infrastructure Issues, Steve Holden, Master’s Thesis, 1998, San Diego State University

What we talk about when we talk about software agents, Yoav Shoham, IEEE Intelligent Systems March/April 1999, pp. 28-31.

Doc 31, Agents & Voyager Slide # 2

What is an Agent


Some agent characteristics:

Agents run for a long time
Agents do not require human supervision to function
Agents have personality, and exhibit human-like qualities
Agents adapt to their environment and customize themselves to the preferences of their user
Agents can communicate and interact with other agents
Agents can move around on the network


Doc 31, Agents & Voyager Slide # 3
Some MIT Media Lab Agent Projects

List and descriptions taken from http://agents.www.media.mit.edu/groups/agents/projects/

Amalthea
by Alexandros G. Moukas, Pattie Maes
Artificial ecosystems of evolving information-filtering and discovery agents that cooperate and compete in a market-like environment.

BUZZwatch
By Michael Best, Pattie Maes
BUZZwatch distills and tracks trends, themes, and topics within collections of texts across time (such as Internet discussions, newspaper archives, and Web pages). It works by combining new natural language processing techniques with text analysis and retrieval methods, and the novel application of statistical time series analysis. Applications include data mining and visualization of topic dynamics within texts and Internet chatrooms, as well as improved retrieval for Web search engines.

Letizia
by Henry Lieberman
Letizia is a user interface agent that assists a user browsing the World Wide Web by learning the user's interests and scouting ahead from the user's current position to find Web pages of possible interest.

Mobile Agents for Routing Discovery
by Nelson Minar, Kwin Kramer
Studies and simulations towards using mobile agents to map dynamic network topologies.

Trafficopter
by Alexandros G. Moukas
Trafficopter uses a decentralized, self-organizing network of devices in vehicles to collect and communicate road traffic information.

Calendar Agent
by Robyn Kozierok, Pattie Maes
The Calendar Agent learns a user's calendar scheduling rules and preferences by observing the user's actions and receiving direct feedback.

Doc 31, Agents & Voyager Slide # 4
Other Agent Systems

The following agent systems are from articles in March 1999 issue of Communications of the ACM. Many other agent systems and projects exist in industry and academia.

Agents on the Power Grid

A research project to have agents for homes and devices negotiate for power using supply and demand. As demand goes up, price of power goes up and agents determine how much power they want at that price. Agents use sensors to detect location of people in house to help regulate electrical devices. Lights, heat, air conditioning can be turned off in parts of the house that are not going to be used in the near future.

Economics
Agents can be used to simulate buyers and sellers in markets to study economics.

War Games
Soldiers train in virtual worlds. They fight against virtual enemy tanks, planes, etc. The virtual enemies are controlled by agents. This is research project.

Search Engine
Lycos uses three agents in there search engine. Spiders that gather information from the Web. URL server that manages which servers and pages are to visited by spiders. Catalog Update Server which builds the database of web pages. The multiagent system was used to: allow better management of site visits (avoid overloading web servers with too many requests in a short time), scalability (smaller spiders allow more spiders to be active), batching of computationally expensive processing (documents parsing, indexing).

Why Mobile Agents


The following is taken from Seven Good Reasons for Mobile Agents.

They reduce network load
Distributed systems often require many messages to achieve a task. With agents you send to where the work needs to be done. The agent then works locally.

They overcome network latency
Since the agent is working locally on the task, it does not have to deal with network latency.

They encapsulate protocols
Distributed systems use protocols define how messages and data are transferred. To modify the protocol requires changing the code on all the machines in the system. With agents, the protocol is just accept an agent and let is work. So creating a new agent can create new functionality.

They execute asynchronously and autonomously
Mobile devices are often not continuously connected to a network. Systems that require open connections will not work on mobile devices. With agents, a mobile device can connect to the network to check for work/messages. An agent can be sent to the device and work even after the device disconnects. The agent can wait until the device is reconnected to report the result of its task.

They adapt dynamically
Agents can distribute themselves around on machines on the network to best solve the task at hand.

They are naturally heterogeneous

They are robust and fault-tolerant
If a host is being shut down, agent can move on to another host to continue to operate.

Doc 31, Agents & Voyager Slide # 5

Some Java-based Mobile Agents Toolkits


Concordia by MITSUBISHI ELECTRIC
http://www.meitca.com/HSL/Projects/Concordia/Welcome.html

Aglets by IBM Japan
http://www.trl.ibm.co.jp/aglets/index.html

Odyssey by General Magic
http://www.genmagic.com/technology/odyssey.html

Voyager by ObjectSpace
http://www.objectspace.com/products/voyager1.htm

Why Voyager
Voyager was selected because is allows agents and also has the same functionality as RMI. This will allows us to see a different approach than RMI uses. The use of Voyager does not mean that I necessarily consider it to be better than any other of the Java based agent toolkits.

Doc 31, Agents & Voyager Slide # 6
Voyager Features
This list is modified from ObjectSpace’s literature on Voyager

Remote-Enabling a Class
No need for a class to implement java.rmi.Remote. All classes can be used remotely

Client-side Startup
Client can create a server object remotely.

Dynamic Class Loading
Voyager orb (or daemon) has a build-in http server.

Distributed Garbage Collection

Dynamic Aggregation™
This feature allows you to add secondary objects (termed facets) to a primary object at runtime. For example, you can dynamically add hobbies to an employee, a repair history to a car, or a payment record to a customer.

CORBA, RMI, DCOM
There is full native support for IDL, IIOP, and bidirectional IDL<->Java translation. No stub generators or helper classes are required. Full support for RMI. Soon it will support DCOM

Mobility
You can move any serializable object between programs at runtime. If a message is sent from a proxy to an object’s old location, the proxy is automatically updated with the new location and the message is resent.

Autonomous Mobile Agents

Activation
The activation framework allows objects to be persisted to any kind of database and automatically re-activated in the case that the program is restarted. An object does not have to be modified in any way to be activatable.

Applets and Servlets
Voyager-enabled applets and servlets are supported

Naming Service
Voyager orb (or daemon) has a build-in naming service

Multicast to Distributed Java Objects
You can multicast a Java message to a distributed group of objects without requiring the sender or receiver to be modified in any way.

Publish-Subscribe of Remote Events
You can publish a Java event on a specified topic to a distributed group of subscribers. The publish-subscribe facility supports server-side filtering and wildcard matching of topics.

Advanced Messaging
You can send oneway, sync, and future messages. Oneway messages return immediately and discard the return value. Future messages immediately return a placeholder to the result, which may then be polled or read in a blocking fashion.


Doc 31, Agents & Voyager Slide # 7

Hello World Example

Simple Example

Hello Interface

package whitney.voyager.examples.hello;
public interface Hello
   {
   String sayHello();
   }

HelloImplmentation

package whitney.voyager.examples.hello;
import java.net.InetAddress;
public class HelloImpl implements Hello
   {
   private int count = 0;
   
   public String sayHello() 
      {
      return  "Hello World from " + getHostName() + " count " + count++;
      }
   protected static String getHostName()
      {
      try
         {
         return InetAddress.getLocalHost().getHostName();
         }
      catch (java.net.UnknownHostException who)
         {
         return "Unknown";
         }
      }
   }

Doc 31, Agents & Voyager Slide # 8

Client Side Startup

Client Code
package whitney.voyager.examples.hello;
import com.objectspace.voyager.Factory;
import com.objectspace.voyager.Voyager;
public class HelloUser
   {
   public static void main(String args[])
      {
      try
         {
         // Start the Voyager client
         Voyager.startup();
         String serverClass =  "whitney.voyager.examples.hello.HelloServer";
         // Have the remote Voyager system create the server class
         // return a proxy. Assumes Voyager server is using port 8000 on fargo
         Hello proxy = (Hello) Factory.create( serverClass , "//fargo.sdsu.edu:8000");
         // Send a remote message to the remote object. Print return message
         System.out.println( proxy.sayHello());
         //Shutdown the Voyager client
         Voyager.shutdown();
         }
      catch (Exception voyagerProblem)
         {
         voyagerProblem.printStackTrace();
         }
      }
   }

Doc 31, Agents & Voyager Slide # 9

Running the Example

Server Side

Use the command:
voyager portNumber &

or if you want voyager to select a port use:
voyager
then voyager will print out the port selected
Make sure that the classpath of voyager contains the classes to be run by the client


The server side needs the classes Hello and HelloImpl. Compile them with javac

Client Side

The clients side needs the classes Hello, HelloImpl, and HelloUser. Compile them with javac

java HelloUser runs the program


Doc 31, Agents & Voyager Slide # 10

Using Naming Service

Register the server
First an object needs to be created and registered. The following program will do this from any machine. This code needs access to the classes Hello and HelloImpl

package whitney.voyager.examples.hello;
import com.objectspace.voyager.Factory;
import com.objectspace.voyager.Voyager;
import com.objectspace.voyager.Namespace;
public class Register
   {
   public static void main(String args[])
      {
      try
         {
         Voyager.startup();
         String serverClass =  "whitney.voyager.examples.hello.HelloImpl";
         Hello proxy = (Hello) Factory.create( serverClass , "//fargo.sdsu.edu:8000");
         Namespace.bind( "//fargo.sdsu.edu:8000/Greeter", proxy );
         Voyager.shutdown();
         }
      catch (Exception voyagerProblem)
         {
         voyagerProblem.printStackTrace();
         }
      }
   }

Doc 31, Agents & Voyager Slide # 11
Accessing the Server

package whitney.voyager.examples.hello;
import com.objectspace.voyager.Voyager;
import com.objectspace.voyager.Namespace;

public class HelloUserLookup
   {
   public static void main(String args[])
      {
      try
         {
         Voyager.startup();
         Hello proxy = (Hello) 
            Namespace.lookup( "//fargo.sdsu.edu:8000/Greeter");
      
         System.out.println( proxy.sayHello());
         Voyager.shutdown();
         }
      catch (Exception voyagerProblem)
         {
         voyagerProblem.printStackTrace();
         }
      }

Doc 31, Agents & Voyager Slide # 12

Mobile Code Example

This example uses the Hello and HelloImpl classes with one change. The HelloImpl must also implement Serializable to make it mobile.
Hello Interface
package whitney.voyager.examples.hello;
public interface Hello
   {
   String sayHello();
   }
HelloImplmentation
package whitney.voyager.examples.hello;
import java.net.InetAddress;
public class HelloImpl implements Hello, java.io.Serializable
   {
   private int count = 0;
   
   public String sayHello() 
      {
      return  "Hello World from " + getHostName() + " count " + count++;
      }
   protected static String getHostName()
      {
      try
         {
         return InetAddress.getLocalHost().getHostName();
         }
      catch (java.net.UnknownHostException who)
         {
         return "Unknown";
         }
      }
   }

Doc 31, Agents & Voyager Slide # 13
Moving the Object
package whitney.voyager.examples.hello;
import com.objectspace.voyager.Factory;
import com.objectspace.voyager.Voyager;
import com.objectspace.voyager.Proxy;
import com.objectspace.voyager.mobility.Mobility;
import com.objectspace.voyager.mobility.IMobility;
public class HelloMover
   {
   public static void main(String args[])
      {
      try 
         {
         // Start local Voyager system
         Voyager.startup();
         String serverClass =  "whitney.voyager.examples.hello.HelloImpl";
         // Create object locally
         Proxy aProxy =  Factory.create( serverClass);
         Hello helloProxy = (Hello) aProxy;
         System.out.println( helloProxy.sayHello());
         // Create the mover
         IMobility mover = Mobility.of( helloProxy );
         // Move the object and reference it
         mover.moveTo( "//fargo.sdsu.edu:8000" );
         System.out.println( helloProxy.sayHello());
         // Move the object and reference it again
         mover.moveTo( "//eli.sdsu.edu:8000" );
         System.out.println( helloProxy.sayHello());
         // Destroy the object and shutdown
         Voyager.shutdown();
         } 
      catch (Exception e) 
         {
         e.printStackTrace();
         }
      }
   }

Doc 31, Agents & Voyager Slide # 14
Example Output
Hello World from cx137265-a.fed1.sdca.home.com count 0
Hello World from fargo.sdsu.edu count 1
Hello World from eli.sdsu.edu count 2
Running the Example

On fargo
Run voyager with command:

voyager 8000 &

Make sure the classes Hello and HelloImpl are in the classpath of the voyager process

On eli
Run voyager with command:

voyager 8000 &

Make sure the classes Hello and HelloImpl are in the classpath of the voyager process

On my mac

Run the program HelloMover, which needs the classes Hello and HelloImpl

Copyright ©, All rights reserved.
1999 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 29-Apr-99    Next