1 | package negotiator.boaframework.acceptanceconditions.anac2012;
|
---|
2 |
|
---|
3 | import java.util.Map;
|
---|
4 |
|
---|
5 | import genius.core.Bid;
|
---|
6 | import genius.core.bidding.BidDetails;
|
---|
7 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
8 | import genius.core.boaframework.Actions;
|
---|
9 | import genius.core.boaframework.NegotiationSession;
|
---|
10 | import genius.core.boaframework.OfferingStrategy;
|
---|
11 | import genius.core.boaframework.OpponentModel;
|
---|
12 | import genius.core.utility.AdditiveUtilitySpace;
|
---|
13 | import negotiator.boaframework.sharedagentstate.anac2011.BRAMAgentSAS;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * This is the decoupled Acceptance Condition from BRAMAgent2 (ANAC2012). The
|
---|
17 | * code was taken from the ANAC2012 BRAMAgent2 and adapted to work within the
|
---|
18 | * BOA framework.
|
---|
19 | *
|
---|
20 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
21 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
22 | *
|
---|
23 | * @author Alex Dirkzwager
|
---|
24 | * @version 31/10/12
|
---|
25 | */
|
---|
26 | public class AC_BRAMAgent2 extends AcceptanceStrategy {
|
---|
27 |
|
---|
28 | private boolean activeHelper = false;
|
---|
29 | private BidDetails bestBid;
|
---|
30 | private Bid worstBid;
|
---|
31 | private AdditiveUtilitySpace utilitySpace;
|
---|
32 |
|
---|
33 | public AC_BRAMAgent2() {
|
---|
34 | }
|
---|
35 |
|
---|
36 | public AC_BRAMAgent2(NegotiationSession negoSession, OfferingStrategy strat) throws Exception {
|
---|
37 | init(negoSession, strat, null, null);
|
---|
38 | }
|
---|
39 |
|
---|
40 | @Override
|
---|
41 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
42 | Map<String, Double> parameters) throws Exception {
|
---|
43 | this.negotiationSession = negoSession;
|
---|
44 | this.offeringStrategy = strat;
|
---|
45 | bestBid = negoSession.getMaxBidinDomain();
|
---|
46 | worstBid = negoSession.getUtilitySpace().getMinUtilityBid();
|
---|
47 | utilitySpace = (AdditiveUtilitySpace) negoSession.getUtilitySpace();
|
---|
48 |
|
---|
49 | // checking if offeringStrategy SAS is a BRAMAgentSAS
|
---|
50 | if (offeringStrategy.getHelper() == null || (!offeringStrategy.getHelper().getName().equals("BRAMAgent"))) {
|
---|
51 | helper = new BRAMAgentSAS(negotiationSession);
|
---|
52 | activeHelper = true;
|
---|
53 | } else {
|
---|
54 | helper = (BRAMAgentSAS) offeringStrategy.getHelper();
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Override
|
---|
59 | public Actions determineAcceptability() {
|
---|
60 | double offeredUtility = utilitySpace.getUtilityWithDiscount(
|
---|
61 | negotiationSession.getOpponentBidHistory().getLastBidDetails().getBid(), negotiationSession.getTime());
|
---|
62 | double threshold;
|
---|
63 |
|
---|
64 | if (activeHelper) {
|
---|
65 | threshold = ((BRAMAgentSAS) helper).getNewThreshold(worstBid, bestBid.getBid());
|
---|
66 | } else {
|
---|
67 | threshold = ((BRAMAgentSAS) helper).getThreshold();// Update the
|
---|
68 | // threshold
|
---|
69 | // according to
|
---|
70 | // the discount
|
---|
71 | // factor
|
---|
72 | }
|
---|
73 |
|
---|
74 | if (offeredUtility >= threshold)// If the utility of the bid that we
|
---|
75 | // received from the opponent
|
---|
76 | // is larger than the threshold that we ready to accept,
|
---|
77 | // we will accept the offer
|
---|
78 | return Actions.Accept;
|
---|
79 |
|
---|
80 | if (/* ( bidToOffer != null ) && */(offeredUtility >= utilitySpace
|
---|
81 | .getUtilityWithDiscount(offeringStrategy.getNextBid().getBid(), negotiationSession.getTime()))) {
|
---|
82 | return Actions.Accept;
|
---|
83 | }
|
---|
84 |
|
---|
85 | /* (bidToOffer == null )|| */
|
---|
86 | if (((offeredUtility < this.utilitySpace.getReservationValueWithDiscount(negotiationSession.getTimeline()))
|
---|
87 | && (negotiationSession.getTime() > 177.0 / 180.0))
|
---|
88 | && (this.utilitySpace.getReservationValueWithDiscount(
|
---|
89 | negotiationSession.getTimeline()) > this.utilitySpace.getUtilityWithDiscount(
|
---|
90 | offeringStrategy.getNextBid().getBid(), negotiationSession.getTimeline()))) {
|
---|
91 | return Actions.Break;
|
---|
92 | }
|
---|
93 |
|
---|
94 | return Actions.Reject;
|
---|
95 | }
|
---|
96 |
|
---|
97 | @Override
|
---|
98 | public String getName() {
|
---|
99 | return "2012 - BRAMAgent2";
|
---|
100 | }
|
---|
101 |
|
---|
102 | }
|
---|