1 | package negotiator.boaframework.acceptanceconditions.other;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import genius.core.BidHistory;
|
---|
6 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
7 | import genius.core.boaframework.Actions;
|
---|
8 | import genius.core.boaframework.NegotiationSession;
|
---|
9 | import genius.core.boaframework.OfferingStrategy;
|
---|
10 | import 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 (which are better than
|
---|
17 | * the bid that was offered) made in the previous time window. If the bid is
|
---|
18 | * higher than the average it will accept
|
---|
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 | */
|
---|
25 | public class AC_CombiBestAvg extends AcceptanceStrategy {
|
---|
26 |
|
---|
27 | private double time;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Empty constructor for the BOA framework.
|
---|
31 | */
|
---|
32 | public AC_CombiBestAvg() {
|
---|
33 | }
|
---|
34 |
|
---|
35 | public AC_CombiBestAvg(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 | double offeredUndiscountedUtility = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
69 | .getMyUndiscountedUtil();
|
---|
70 | double now = negotiationSession.getTime();
|
---|
71 | double timeLeft = 1 - now;
|
---|
72 |
|
---|
73 | double window = timeLeft;
|
---|
74 | BidHistory recentBetterBids = negotiationSession.getOpponentBidHistory()
|
---|
75 | .filterBetween(offeredUndiscountedUtility, 1, now - window, now);
|
---|
76 |
|
---|
77 | double avgOfBetterBids = recentBetterBids.getAverageUtility();
|
---|
78 | double expectedUtilOfWaitingForABetterBid = avgOfBetterBids;
|
---|
79 |
|
---|
80 | if (offeredUndiscountedUtility >= expectedUtilOfWaitingForABetterBid)
|
---|
81 | return Actions.Accept;
|
---|
82 | return Actions.Reject;
|
---|
83 | }
|
---|
84 |
|
---|
85 | @Override
|
---|
86 | public String getName() {
|
---|
87 | return "Other - CombiBestAvg";
|
---|
88 | }
|
---|
89 |
|
---|
90 | } |
---|