1 | package boa.components.Top3Agent;
|
---|
2 |
|
---|
3 | import genius.core.Bid;
|
---|
4 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
5 | import genius.core.boaframework.Actions;
|
---|
6 | import genius.core.uncertainty.User;
|
---|
7 | import genius.core.uncertainty.UserModel;
|
---|
8 | import java.util.List;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Acceptance strategy of the Top 3 Agent which
|
---|
12 | * UNDER UNCERTAINTY: accepts only if it receives an offer in the top 3 bids available OR Total bother > 0.2.
|
---|
13 | * The agent also elicits the received bid of the opponent at every round.
|
---|
14 | * OTHERWISE: accepts only if it receives the highest bid.
|
---|
15 | * @author: Adel Magra
|
---|
16 | */
|
---|
17 |
|
---|
18 | public class AC_Top3 extends AcceptanceStrategy {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Accepts: if the received bid is one of the top 3 in the current user model augmented with it.
|
---|
22 | * OR the total bother inflicted to the user is greater than 0.2
|
---|
23 | */
|
---|
24 |
|
---|
25 | public Actions determineAcceptability() {
|
---|
26 |
|
---|
27 | Bid receivedBid = negotiationSession.getOpponentBidHistory()
|
---|
28 | .getLastBid();
|
---|
29 | if (receivedBid == null) {
|
---|
30 | return Actions.Reject;
|
---|
31 | }
|
---|
32 | UserModel userModel = negotiationSession.getUserModel();
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Uncertainty case
|
---|
36 | */
|
---|
37 | if (userModel != null) {
|
---|
38 | User user = negotiationSession.getUser();
|
---|
39 |
|
---|
40 | //Accepts if bother is too large
|
---|
41 | if(user.getTotalBother() > 0.2)
|
---|
42 | return Actions.Accept;
|
---|
43 |
|
---|
44 | List<Bid> bidOrder = userModel.getBidRanking().getBidOrder();
|
---|
45 | System.out.println(bidOrder.size());
|
---|
46 | //Elicits the received bid
|
---|
47 | userModel = user.elicitRank(receivedBid,userModel);
|
---|
48 | bidOrder = userModel.getBidRanking().getBidOrder();
|
---|
49 | int rankOfBid = bidOrder.indexOf(receivedBid);
|
---|
50 |
|
---|
51 | //Accepts if receivedBid is one of the top 3 bids in the user model
|
---|
52 | if (rankOfBid > bidOrder.size()-4){
|
---|
53 | return Actions.Accept;
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * Normal Utility Space
|
---|
59 | */
|
---|
60 | else if(receivedBid.equals(negotiationSession.getMaxBidinDomain().getBid()))
|
---|
61 | return Actions.Accept;
|
---|
62 |
|
---|
63 | return Actions.Reject;
|
---|
64 | }
|
---|
65 |
|
---|
66 | public String getName() {
|
---|
67 | return "AC_Top3";
|
---|
68 | }
|
---|
69 |
|
---|
70 |
|
---|
71 |
|
---|
72 | }
|
---|