Assignment #4

Assignment #4

1. Read Chapter 10 – Market Place Application
This chapter develops the idea of multiple, autonomous agents that can interact with each other and do useful work. The focus is on an application that works in a marketplace environment where there are buyer and seller agents. The buyer and seller agents cooperate and compete to process sales transactions for their owners. A facilitator agent is also presented who functions as a manager for the market place. Both rule-based inferencing and hard-coded logic are used in the negotiation strategies.

The Facilitator Agent acts as a mediator between the Buyer and Seller Agents. No direct communications occur between the Buyer and Seller Agents. The process flow looks like this:
a) The Buyer asks the Facilitator to recommend a Seller for an item.
b) The Facilitator tells the Buyer the name of the Seller.
c) The Buyer asks the Seller (through the Facilitator) if the Seller has this item available.
d) The Seller either performs a make-offer to the Buyer, along with an asking price, or will deny that it has the item for sale.
e) The Buyer can then reply with a price, either accepting the offer or making a counter offer.
f) The Seller can accept the price, make a counter offer, or reject the offered price.
g) If the Seller accepts the offer, it will tell the Buyer.
h) If the Seller rejects the offer, the negotiation is over.

2. Implement the MarketPlace application, which includes: FacilitatorAgent, BuyerAgent, and SellerAgent. Report on the results of your implementation effort: what worked, did not work, what you experimented with etc., and sample outputs with descriptions of what is happening (i.e.: some documentation).

I created a new folder for this application and copied the CIAgent, Rule, and Marketplace source files to it. I then created a new Project in NetBeans using the existing Java source option and added the source folders above.

Image1.png

As I have done previously to make things compile, I changed the Source Level to 1.3 and targeted version 4 of the Java Runtime. I then established the Main Class as marketplace.MarketplaceApp. When I commanded NetBeans to Clean and Build the Project it did so successfully. Whoohoo! This is the first time that I got things to work on the first try.

I then executed the jar file and the application came up. To start the application running I used File-Start. The first thing that happens is the Facilitator determines what Sellers are available and what items they have to sell.

Image2.png

In this particular example the Buyer has a short list of items to buy: a guitar for $100, a set of drums for $200, and another guitar for $100. We can see the messages as the transaction takes place. The Facilitator matches up the Buyer with a Seller that has a guitar. The Seller wants $200 for the guitar. The Buyer decides to lowball the Seller with a counter offer of $175. The Seller decides to accept the lower price and the transaction is completed.

Image3.png

The Buyer then continues to purchase the items on the list using the same strategy of counter offering each time. Further exploration of the application identifies that the default is to configure “Basic” Buyers and Sellers.

Image4.png

The BasicBuyer Agent uses a fairly simple strategy. It has a hard coded price that it wants to purchase the items for. The text refers to this as the strikeprice. The agent first checks to see if the offer from the seller is equal or less than the strikeprice. If so then it buys it. If not it simply counter offers $25 less than the sellers asking price. If the seller accepts the counter offer the agent completes the transaction. This is obviously not a very desirable behavior. In the example, the Buyer had only wanted to pay $400 for the three items,

// add items to buy on wish list
wishList.addElement(new BasicNegotiation(“guitar”, 100));
wishList.addElement(new BasicNegotiation(“drums”, 200));
wishList.addElement(new BasicNegotiation(“guitar”, 100));

yet it ended up paying $650! I think I would fire this agent!

Image5.png

The BetterBuyer Agent adds some negotiating flexibility by taking into account the delta between the want price and the offered price. Depending upon the spread it counter offers 75, 50 or 25 dollars less than the asking price. I ran the application again and set the Buyer Agent to Intermediate and left the Seller Agent at Basic. This time the Buyer agent did much better and managed to purchase the items for $575, but still it was quite a bit higher than desired.

The BestBuyer Agent did even better against the Basic Seller Agent coming in at $500. I decided to put both agents at the Advanced level and see what happened.

BestBuyer is looking to buy guitar
BestBuyer has purchased 2 items for 355
BestSeller: Offer from BestBuyer: content is drums BestSeller2 240
BestBuyer: Offer from BestSeller: content is guitar BestSeller3 200
BestSeller: Offer from BestBuyer: content is guitar BestSeller3 125
BestBuyer: Offer from BestSeller: content is guitar BestSeller3 175
BestSeller: Offer from BestBuyer: content is guitar BestSeller3 125
BestBuyer: Offer from BestSeller: content is guitar BestSeller3 165
BestSeller: Offer from BestBuyer: content is guitar BestSeller3 115
BestBuyer: Offer from BestSeller: content is guitar BestSeller3 115
BestBuyer: OK — sale of item guitar with id BestSeller3 at price of 115 is complete
BestBuyer: guitar purchased!

