1 | package onetomany.bargainingchipsgame;
|
---|
2 |
|
---|
3 | import java.util.concurrent.BlockingQueue;
|
---|
4 | import java.util.concurrent.LinkedBlockingQueue;
|
---|
5 |
|
---|
6 | import onetomany.bargainingchipsgame.interactions.Offer;
|
---|
7 | import onetomany.bargainingchipsgame.players.BilateralAgent;
|
---|
8 | import onetomany.bargainingchipsgame.players.BuyerSubnegotiator;
|
---|
9 | import onetomany.bargainingchipsgame.players.CoordinationMessage;
|
---|
10 | import onetomany.bargainingchipsgame.players.Coordinator;
|
---|
11 | import onetomany.bargainingchipsgame.players.NegotiationStatusMessage;
|
---|
12 | import 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 | */
|
---|
36 | public 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 | }
|
---|