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