source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_CombiProbDiscounted.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.4 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
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_CombiProbDiscounted extends AcceptanceStrategy {
26
27 private double time;
28
29 /**
30 * Empty constructor for the BOA framework.
31 */
32 public AC_CombiProbDiscounted() {
33 }
34
35 public AC_CombiProbDiscounted(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 if (parameters.get("t") != null) {
46 time = parameters.get("t");
47 } else {
48 throw new Exception("Paramaters were not correctly set");
49 }
50 }
51
52 @Override
53 public String printParameters() {
54 return "[t: " + time + "]";
55 }
56
57 @Override
58 public Actions determineAcceptability() {
59 if (negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= offeringStrategy
60 .getNextBid().getMyUndiscountedUtil()) {
61 return Actions.Accept;
62 }
63
64 if (negotiationSession.getTime() < time) {
65 return Actions.Reject;
66 }
67
68 BidDetails opponentLastOffer = negotiationSession.getOpponentBidHistory().getLastBidDetails();
69 double offeredDiscountedUtility = negotiationSession.getDiscountedUtility(opponentLastOffer.getBid(),
70 opponentLastOffer.getTime());
71 double now = negotiationSession.getTime();
72 double timeLeft = 1 - now;
73
74 // if we will still see a lot of bids
75 BidHistory recentBids = negotiationSession.getOpponentBidHistory().filterBetweenTime(now - timeLeft, now);
76 int remainingBids = recentBids.size();
77 if (remainingBids > 10)
78 return Actions.Reject;
79
80 // v2.0
81 double window = timeLeft;
82 // double window = 5 * timeLeft;
83 BidHistory recentBetterBids = negotiationSession.getOpponentBidHistory().discountedFilterBetween(
84 offeredDiscountedUtility, 1, now - window, now, negotiationSession.getUtilitySpace());
85 int n = recentBetterBids.size();
86 double p = timeLeft / window;
87 if (p > 1)
88 p = 1;
89
90 double pAllMiss = Math.pow(1 - p, n);
91 if (n == 0)
92 pAllMiss = 1;
93 double pAtLeastOneHit = 1 - pAllMiss;
94
95 double avg = recentBetterBids.getAverageDiscountedUtility(negotiationSession.getUtilitySpace());
96
97 double expectedUtilOfWaitingForABetterBid = pAtLeastOneHit * avg;
98
99 if (offeredDiscountedUtility > expectedUtilOfWaitingForABetterBid)
100 return Actions.Accept;
101
102 return Actions.Reject;
103 }
104
105 @Override
106 public String getName() {
107 return "Other - CombiProbDiscounted";
108 }
109
110}
Note: See TracBrowser for help on using the repository browser.