1 | package negotiator.boaframework.acceptanceconditions.other;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
6 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
7 | import genius.core.boaframework.Actions;
|
---|
8 | import genius.core.uncertainty.UserModel;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * Accepts:
|
---|
12 | * <ul>
|
---|
13 | * <li>if we have uncertainty profile, and we receive an offer in our highest
|
---|
14 | * 10% best bids.
|
---|
15 | * <li>if we have normal utilityspace, and we receive offer with a utility
|
---|
16 | * better than 90% of what we offered last.
|
---|
17 | * </ul>
|
---|
18 | * Discount is ignored.
|
---|
19 | */
|
---|
20 | public class AC_Uncertain extends AcceptanceStrategy {
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public Actions determineAcceptability()
|
---|
24 | {
|
---|
25 | Bid receivedBid = negotiationSession.getOpponentBidHistory()
|
---|
26 | .getLastBid();
|
---|
27 | Bid lastOwnBid = negotiationSession.getOwnBidHistory().getLastBid();
|
---|
28 | if (receivedBid == null || lastOwnBid == null) {
|
---|
29 | return Actions.Reject;
|
---|
30 | }
|
---|
31 |
|
---|
32 | UserModel userModel = negotiationSession.getUserModel();
|
---|
33 | if (userModel != null) {
|
---|
34 | List<Bid> bidOrder = userModel.getBidRanking().getBidOrder();
|
---|
35 | if (bidOrder.contains(receivedBid)) {
|
---|
36 | double percentile = (bidOrder.size()
|
---|
37 | - bidOrder.indexOf(receivedBid))
|
---|
38 | / (double) bidOrder.size();
|
---|
39 | if (percentile < 0.1)
|
---|
40 | return Actions.Accept;
|
---|
41 | }
|
---|
42 | } else {
|
---|
43 | // we have a normal utilityspace
|
---|
44 | double otherLastUtil = negotiationSession.getUtilitySpace()
|
---|
45 | .getUtility(receivedBid);
|
---|
46 | double myLastUtil = negotiationSession.getUtilitySpace()
|
---|
47 | .getUtility(lastOwnBid);
|
---|
48 | if (otherLastUtil >= 0.9 * myLastUtil) {
|
---|
49 | return Actions.Accept;
|
---|
50 | }
|
---|
51 | }
|
---|
52 | return Actions.Reject;
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Override
|
---|
56 | public String getName() {
|
---|
57 | return "Accept 10% best, supports uncertainty";
|
---|
58 | }
|
---|
59 | } |
---|