source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_Uncertain.java

Last change on this file was 161, checked in by Tim Baarslag, 6 years ago

Reordered BOA repository and added documentation

File size: 1.7 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.List;
4
5import genius.core.Bid;
6import genius.core.boaframework.AcceptanceStrategy;
7import genius.core.boaframework.Actions;
8import 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 */
20public 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}
Note: See TracBrowser for help on using the repository browser.