Here we can see the added negotiating features of the BestBuyer Agent. Instead of starting from the Sellers asking price and negotiating down it starts from it’s want price and counter offers $25 higher. It sticks to this price (ahh…a top dollar price) and waits for the seller to come down. Oddly, it lowers the offer by $10 towards the end, which I assume is a factor of the delta between the want price and the seller’s latest offer. This may not be the real intent but it works.

3. Conclusion – This application provides a good basic demonstration of how agents can interact in a multi-agent system and the inherent complexities of building a system robust enough to transact real business. The level of domain knowledge that would need to be programmed into an agent such that you could truly trust the agent with critical items would, I think, be astonishing.

Hard-coding the interaction logic would be a ridiculous approach unless you were dealing with something that never changed; an unlikely event. I think a more productive approach would be to develop the interaction logic around XML files. The user could then use a simple application to create XML data files with precise negotiation instructions for the “guitar” they wished to purchase.

Another significant problem that would have to be dealt with in this day and age is that of identification and authentication of your agents. How would a seller agent know for sure you’re your agent is legit? Or, that it has not been infected by a virus and is now negotiating for someone else with their shipping information but your bank account information?

4. Bonus – I found an open-source implementation of a distributed multi-agent system that was built to support a Defense Dept. logistics system. Cougaar is a Java-based architecture for the construction of highly scalable distributed agent-based applications. Cougaar is the product of a multi-year DARPA research project to develop an open-source agent-based architecture that supports applications ranging from small-scale systems to large-scale highly-survivable distributed systems. Cougaar includes an advanced core architecture and a variety of components that simplify the development, visualization, and management of complex distributed applications.

COUGAAR is an acronym for “Cognitive Agent Architecture,” due to the Cougaar planning domain’s model of Tasks, Workflows, Expansion, and Aggregation. This is a legacy definition, since the architecture has been refactored to a comprehensive agent-based middleware that also supports non-planning applications.

The code comes with several tutorial applications which I decided to try. The more interesting one is based on a Pizza Party Planner. The Pizza Party Application shows 8 Cougaar agents split across two processes (“Nodes”), planning a pizza party.

This simple application shows Cougaar agents acting as social planners for 4 friends: Alice, Bob, Mark, and Tony. Alice is planning a pizza party. Her Cougaar Agent takes care of inviting all her friends on her buddy list “FriendsOfMark” (maybe it’s a surprise party for Mark?). The Agents for Bob, Mark, and Tony take care of answering for them. Because it is a pizza party, they must tell Alice whether they like “Meat” or “Veggie” pizza.

Once Alice knows how much of what kinds of pizza to order, she must find a Pizza Provider. Pizza Providers sell “Meat” and/or “Veggie” pizzas — and Alice wants to order all her pizza from one provider.

This sample includes 2 versions of the application, to show more Cougaar features. The first version (“non SD” – use “pizza/configs/pizzaparty/PizzaNode1.xml” and “PizzaNode2.xml”) shows a static relationships between Alice and a Pizza Provider, “JoesLocalPizzaShack”. In this example, the relationship between Alice is pre-configured, and Alice has no way to find any other providers. In our example, Joes only sells Meat pizza – so some of Alice’s guests will not be happy, and her planning fails!

In the second version (“SD” – use “SDPizzaNode1.xml” and “SDPizzaNode2.xml”), Alice knows how to do “Service Discovery”. She does look-ups in the Yellow Pages, where pizza parlors advertise their services. This is how she finds Joes originally, and this is how she can find a new provider, if Joes isn’t good enough.

I installed the Cougaar framework and launched the tutorial programs (one window for each “node”). The application launched and the agents began communicating.

Image6.png

Image7.png

I liked this application because it had the added feature of “Service Discovery”. When Joe’s Pizza Shack could not handle the Veggie Pizza the program went out and found someone who could.

There is also a browser interface that you can use to see what’s happening.

Image8.png

Once all the RSVP’s are in and a provider is found, the orders are placed.

Image9.png

I would encourage anyone who is interested in seeing some real multi-agent code to check out this resource. Cougaar is an open source project. Release builds and source code are available on our website: http://www.cougaar.org.

To get started you might want to look at the FAQ: http://cougaar.org/docman/view.php/17/55/FAQ.html