package bargainingchips; //import bargainingchips.players.Buyer; import bargainingchips.players.BargainingBuyer; /** * This main class showcases the fundamental concepts in the Bargaining Chips game. * * Bargaining Chips is played by a buyer who seeks to acquire a number of chips for a good price. * For example, the wish list of the buyer may consist of 2 red chips and 1 blue chip. * Chips represents arbitrary indivisible items, such as products or tasks and are differentiated * from others by a unique color. * * Bargaining Chips is played using an asynchronous offer protocol for each bilateral negotiation thread. * Multiple deals in simultaneous threads of one-to-many negotiation need to be coordinated; therefore, * the buyer is equipped with two modules, one coordinator and multiple negotiators one per each thread. * * Each of the individual negotiations is itself a bilateral negotiation over multiple items and multiple * issues, i.e. a multi-issue multi-item thread. As each thread could reach a deal, the whole negotiation * could reach multiple deals. * * Negotiating in this setting needs some coordination efforts to synchronize threads according to the * progress of each individual negotiation as well as the multiple deals compared with the party's preference. * * Bargaining Chips is a testbed for evaluating agents in such settings. * * *@author Tim Baarslag and Faria Nassiri-Mofakham * */ public class BargainingChips { public static void main(String[] args) throws InterruptedException { WishList overallWishlist = new WishListBuilder().addWish("Green", 2).build(); // Bob wishes for 2 Green chips // ChipIssueValue breakEvenPrices = new ChipIssueValueBuilder() // .addIssue("Red", 2.0) // .addIssue("Green", 4.0) // .build(); // boolean priceVSQuantity = true; // True means that price is more important than quantity. //Buyer bob = new Buyer(overallWishlist); BargainingBuyer bob = new BargainingBuyer(overallWishlist);//, breakEvenPrices, priceVSQuantity); // Sam WishList wishlistSam = new WishListBuilder().addWish("Green", 10).build(); // Sam wishes for 10 Green chips String sam = "Sam"; // Steve WishList wishlistSteve = new WishListBuilder().addWish("Green", 5).build(); // Steve wishes for 5 Green chips String steve = "Steve"; // Sally WishList wishlistSally = new WishListBuilder().addWish("Yellow", 6).build(); // Sam wishes for 6 Yellow chips String sally = "Sally"; // Sandra WishList wishlistSandra = new WishListBuilder().addWish("Orange", 2).build(); // Sandra wishes for 2 Orange chips String sandra = "Sandra"; bob.connectSeller(sam, wishlistSam); bob.connectSeller(steve, wishlistSteve); bob.connectSeller(sally, wishlistSally); bob.connectSeller(sandra, wishlistSandra); bob.startThreads(); } }