source: src/main/java/negotiator/boaframework/acceptanceconditions/anac2010/AC_Yushu.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.0 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;
11import negotiator.boaframework.sharedagentstate.anac2010.YushuSAS;
12
13/**
14 * This is the decoupled Acceptance Conditions for Yushu (ANAC2010). The code
15 * was taken from the ANAC2010 Yushu and adapted to work within the BOA
16 * framework.
17 *
18 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
19 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
20 *
21 * @author Alex Dirkzwager, Mark Hendrikx
22 */
23public class AC_Yushu extends AcceptanceStrategy {
24
25 private double roundleft;
26
27 /**
28 * Empty constructor for the BOA framework.
29 */
30 public AC_Yushu() {
31 }
32
33 public AC_Yushu(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 offeringStrategy = strat;
42
43 // checking if offeringStrategy helper is a YushuHelper
44 if (offeringStrategy.getHelper() == null || (!offeringStrategy.getHelper().getName().equals("Yushu"))) {
45 helper = new YushuSAS(negotiationSession);
46 } else {
47 helper = (YushuSAS) offeringStrategy.getHelper();
48 }
49 }
50
51 @Override
52 public Actions determineAcceptability() {
53
54 BidDetails opponentBid = negotiationSession.getOpponentBidHistory().getLastBidDetails();
55 BidDetails myBid = negotiationSession.getOwnBidHistory().getLastBidDetails();
56 roundleft = ((YushuSAS) helper).getRoundLeft();
57 if (offeringStrategy.getHelper() == null || (!offeringStrategy.getHelper().getName().equals("Yushu"))) {
58 ((YushuSAS) helper).updateBelief(opponentBid);
59 }
60
61 BidDetails suggestedBid = ((YushuSAS) helper).getSuggestBid();
62 double acceptableUtil = ((YushuSAS) helper).getAcceptableUtil();
63
64 if (opponentBid != null) {
65 double targetUtil;
66 if (myBid == null) {
67 targetUtil = 1;
68 } else if (offeringStrategy.getHelper() != null && offeringStrategy.getHelper().getName().equals("Yushu")) {
69 targetUtil = ((YushuSAS) helper).getTargetUtil();
70 } else {
71 targetUtil = ((YushuSAS) helper).calculateTargetUtility();
72 }
73 if ((opponentBid.getMyUndiscountedUtil() >= targetUtil)
74 | (opponentBid.getMyUndiscountedUtil() >= acceptableUtil)) {
75 if (suggestedBid == null || roundleft < 8) {
76 return Actions.Accept;
77 }
78 if ((suggestedBid != null) && (roundleft > 8)) {
79 if (suggestedBid.getMyUndiscountedUtil() <= opponentBid.getMyUndiscountedUtil()) {
80 return Actions.Accept;
81 }
82 }
83 }
84 }
85 return Actions.Reject;
86 }
87
88 @Override
89 public String getName() {
90 return "2010 - Yushu";
91 }
92}
Note: See TracBrowser for help on using the repository browser.