CS 696 Emerging Technologies: Java Distributed Computing Spring Semester, 1999 Agents & Voyager |
||
---|---|---|
© 1999, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 29-Apr-99 |
What is an Agent
Some agent characteristics:
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.
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
Voyager Features This list is modified from ObjectSpace’s literature on Voyager
Remote-Enabling a Class
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"; } } }
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(); } } }
Running the Example
Server Side
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(); } } }
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(); } }
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"; } } }
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(); } } }
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 2Running 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