[268] | 1 | package onetomany.bargainingchipsgame;
|
---|
| 2 |
|
---|
[269] | 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;
|
---|
[273] | 8 | import onetomany.bargainingchipsgame.players.BuyerSubnegotiator;
|
---|
[278] | 9 | import onetomany.bargainingchipsgame.players.CoordinationMessage;
|
---|
[279] | 10 | import onetomany.bargainingchipsgame.players.Coordinator;
|
---|
[278] | 11 | import onetomany.bargainingchipsgame.players.NegotiationStatusMessage;
|
---|
[273] | 12 | import onetomany.bargainingchipsgame.players.Seller;
|
---|
[269] | 13 |
|
---|
[268] | 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.
|
---|
[272] | 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 | *
|
---|
[268] | 34 | *
|
---|
| 35 | */
|
---|
| 36 | public class BargainingChips
|
---|
| 37 | {
|
---|
[269] | 38 | public static void main(String[] args) throws InterruptedException
|
---|
[268] | 39 | {
|
---|
[269] | 40 | BlockingQueue<Offer> in = new LinkedBlockingQueue<Offer>();
|
---|
| 41 | BlockingQueue<Offer> out = new LinkedBlockingQueue<Offer>();
|
---|
[268] | 42 |
|
---|
[279] | 43 | BlockingQueue<CoordinationMessage> cin = new LinkedBlockingQueue<CoordinationMessage>();
|
---|
[278] | 44 | BlockingQueue<NegotiationStatusMessage> cout = new LinkedBlockingQueue<NegotiationStatusMessage>();
|
---|
| 45 |
|
---|
[281] | 46 | WishList wishlist = new WishListBuilder().addWish("Red", 3).addWish("Green", 2).build();
|
---|
| 47 |
|
---|
[278] | 48 | BilateralAgent bob1 = new BuyerSubnegotiator("Bob 1", in, out, cin, cout);
|
---|
[274] | 49 | BilateralAgent sam = new Seller("Sam", out, in);
|
---|
[280] | 50 | Coordinator c = new Coordinator(cout, cin);
|
---|
[268] | 51 |
|
---|
[273] | 52 | Thread threadBuyer = new Thread(bob1);
|
---|
| 53 | threadBuyer.start();
|
---|
[269] | 54 |
|
---|
[273] | 55 | Thread threadSeller = new Thread(sam);
|
---|
| 56 | threadSeller.start();
|
---|
[279] | 57 |
|
---|
| 58 | Thread threadCoordinator = new Thread(c);
|
---|
| 59 | threadCoordinator.start();
|
---|
[268] | 60 | }
|
---|
| 61 |
|
---|
| 62 | }
|
---|