source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_CombiMaxInWindow.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.1 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.BidHistory;
8import genius.core.boaframework.AcceptanceStrategy;
9import genius.core.boaframework.Actions;
10import genius.core.boaframework.BOAparameter;
11import genius.core.boaframework.NegotiationSession;
12import genius.core.boaframework.OfferingStrategy;
13import genius.core.boaframework.OpponentModel;
14
15/**
16 * This is the decoupled Acceptance Conditions Based on Tim Baarslag's paper on
17 * Acceptance Conditions: "Acceptance Conditions in Automated Negotiation"
18 *
19 * This Acceptance Condition accepts a bid if it is higher than any bid seen so
20 * far within the previous time window
21 *
22 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
23 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
24 *
25 * @author Alex Dirkzwager
26 */
27public class AC_CombiMaxInWindow extends AcceptanceStrategy {
28
29 private double time;
30
31 /**
32 * Empty constructor for the BOA framework.
33 */
34 public AC_CombiMaxInWindow() {
35 }
36
37 public AC_CombiMaxInWindow(NegotiationSession negoSession, OfferingStrategy strat, double t) {
38 this.negotiationSession = negoSession;
39 this.offeringStrategy = strat;
40 this.time = t;
41 }
42
43 @Override
44 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
45 Map<String, Double> parameters) throws Exception {
46 this.negotiationSession = negoSession;
47 this.offeringStrategy = strat;
48 if (parameters.get("t") != null) {
49 time = parameters.get("t");
50 } else {
51 throw new Exception("Parameters were not correctly set");
52 }
53 }
54
55 @Override
56 public String printParameters() {
57 return "[t: " + time + "]";
58 }
59
60 @Override
61 public Actions determineAcceptability() {
62 if (negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= offeringStrategy
63 .getNextBid().getMyUndiscountedUtil())
64 return Actions.Accept;
65
66 if (negotiationSession.getTime() < time)
67 return Actions.Reject;
68
69 double offeredUndiscountedUtility = negotiationSession.getOpponentBidHistory().getLastBidDetails()
70 .getMyUndiscountedUtil();
71 double now = negotiationSession.getTime();
72 double timeLeft = 1 - now;
73
74 // v2.0
75 double window = timeLeft;
76 BidHistory recentBids = negotiationSession.getOpponentBidHistory().filterBetweenTime(now - window, now);
77
78 double max;
79 if (recentBids.size() > 0)
80 max = recentBids.getBestBidDetails().getMyUndiscountedUtil();
81 else
82 max = 0;
83
84 // max = 0 als n = 0
85 double expectedUtilOfWaitingForABetterBid = max;
86
87 if (offeredUndiscountedUtility >= expectedUtilOfWaitingForABetterBid)
88 return Actions.Accept;
89
90 return Actions.Reject;
91 }
92
93 @Override
94 public Set<BOAparameter> getParameterSpec() {
95
96 Set<BOAparameter> set = new HashSet<BOAparameter>();
97 set.add(new BOAparameter("t", 0.98, "Time t after which the agent may accept"));
98
99 return set;
100 }
101
102 @Override
103 public String getName() {
104 return "Other - CombiMaxInWindow";
105 }
106
107}
Note: See TracBrowser for help on using the repository browser.