1 | package negotiator.boaframework.acceptanceconditions.anac2011;
|
---|
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.anac2011.GahboninhoSAS;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * @author Mark Hendrikx and Alex Dirkzwager
|
---|
15 | *
|
---|
16 | * This is the decoupled Acceptance Conditions from the Gahboninho
|
---|
17 | * (ANAC2011). The code was taken from the ANAC2011 Gahboninho and
|
---|
18 | * adapted to work within the BOA framework.
|
---|
19 | *
|
---|
20 | * Decoupling Negotiating Agents to Explore the Space of Negotiation
|
---|
21 | * Strategies T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M.
|
---|
22 | * Jonker
|
---|
23 | *
|
---|
24 | * BUG In the original version the opponent model is only updated once,
|
---|
25 | * which is good for the performance of the agent, as the model is very
|
---|
26 | * slow.
|
---|
27 | */
|
---|
28 | public class AC_Gahboninho extends AcceptanceStrategy {
|
---|
29 |
|
---|
30 | private boolean activeHelper = false;
|
---|
31 | private boolean done = false;
|
---|
32 |
|
---|
33 | public AC_Gahboninho() {
|
---|
34 | }
|
---|
35 |
|
---|
36 | public AC_Gahboninho(NegotiationSession negotiationSession, OfferingStrategy offeringStrategy) {
|
---|
37 | initializeAgent(negotiationSession, offeringStrategy);
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
42 | Map<String, Double> parameters) throws Exception {
|
---|
43 | System.out.println("offering: " + strat);
|
---|
44 |
|
---|
45 | initializeAgent(negoSession, strat);
|
---|
46 |
|
---|
47 | }
|
---|
48 |
|
---|
49 | public void initializeAgent(NegotiationSession negoSession, OfferingStrategy strat) {
|
---|
50 | this.negotiationSession = negoSession;
|
---|
51 | System.out.println("negotiationSession: " + negotiationSession);
|
---|
52 |
|
---|
53 | this.offeringStrategy = strat;
|
---|
54 | if (offeringStrategy.getHelper() != null && offeringStrategy.getHelper().getName().equals("Gahboninho")) {
|
---|
55 | helper = offeringStrategy.getHelper();
|
---|
56 |
|
---|
57 | } else {
|
---|
58 | helper = new GahboninhoSAS(negotiationSession);
|
---|
59 | activeHelper = true;
|
---|
60 | }
|
---|
61 | }
|
---|
62 |
|
---|
63 | @Override
|
---|
64 | public Actions determineAcceptability() {
|
---|
65 | BidDetails opponentBid = negotiationSession.getOpponentBidHistory().getLastBidDetails();
|
---|
66 |
|
---|
67 | if (activeHelper) {
|
---|
68 | if (negotiationSession.getOpponentBidHistory().getHistory().size() < 2) {
|
---|
69 | try {
|
---|
70 |
|
---|
71 | ((GahboninhoSAS) helper).getIssueManager().ProcessOpponentBid(opponentBid.getBid());
|
---|
72 | ((GahboninhoSAS) helper).getOpponentModel().UpdateImportance(opponentBid.getBid());
|
---|
73 | } catch (Exception e) {
|
---|
74 | e.printStackTrace();
|
---|
75 | }
|
---|
76 |
|
---|
77 | } else {
|
---|
78 | try {
|
---|
79 | if (!done) {
|
---|
80 | ((GahboninhoSAS) helper).getIssueManager().learnBids(opponentBid.getBid());
|
---|
81 | done = true;
|
---|
82 | }
|
---|
83 | } catch (Exception e) {
|
---|
84 | e.printStackTrace();
|
---|
85 | }
|
---|
86 | }
|
---|
87 | }
|
---|
88 |
|
---|
89 | if (((GahboninhoSAS) helper).getFirstActions() > 0 && opponentBid != null
|
---|
90 | && opponentBid.getMyUndiscountedUtil() > 0.95) {
|
---|
91 | return Actions.Accept;
|
---|
92 | }
|
---|
93 |
|
---|
94 | if (opponentBid != null && opponentBid.getMyUndiscountedUtil() >= ((GahboninhoSAS) helper).getIssueManager()
|
---|
95 | .getMinimumUtilForAcceptance()) {
|
---|
96 | return Actions.Accept;
|
---|
97 | }
|
---|
98 | return Actions.Reject;
|
---|
99 | }
|
---|
100 |
|
---|
101 | @Override
|
---|
102 | public String getName() {
|
---|
103 | return "2011 - Gahboninho";
|
---|
104 | }
|
---|
105 | }
|
---|