package onetomany.bargainingchipsgame; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import onetomany.bargainingchipsgame.interactions.Offer; import onetomany.bargainingchipsgame.players.Agent; import onetomany.bargainingchipsgame.players.BoulwareNegotiationParty; import onetomany.bargainingchipsgame.players.CoordinationMessage; import onetomany.bargainingchipsgame.players.Coordinator; import onetomany.bargainingchipsgame.players.NegotiationStatusMessage; import onetomany.bargainingchipsgame.players.utilityfunction.UF_CloseToQuantity; import onetomany.bargainingchipsgame.players.utilityfunction.UtilityFunction; /** * This package describes all the fundamental concepts in Bargaining Chips Game (BCG). * * BCG rules are based on a non-alternating offer protocol in each bilateral negotiation thread. * Multiple deals via simultaneous threads in the BCG one-to-many negotiation need to be coordinated. * So the players are equipped with two modules, one coordinator and multiple negotiators one per each thread. * * One-to-Many package is dedicated to one-to-many negotiation which is a kind of negotiation different from bilateral and multilateral settings. * It is between a party which, in parallel, negotiates with many counter parties, opponents, on multiple multi-issue items. * Of course each opponent, in turn, could be in one-to-many negotiation with its own opponents including this party. * * Each of these individual negotiations is itself a bilateral negotiation over multiple items and multiple issues, a multi-issue multi-item thread. Each thread could reach a deal. * So, the whole negotiation could reach multiple deals. * * Negotiating in this atmosphere 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 Game, is a testbed dealing with these complexities. * The fundamental elements of its domain is in a package with this name (bargainingchipsname). * The players and the rules for their interactions are in packages `players' and 'interactions', respectively. * * */ public class BargainingChips { public static void main(String[] args) throws InterruptedException { // Domain domain = new Domain(); // domain.add("Red"); domain.add("Green"); domain.add("Blue"); // OutcomeSpace outcomeSpace = new OutcomeSpace(domain); BlockingQueue in = new LinkedBlockingQueue(); BlockingQueue out = new LinkedBlockingQueue(); BlockingQueue cin = new LinkedBlockingQueue(); BlockingQueue cout = new LinkedBlockingQueue(); BlockingQueue dummyin = new LinkedBlockingQueue(); BlockingQueue dummyout = new LinkedBlockingQueue(); // Bob WishList wishlist = new WishListBuilder().addWish("Green", 2).build(); UtilityFunction u = new UF_CloseToQuantity(wishlist); Agent bob1 = new BoulwareNegotiationParty("Bob 1", u, in, out, cin, cout); System.out.println(bob1.toDescription()); System.out.println("vs"); Coordinator c = new Coordinator(wishlist, cout, cin); // Sam WishList wishlistSam = new WishListBuilder().addWish("Green", 10).build(); UtilityFunction uSam = new UF_CloseToQuantity(wishlistSam); Agent sam = new BoulwareNegotiationParty("Sam 1", uSam, out, in, dummyin, dummyout); System.out.println(sam.toDescription()); Thread threadBuyer = new Thread(bob1); threadBuyer.start(); Thread threadSeller = new Thread(sam); threadSeller.start(); Thread threadCoordinator = new Thread(c); threadCoordinator.start(); } }