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

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

An extended version of Buyer (BuyerExtended), which can be constructed using one among many utility functions. UF_LessPrice and seven complex utility functions based on price+quantity and two types of weights: UF_LessPriceCloseToQuantity, UF_IntensifiedLessPriceCloseToQuantity, UF_PeakedPricePeakedQuantity, UF_PeakedFlatPricePeakedFlatQuantity, UF_PeakedFlatCurvePriceGaussianQuantity, UF_BezierPriceBezierQuantity, and UF_BezierPriceGaussianQuantity. Two more fundamental helper classes: ChipIssueValue, ChipIssueValueBuilder. Adding a validity check to Stack. An update in Bundle main. Adding getSampleBid function to Bid. An update in k variable in Agent. A UF class and UtilityHelperMethods for individual passing utility functions. Adding some more tests in UF_CloseToQuantity main. An update on BundleTest.

File size: 2.9 KB
Line 
1package bargainingchips;
2
3//import bargainingchips.players.Buyer;
4import bargainingchips.players.BuyerExtended;
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 *
27 *
28 *@author Tim Baarslag and Faria Nassiri-Mofakham
29 *
30 */
31public class BargainingChips
32{
33 public static void main(String[] args) throws InterruptedException
34 {
35 WishList overallWishlist = new WishListBuilder().addWish("Green", 2).build(); // Bob wishes for 2 Green chips
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);
44 BuyerExtended bob = new BuyerExtended(overallWishlist);//, breakEvenPrices, priceVSQuantity);
45
46
47 // Sam
48 WishList wishlistSam = new WishListBuilder().addWish("Green", 10).build(); // Sam wishes for 10 Green chips
49 String sam = "Sam";
50
51 // Steve
52 WishList wishlistSteve = new WishListBuilder().addWish("Green", 5).build(); // Steve wishes for 5 Green chips
53 String steve = "Steve";
54
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
64 bob.connectSeller(sam, wishlistSam);
65 bob.connectSeller(steve, wishlistSteve);
66 bob.connectSeller(sally, wishlistSally);
67 bob.connectSeller(sandra, wishlistSandra);
68
69 bob.startThreads();
70
71 }
72
73}
Note: See TracBrowser for help on using the repository browser.