source: src/main/java/negotiator/boaframework/acceptanceconditions/anac2013/AC_TheFawkes.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.7 KB
Line 
1package negotiator.boaframework.acceptanceconditions.anac2013;
2
3import java.util.List;
4import java.util.Map;
5
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;
12import 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 */
26public 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}
Note: See TracBrowser for help on using the repository browser.