1 | package negotiator.boaframework.acceptanceconditions.anac2013;
|
---|
2 |
|
---|
3 | import java.util.List;
|
---|
4 | import java.util.Map;
|
---|
5 |
|
---|
6 | import genius.core.bidding.BidDetails;
|
---|
7 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
8 | import genius.core.boaframework.Actions;
|
---|
9 | import genius.core.boaframework.NegotiationSession;
|
---|
10 | import genius.core.boaframework.OfferingStrategy;
|
---|
11 | import genius.core.boaframework.OpponentModel;
|
---|
12 | import negotiator.boaframework.opponentmodel.TheFawkes_OM;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Acceptance Strategy
|
---|
16 | *
|
---|
17 | * This is ACcombi = ACnext || ACtime(T) & ACconst(MAXw)
|
---|
18 | *
|
---|
19 | * For this implementation I used the following article: "Acceptance Conditions
|
---|
20 | * in Automated Negotion - Tim Baarslag, Koen Hindriks and Catholijn Jonker"
|
---|
21 | *
|
---|
22 | * We accept when our current bid is worse than the last bid we got from the
|
---|
23 | * opponent or when we get close to the time limit and the utility we got from
|
---|
24 | * opponent's last bid has a maximum value in a window.
|
---|
25 | */
|
---|
26 | public final class AC_TheFawkes extends AcceptanceStrategy {
|
---|
27 | private TheFawkes_OM OM;
|
---|
28 | private double minimumAcceptable;
|
---|
29 |
|
---|
30 | @Override
|
---|
31 | public void init(NegotiationSession nSession, OfferingStrategy biddingStrategy, OpponentModel oppModel,
|
---|
32 | Map<String, Double> params) throws Exception {
|
---|
33 | super.init(nSession, biddingStrategy, oppModel, params);
|
---|
34 | this.OM = (TheFawkes_OM) oppModel;
|
---|
35 |
|
---|
36 | List<BidDetails> allBids = nSession.getOutcomeSpace().getAllOutcomes();
|
---|
37 | double total = 0;
|
---|
38 | for (BidDetails bid : allBids) {
|
---|
39 | total += bid.getMyUndiscountedUtil();
|
---|
40 | }
|
---|
41 | this.minimumAcceptable = total / (double) allBids.size(); // TODO: use
|
---|
42 | // median
|
---|
43 | // instead
|
---|
44 | // of
|
---|
45 | // average
|
---|
46 | // perhaps?!
|
---|
47 | }
|
---|
48 |
|
---|
49 | @Override
|
---|
50 | public Actions determineAcceptability() {
|
---|
51 | BidDetails lastOpponentBid = this.negotiationSession.getOpponentBidHistory().getLastBidDetails();
|
---|
52 | double lastOpponentBidUtility = lastOpponentBid.getMyUndiscountedUtil();
|
---|
53 | BidDetails myNextBid = this.offeringStrategy.determineNextBid();
|
---|
54 | double myNextBidUtility = myNextBid.getMyUndiscountedUtil();
|
---|
55 | if (lastOpponentBidUtility < this.minimumAcceptable) {
|
---|
56 | // Group3_Agent.debug( "REJECT (ACavg) (" + lastOpponentBidUtility +
|
---|
57 | // "<" + this.minimumAcceptable + ")" );
|
---|
58 | return Actions.Reject;
|
---|
59 | } else if (lastOpponentBidUtility >= myNextBidUtility) {
|
---|
60 | // Group3_Agent.debug( "ACCEPT (ACnext) (" + lastOpponentBidUtility
|
---|
61 | // + ">=" + myNextBidUtility + ")" );
|
---|
62 | return Actions.Accept;
|
---|
63 | } else if (this.negotiationSession.getTime() >= (1 - this.OM.getMaxOpponentBidTimeDiff())) {
|
---|
64 | double time = this.negotiationSession.getTime();
|
---|
65 | BidDetails bestOpponentBid = this.negotiationSession.getOpponentBidHistory()
|
---|
66 | .filterBetweenTime(time - (this.OM.getMaxOpponentBidTimeDiff() * 10), time).getBestBidDetails();
|
---|
67 | double bestOpponentBidUtility = bestOpponentBid.getMyUndiscountedUtil();
|
---|
68 | if (lastOpponentBidUtility >= bestOpponentBidUtility) {
|
---|
69 | // Group3_Agent.debug( "ACCEPT (ACtime&&ACconst) (" +
|
---|
70 | // this.negotiationSession.getTime() + ">=" + ( 1 -
|
---|
71 | // this.OM.getMaxOpponentBidTimeDiff() )
|
---|
72 | // + "&&" + lastOpponentBidUtility + ">=" +
|
---|
73 | // bestOpponentBidUtility + ")" );
|
---|
74 | return Actions.Accept;
|
---|
75 | } else {
|
---|
76 | // Group3_Agent.debug( "REJECT (ACtime&&ACconst) (" +
|
---|
77 | // this.negotiationSession.getTime() + ">=" + ( 1 -
|
---|
78 | // this.OM.getMaxOpponentBidTimeDiff() )
|
---|
79 | // + "&& NOT(" + lastOpponentBidUtility + ">=" +
|
---|
80 | // bestOpponentBidUtility + "))" );
|
---|
81 | return Actions.Reject;
|
---|
82 | }
|
---|
83 | } else {
|
---|
84 | // Group3_Agent.debug( "REJECT (ACnext) (NOT(" +
|
---|
85 | // lastOpponentBidUtility + ">=" + myNextBidUtility + "))" );
|
---|
86 | return Actions.Reject;
|
---|
87 | }
|
---|
88 | }
|
---|
89 |
|
---|
90 | @Override
|
---|
91 | public String getName() {
|
---|
92 | return "2013 - TheFawkes";
|
---|
93 | }
|
---|
94 | }
|
---|