source: src/main/java/onetomany/bargainingchipsgame/BargainingChips.java@ 282

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

WishList created

File size: 3.0 KB
Line 
1package onetomany.bargainingchipsgame;
2
3import java.util.concurrent.BlockingQueue;
4import java.util.concurrent.LinkedBlockingQueue;
5
6import onetomany.bargainingchipsgame.interactions.Offer;
7import onetomany.bargainingchipsgame.players.BilateralAgent;
8import onetomany.bargainingchipsgame.players.BuyerSubnegotiator;
9import onetomany.bargainingchipsgame.players.CoordinationMessage;
10import onetomany.bargainingchipsgame.players.Coordinator;
11import onetomany.bargainingchipsgame.players.NegotiationStatusMessage;
12import onetomany.bargainingchipsgame.players.Seller;
13
14/**
15 * This package describes all the fundamental concepts in Bargaining Chips Game (BCG).
16 *
17 * BCG rules are based on a non-alternating offer protocol in each bilateral negotiation thread.
18 * Multiple deals via simultaneous threads in the BCG one-to-many negotiation need to be coordinated.
19 * So the players are equipped with two modules, one coordinator and multiple negotiators one per each thread.
20 *
21 * One-to-Many package is dedicated to one-to-many negotiation which is a kind of negotiation different from bilateral and multilateral settings.
22 * It is between a party which, in parallel, negotiates with many counter parties, opponents, on multiple multi-issue items.
23 * Of course each opponent, in turn, could be in one-to-many negotiation with its own opponents including this party.
24 *
25 * 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.
26 * So, the whole negotiation could reach multiple deals.
27 *
28 * 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.
29 *
30 * Bargaining Chips Game, is a testbed dealing with these complexities.
31 * The fundamental elements of its domain is in a package with this name (bargainingchipsname).
32 * The players and the rules for their interactions are in packages `players' and 'interactions', respectively.
33 *
34 *
35 */
36public class BargainingChips
37{
38 public static void main(String[] args) throws InterruptedException
39 {
40 BlockingQueue<Offer> in = new LinkedBlockingQueue<Offer>();
41 BlockingQueue<Offer> out = new LinkedBlockingQueue<Offer>();
42
43 BlockingQueue<CoordinationMessage> cin = new LinkedBlockingQueue<CoordinationMessage>();
44 BlockingQueue<NegotiationStatusMessage> cout = new LinkedBlockingQueue<NegotiationStatusMessage>();
45
46 WishList wishlist = new WishListBuilder().addWish("Red", 3).addWish("Green", 2).build();
47
48 BilateralAgent bob1 = new BuyerSubnegotiator("Bob 1", in, out, cin, cout);
49 BilateralAgent sam = new Seller("Sam", out, in);
50 Coordinator c = new Coordinator(cout, cin);
51
52 Thread threadBuyer = new Thread(bob1);
53 threadBuyer.start();
54
55 Thread threadSeller = new Thread(sam);
56 threadSeller.start();
57
58 Thread threadCoordinator = new Thread(c);
59 threadCoordinator.start();
60 }
61
62}
Note: See TracBrowser for help on using the repository browser.