source: src/main/java/agents/anac/y2019/harddealer/HardDealer_AS.java@ 200

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

Add ANAC 2019 agents

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1package agents.anac.y2019.harddealer;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.boaframework.AcceptanceStrategy;
8import genius.core.boaframework.Actions;
9import genius.core.boaframework.BOAparameter;
10import genius.core.boaframework.NegotiationSession;
11import genius.core.boaframework.OfferingStrategy;
12import genius.core.boaframework.OpponentModel;
13import genius.core.utility.AdditiveUtilitySpace;
14
15/**
16 * This Acceptance Condition will accept an opponent bid if the utility is
17 * higher than the acceptance boundary or higher than the bid the agent is
18 * ready to present.
19 */
20public class HardDealer_AS extends AcceptanceStrategy {
21 private double a;
22 private double b;
23 private double reservationValue;
24 private double k;
25 /** Concession factor */
26 private double e;
27
28 /**
29 * Empty constructor for the BOA framework.
30 */
31 public HardDealer_AS() {
32 }
33
34 public double f(double t) {
35 // First 10% of session: Slowly come up from bids with util .9
36 if (t < .1)
37 {
38 return 20*(t-0.1)*(t-0.1);
39 }
40 else
41 {
42 if (e == 0)
43 {
44 return k;
45 }
46 double ft = k + (1 - k) * Math.pow(t, 1.0 / e);
47 return ft;
48 }
49
50 }
51
52 public double p(double t) {
53 return this.reservationValue + (1 - this.reservationValue) * (1 - f(t));
54 }
55
56 /**
57 * Method directly called after creating the party which is used to
58 * initialize the component.
59 */
60 @Override
61 public void init(NegotiationSession negoSession, OfferingStrategy strat,
62 OpponentModel opponentModel, Map<String, Double> parameters)
63 throws Exception {
64 this.negotiationSession = negoSession;
65 this.offeringStrategy = strat;
66 this.e = (1.8) / negotiationSession.getTimeline().getTotalTime();
67
68 if (parameters.get("a") != null || parameters.get("b") != null) {
69 a = parameters.get("a");
70 b = parameters.get("b");
71 } else {
72 a = 1;
73 b = 0;
74 }
75 this.reservationValue = negotiationSession.getUtilitySpace().getReservationValue();
76
77 if (parameters.get("k") != null)
78 this.k = parameters.get("k");
79 else
80 this.k = 0;
81 }
82
83 @Override
84 public String printParameters() {
85 String str = "[a: " + a + " b: " + b + "]";
86 return str;
87 }
88
89
90 /**
91 * Method which determines if the party should accept the opponent’s bid.
92 */
93 @Override
94 public Actions determineAcceptability() {
95 double normalizedTime = negotiationSession.getTime(); // Normalized time
96
97 //CURVE Accepting
98 double acceptationValue = p(normalizedTime);
99
100 double nextMyBidUtil = offeringStrategy.getNextBid()
101 .getMyUndiscountedUtil(); // The next bid to propose
102 double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory()
103 .getLastBidDetails().getMyUndiscountedUtil();
104 if ((a * lastOpponentBidUtil + b >= nextMyBidUtil) || (a * lastOpponentBidUtil + b >= acceptationValue)) {
105 return Actions.Accept;
106 }
107 // Otherwise reject
108 return Actions.Reject;
109 }
110
111 @Override
112 public Set<BOAparameter> getParameterSpec() {
113
114 Set<BOAparameter> set = new HashSet<BOAparameter>();
115 set.add(new BOAparameter("a", 1.0,
116 "Accept when the opponent's utility * a + b is greater than "
117 + "the utility of our current bid or our acceptance boundary"));
118 set.add(new BOAparameter("b", 0.0,
119 "Accept when the opponent's utility * a + b is greater than "
120 + "the utility of our current bid or our acceptance boundary"));
121
122 return set;
123 }
124
125 @Override
126 public String getName() {
127 return "HardDealer_AS";
128 }
129}
Note: See TracBrowser for help on using the repository browser.