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

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 3.0 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
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;
13
14/**
15 * This acceptance condition uses AC_next to determine when to accept. In
16 * addition, the agent also accepts when a given time has passed, and the
17 * utility of the opponent's bid is higher than a given constant.
18 *
19 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
20 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
21 *
22 * @author Alex Dirkzwager, Mark Hendrikx
23 */
24public class AC_CombiV3 extends AcceptanceStrategy {
25
26 private double a;
27 private double b;
28 private double c;
29 private double time;
30
31 /**
32 * Empty constructor for the BOA framework.
33 */
34 public AC_CombiV3() {
35 }
36
37 public AC_CombiV3(NegotiationSession negoSession, OfferingStrategy strat, double a, double b, double t, double c) {
38 this.negotiationSession = negoSession;
39 this.offeringStrategy = strat;
40 this.a = a;
41 this.b = b;
42 this.c = c;
43 this.time = t;
44 }
45
46 @Override
47 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
48 Map<String, Double> parameters) throws Exception {
49 this.negotiationSession = negoSession;
50 this.offeringStrategy = strat;
51 if (parameters.get("a") != null || parameters.get("b") != null
52 || parameters.get("c") != null && parameters.get("t") != null) {
53 a = parameters.get("a");
54 b = parameters.get("b");
55 c = parameters.get("c");
56 time = parameters.get("t");
57 } else {
58 throw new Exception("Paramaters were not correctly set");
59 }
60 }
61
62 @Override
63 public String printParameters() {
64 return "[a: " + a + " b: " + b + " t: " + time + " c: " + c + "]";
65 }
66
67 @Override
68 public Actions determineAcceptability() {
69 double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
70 double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
71 .getMyUndiscountedUtil();
72
73 double target = a * nextMyBidUtil + b;
74 if (target > 1.0) {
75 target = 1.0;
76 }
77 if (lastOpponentBidUtil >= target) {
78 return Actions.Accept;
79 }
80
81 if (negotiationSession.getTime() > time && lastOpponentBidUtil > c) {
82 return Actions.Accept;
83 }
84 return Actions.Reject;
85 }
86
87 @Override
88 public Set<BOAparameter> getParameterSpec() {
89
90 Set<BOAparameter> set = new HashSet<BOAparameter>();
91 set.add(new BOAparameter("a", 1.0, "Multiplier"));
92 set.add(new BOAparameter("b", 0.0, "Constant"));
93 set.add(new BOAparameter("c", 0.95, "Threshold"));
94 set.add(new BOAparameter("t", 0.99, "Time"));
95
96 return set;
97 }
98
99 @Override
100 public String getName() {
101 return "Other - CombiV3";
102 }
103
104}
Note: See TracBrowser for help on using the repository browser.