source: src/main/java/negotiator/boaframework/acceptanceconditions/anac2012/AC_IAMHaggler2012.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: 2.8 KB
Line 
1package negotiator.boaframework.acceptanceconditions.anac2012;
2
3import java.util.Map;
4
5import genius.core.Bid;
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 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 */
24public 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}
Note: See TracBrowser for help on using the repository browser.