source: src/main/java/bargainingchips/BargainingChips.java@ 339

Last change on this file since 339 was 339, checked in by Faria Nassiri Mofakham, 5 years ago

BargainingChips creates bob calling BargainingBuyer. OutcomeSpace is Iterable<Bundle>, also getAllBids, getRandom, getRandom(r), getAverageUtility(u), size(), checkReadyForNegotiation, getName(), getUtility(u, b), getReservationValue(u), and getDiscountFactor added. An update on Bid getSampleBid type. An update on Agent. A history' package of BidEvent, BidEventHistory, BidEventHisoryKeeper, BidEventSortedUtility, and BidEventStrictSortedUtility added. HistoryAgent added. An analysis' package of BundleUtilityPoint, BundleUtilitySpace, and ParetoFrontier added. BargainingAgent added. TitForTatNegotiationAgent. Now, Buyer extended to BargainingBuyer which is created using Boulware or TitForTatNegotiationAgent using one among 9 utility functions. Name of strategy added toDescription in BoulwareAgent. A few small updates on several utility function classes.

File size: 2.9 KB
RevLine 
[316]1package bargainingchips;
[315]2
[338]3//import bargainingchips.players.Buyer;
[339]4import bargainingchips.players.BargainingBuyer;
[315]5
6/**
7 * This main class showcases the fundamental concepts in the Bargaining Chips game.
8 *
9 * Bargaining Chips is played by a buyer who seeks to acquire a number of chips for a good price.
10 * For example, the wish list of the buyer may consist of 2 red chips and 1 blue chip.
11 * Chips represents arbitrary indivisible items, such as products or tasks and are differentiated
12 * from others by a unique color.
13 *
14 * Bargaining Chips is played using an asynchronous offer protocol for each bilateral negotiation thread.
15 * Multiple deals in simultaneous threads of one-to-many negotiation need to be coordinated; therefore,
16 * the buyer is equipped with two modules, one coordinator and multiple negotiators one per each thread.
17 *
18 * Each of the individual negotiations is itself a bilateral negotiation over multiple items and multiple
19 * issues, i.e. a multi-issue multi-item thread. As each thread could reach a deal, the whole negotiation
20 * could reach multiple deals.
21 *
22 * Negotiating in this setting needs some coordination efforts to synchronize threads according to the
23 * progress of each individual negotiation as well as the multiple deals compared with the party's preference.
24 *
25 * Bargaining Chips is a testbed for evaluating agents in such settings.
26 *
[338]27 *
28 *@author Tim Baarslag and Faria Nassiri-Mofakham
29 *
[315]30 */
31public class BargainingChips
32{
33 public static void main(String[] args) throws InterruptedException
34 {
[331]35 WishList overallWishlist = new WishListBuilder().addWish("Green", 2).build(); // Bob wishes for 2 Green chips
[338]36
37// ChipIssueValue<Double> breakEvenPrices = new ChipIssueValueBuilder()
38// .addIssue("Red", 2.0)
39// .addIssue("Green", 4.0)
40// .build();
41// boolean priceVSQuantity = true; // True means that price is more important than quantity.
42
43 //Buyer bob = new Buyer(overallWishlist);
[339]44 BargainingBuyer bob = new BargainingBuyer(overallWishlist);//, breakEvenPrices, priceVSQuantity);
[331]45
[338]46
[315]47 // Sam
[331]48 WishList wishlistSam = new WishListBuilder().addWish("Green", 10).build(); // Sam wishes for 10 Green chips
49 String sam = "Sam";
[315]50
[331]51 // Steve
[338]52 WishList wishlistSteve = new WishListBuilder().addWish("Green", 5).build(); // Steve wishes for 5 Green chips
[331]53 String steve = "Steve";
[315]54
[338]55 // Sally
56 WishList wishlistSally = new WishListBuilder().addWish("Yellow", 6).build(); // Sam wishes for 6 Yellow chips
57 String sally = "Sally";
58
59 // Sandra
60 WishList wishlistSandra = new WishListBuilder().addWish("Orange", 2).build(); // Sandra wishes for 2 Orange chips
61 String sandra = "Sandra";
62
63
[331]64 bob.connectSeller(sam, wishlistSam);
65 bob.connectSeller(steve, wishlistSteve);
[338]66 bob.connectSeller(sally, wishlistSally);
67 bob.connectSeller(sandra, wishlistSandra);
[323]68
[331]69 bob.startThreads();
70
[315]71 }
72
73}
Note: See TracBrowser for help on using the repository browser.