source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_CombiAvg.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: 2.6 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.Map;
4
5import genius.core.BidHistory;
6import genius.core.boaframework.AcceptanceStrategy;
7import genius.core.boaframework.Actions;
8import genius.core.boaframework.NegotiationSession;
9import genius.core.boaframework.OfferingStrategy;
10import genius.core.boaframework.OpponentModel;
11
12/**
13 * This is the decoupled Acceptance Conditions Based on Tim Baarslag's paper on
14 * Acceptance Conditions: "Acceptance Conditions in Automated Negotiation"
15 *
16 * This Acceptance Condition averages the opponents bids made in the previous
17 * time window. If the bid is higher than the average it will accept
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
23 */
24public class AC_CombiAvg extends AcceptanceStrategy {
25
26 private double time;
27
28 /**
29 * Empty constructor for the BOA framework.
30 */
31 public AC_CombiAvg() {
32 }
33
34 public AC_CombiAvg(NegotiationSession negoSession, OfferingStrategy strat, double t) {
35 this.negotiationSession = negoSession;
36 this.offeringStrategy = strat;
37 this.time = t;
38 }
39
40 @Override
41 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
42 Map<String, Double> parameters) throws Exception {
43 this.negotiationSession = negoSession;
44 if (parameters.get("t") != null) {
45 time = parameters.get("t");
46 } else {
47 throw new Exception("Paramaters were not correctly set");
48 }
49 }
50
51 @Override
52 public String printParameters() {
53 return "[t: " + time + "]";
54 }
55
56 @Override
57 public Actions determineAcceptability() {
58 if (negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= offeringStrategy
59 .getNextBid().getMyUndiscountedUtil()) {
60 return Actions.Accept;
61 }
62
63 if (negotiationSession.getTime() < time) {
64 return Actions.Reject;
65 }
66
67 double offeredUndiscountedUtility = negotiationSession.getOpponentBidHistory().getLastBidDetails()
68 .getMyUndiscountedUtil();
69 double now = negotiationSession.getTime();
70 double timeLeft = 1 - now;
71
72 double window = timeLeft;
73 BidHistory recentBids = negotiationSession.getOpponentBidHistory().filterBetweenTime(now - window, now);
74
75 double avgOfBetterBids = recentBids.getAverageUtility();
76 double expectedUtilOfWaitingForABetterBid = avgOfBetterBids;
77
78 if (offeredUndiscountedUtility >= expectedUtilOfWaitingForABetterBid)
79 return Actions.Accept;
80 return Actions.Reject;
81 }
82
83 @Override
84 public String getName() {
85 return "Other - CombiAvg";
86 }
87}
Note: See TracBrowser for help on using the repository browser.