1 | package negotiator.boaframework.acceptanceconditions.anac2012;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
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 genius.core.utility.AdditiveUtilitySpace;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * This is the decoupled Acceptance Condition from IAMhaggler2012 (ANAC2012).
|
---|
15 | * The code was taken from the ANAC2012 IAMhaggler2012 and adapted to work
|
---|
16 | * within the BOA 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
|
---|
22 | * @version 31/10/12
|
---|
23 | */
|
---|
24 | public class AC_IAMHaggler2012 extends AcceptanceStrategy {
|
---|
25 |
|
---|
26 | private AdditiveUtilitySpace utilitySpace;
|
---|
27 | private double acceptMultiplier = 1.02;
|
---|
28 | private double MAXIMUM_ASPIRATION = 0.9;
|
---|
29 |
|
---|
30 | public AC_IAMHaggler2012() {
|
---|
31 | }
|
---|
32 |
|
---|
33 | public AC_IAMHaggler2012(NegotiationSession negoSession, OfferingStrategy strat) throws Exception {
|
---|
34 | initializeAgent(negoSession, strat);
|
---|
35 | }
|
---|
36 |
|
---|
37 | @Override
|
---|
38 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
39 | Map<String, Double> parameters) throws Exception {
|
---|
40 | super.init(negoSession, strat, opponentModel, parameters);
|
---|
41 | initializeAgent(negoSession, strat);
|
---|
42 | }
|
---|
43 |
|
---|
44 | public void initializeAgent(NegotiationSession negotiationSession, OfferingStrategy os) throws Exception {
|
---|
45 | this.negotiationSession = negotiationSession;
|
---|
46 | utilitySpace = (AdditiveUtilitySpace) negotiationSession.getUtilitySpace();
|
---|
47 | this.offeringStrategy = os;
|
---|
48 |
|
---|
49 | }
|
---|
50 |
|
---|
51 | @Override
|
---|
52 | public Actions determineAcceptability() {
|
---|
53 | Bid opponentBid = negotiationSession.getOpponentBidHistory().getLastBid();
|
---|
54 | Bid myLastBid = negotiationSession.getOwnBidHistory().getLastBid();
|
---|
55 | if (opponentBid == null || myLastBid == null) {
|
---|
56 | return Actions.Reject;
|
---|
57 | }
|
---|
58 |
|
---|
59 | try {
|
---|
60 | if (utilitySpace.getUtility(opponentBid) * acceptMultiplier >= utilitySpace.getUtility(myLastBid)) {
|
---|
61 | // Accept opponent's bid based on my previous bid.
|
---|
62 | return Actions.Accept;
|
---|
63 | } else if (utilitySpace.getUtility(opponentBid) * acceptMultiplier >= MAXIMUM_ASPIRATION) {
|
---|
64 | // Accept opponent's bid based on my previous bid.
|
---|
65 | return Actions.Accept;
|
---|
66 | }
|
---|
67 |
|
---|
68 | if (utilitySpace.getUtility(opponentBid) * acceptMultiplier >= offeringStrategy.getNextBid()
|
---|
69 | .getMyUndiscountedUtil()) {
|
---|
70 | // Accept opponent's bid based on my planned bid.
|
---|
71 | return Actions.Accept;
|
---|
72 | }
|
---|
73 |
|
---|
74 | } catch (Exception e) {
|
---|
75 | e.printStackTrace();
|
---|
76 | }
|
---|
77 | return Actions.Reject;
|
---|
78 | }
|
---|
79 |
|
---|
80 | @Override
|
---|
81 | public String getName() {
|
---|
82 | return "2012 - IAMHaggler2012";
|
---|
83 | }
|
---|
84 |
|
---|
85 | }
|
---|