source: src/main/java/negotiator/boaframework/acceptanceconditions/anac2010/AC_AgentSmith.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: 2.1 KB
Line 
1package negotiator.boaframework.acceptanceconditions.anac2010;
2
3import java.util.Map;
4
5import genius.core.bidding.BidDetails;
6import genius.core.boaframework.AcceptanceStrategy;
7import genius.core.boaframework.Actions;
8import genius.core.boaframework.NegotiationSession;
9import genius.core.boaframework.OfferingStrategy;
10import genius.core.boaframework.OpponentModel;
11
12/**
13 * This is the decoupled Acceptance Condition from AgentSmith (ANAC2010). The
14 * code was taken from the ANAC2010 AgentSmith and adapted to work within the
15 * BOA framework.
16 *
17 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
18 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
19 *
20 * @author Alex Dirkzwager, Mark Hendrikx
21 * @version 26/12/11
22 */
23public class AC_AgentSmith extends AcceptanceStrategy {
24
25 private final double ACCEPT_MARGIN = 0.9;
26
27 /**
28 * Empty constructor for the BOA framework.
29 */
30 public AC_AgentSmith() {
31 }
32
33 public AC_AgentSmith(NegotiationSession negoSession, OfferingStrategy strat) throws Exception {
34 init(negoSession, strat, null, null);
35 }
36
37 @Override
38 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
39 Map<String, Double> parameters) throws Exception {
40 this.negotiationSession = negoSession;
41 }
42
43 @Override
44 public Actions determineAcceptability() {
45 BidDetails lastOpponentBid = negotiationSession.getOpponentBidHistory().getLastBidDetails();
46 BidDetails lastOwnBid = negotiationSession.getOwnBidHistory().getLastBidDetails();
47
48 if (lastOpponentBid != null && lastOwnBid != null) {
49 // accepts if the opponentLastBid is higher than the constant
50 // acceptMargin OR
51 // the utility of the opponents' bid is higher then ours -> accept!
52 if (lastOpponentBid.getMyUndiscountedUtil() > ACCEPT_MARGIN
53 || lastOpponentBid.getMyUndiscountedUtil() >= lastOwnBid.getMyUndiscountedUtil()) {
54 return Actions.Accept;
55 }
56 }
57 return Actions.Reject;
58 }
59
60 @Override
61 public String getName() {
62 return "2010 - AgentSmith";
63 }
64}
Note: See TracBrowser for help on using the repository browser.