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

Last change on this file since 343 was 340, checked in by Tim Baarslag, 5 years ago

Change BilateralProtocol loop to avoid busy wait; note that this fixes only a part of the busy wait problem.

Package structure now in line with latest Acumex discussions.

Pinpointed error avoidance in Agent.

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