1 | package bilateralexamples.boacomponents;
|
---|
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 | Bid receivedBid = negotiationSession.getOpponentBidHistory()
|
---|
25 | .getLastBid();
|
---|
26 | Bid lastOwnBid = negotiationSession.getOwnBidHistory().getLastBid();
|
---|
27 | if (receivedBid == null || lastOwnBid == null) {
|
---|
28 | return Actions.Reject;
|
---|
29 | }
|
---|
30 |
|
---|
31 | UserModel userModel = negotiationSession.getUserModel();
|
---|
32 | if (userModel != null) {
|
---|
33 | List<Bid> bidOrder = userModel.getBidRanking().getBidOrder();
|
---|
34 | if (bidOrder.contains(receivedBid)) {
|
---|
35 | double percentile = (bidOrder.size()
|
---|
36 | - bidOrder.indexOf(receivedBid))
|
---|
37 | / (double) bidOrder.size();
|
---|
38 | if (percentile < 0.1)
|
---|
39 | return Actions.Accept;
|
---|
40 | }
|
---|
41 | } else {
|
---|
42 | // we have a normal utilityspace
|
---|
43 | double otherLastUtil = negotiationSession.getUtilitySpace()
|
---|
44 | .getUtility(receivedBid);
|
---|
45 | double myLastUtil = negotiationSession.getUtilitySpace()
|
---|
46 | .getUtility(lastOwnBid);
|
---|
47 | if (otherLastUtil >= 0.9 * myLastUtil) {
|
---|
48 | return Actions.Accept;
|
---|
49 | }
|
---|
50 | }
|
---|
51 | return Actions.Reject;
|
---|
52 | }
|
---|
53 |
|
---|
54 | @Override
|
---|
55 | public String getName() {
|
---|
56 | return "AC uncertainty example";
|
---|
57 | }
|
---|
58 | } |
---|