source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_CombiBestAvgDiscounted.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.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 averages the opponents bids (which are better than
18 * the bid that was offered) made in the previous time window. If the bid is
19 * higher than the average it will accept
20 *
21 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
22 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
23 *
24 * @author Alex Dirkzwager
25 */
26public class AC_CombiBestAvgDiscounted extends AcceptanceStrategy {
27
28 private double time;
29
30 /**
31 * Empty constructor for the BOA framework.
32 */
33 public AC_CombiBestAvgDiscounted() {
34 }
35
36 public AC_CombiBestAvgDiscounted(NegotiationSession negoSession, OfferingStrategy strat, double t) {
37 this.negotiationSession = negoSession;
38 this.offeringStrategy = strat;
39 this.time = t;
40 }
41
42 @Override
43 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
44 Map<String, Double> parameters) throws Exception {
45 this.negotiationSession = negoSession;
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
61 BidDetails opponentLastOffer = negotiationSession.getOpponentBidHistory().getLastBidDetails();
62 if (opponentLastOffer.getMyUndiscountedUtil() >= offeringStrategy.getNextBid().getMyUndiscountedUtil()) {
63 return Actions.Accept;
64 }
65
66 if (negotiationSession.getTime() < time) {
67 return Actions.Reject;
68 }
69
70 double offeredDiscountedUtility = negotiationSession.getDiscountedUtility(opponentLastOffer.getBid(),
71 opponentLastOffer.getTime());
72 double now = negotiationSession.getTime();
73 double timeLeft = 1 - now;
74
75 double window = timeLeft;
76 BidHistory recentBetterBids = negotiationSession.getOpponentBidHistory().discountedFilterBetween(
77 offeredDiscountedUtility, 1, now - window, now, negotiationSession.getUtilitySpace());
78
79 double avgOfBetterBids = recentBetterBids.getAverageDiscountedUtility(negotiationSession.getUtilitySpace());
80 double expectedUtilOfWaitingForABetterBid = avgOfBetterBids;
81
82 if (offeredDiscountedUtility >= expectedUtilOfWaitingForABetterBid)
83 return Actions.Accept;
84 return Actions.Reject;
85 }
86
87 @Override
88 public String getName() {
89 return "Other - CombiBestAvgDiscounted";
90 }
91
92}
Note: See TracBrowser for help on using the repository browser.