source: src/main/java/agents/anac/y2019/kagent/boacomponents/AC_Uncertain_Kindly.java

Last change on this file was 202, checked in by Katsuhide Fujita, 5 years ago

Add ANAC 2019 agents (3)

  • Property svn:executable set to *
File size: 2.0 KB
Line 
1package agents.anac.y2019.kagent.boacomponents;
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_Kindly extends AcceptanceStrategy {
21
22 private int loan;
23
24 public AC_Uncertain_Kindly() {
25 super();
26 this.loan = 0;
27 }
28
29 @Override
30 public Actions determineAcceptability() {
31 Bid receivedBid = negotiationSession.getOpponentBidHistory()
32 .getLastBid();
33 Bid lastOwnBid = negotiationSession.getOwnBidHistory().getLastBid();
34 if (receivedBid == null || lastOwnBid == null) {
35 return Actions.Reject;
36 }
37
38 UserModel userModel = negotiationSession.getUserModel();
39 if (userModel != null) {
40 List<Bid> bidOrder = userModel.getBidRanking().getBidOrder();
41
42
43 if (bidOrder.contains(receivedBid)) {
44 double percentile = (bidOrder.size()
45 - bidOrder.indexOf(receivedBid))
46 / (double) bidOrder.size();
47 if (percentile < 0.1)
48 return Actions.Accept;
49 }
50 } else {
51
52 // we have a normal utilityspace
53
54 double otherLastUtil = negotiationSession.getUtilitySpace()
55 .getUtility(receivedBid);
56 double myLastUtil = negotiationSession.getUtilitySpace()
57 .getUtility(lastOwnBid);
58 if (otherLastUtil >= 0.95 * myLastUtil && loan < 10) {
59 System.err.print("loan plus");
60 loan += 1;
61 return Actions.Accept;
62 } else if (otherLastUtil >= 1.05 * myLastUtil) {
63 System.err.print("loan minus");
64 loan -= 1;
65 return Actions.Accept;
66 }
67 }
68 return Actions.Reject;
69 }
70
71 @Override
72 public String getName() {
73 return "AC uncertainty example";
74 }
75}
Note: See TracBrowser for help on using the repository browser.