1 | package negotiator.boaframework.acceptanceconditions.anac2010;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import genius.core.bidding.BidDetails;
|
---|
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 | import 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 | */
|
---|
23 | public 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 | } |
---|