source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_Gap.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.6 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.boaframework.AcceptanceStrategy;
8import genius.core.boaframework.Actions;
9import genius.core.boaframework.BOAparameter;
10import genius.core.boaframework.NegotiationSession;
11import genius.core.boaframework.OfferingStrategy;
12import genius.core.boaframework.OpponentModel;
13
14/**
15 * This is the decoupled Acceptance Conditions Based on Tim Baarslag's paper on
16 * Acceptance Conditions: "Acceptance Conditions in Automated Negotiation"
17 *
18 * This Acceptance Condition accepts a bid if the utility of the opponent's bid
19 * plus a constant (the gap) is higher than the utility of the next bid. The
20 * acceptance condition is a restricted version of AC_next.
21 *
22 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
23 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
24 *
25 * @author Alex Dirkzwager
26 */
27public class AC_Gap extends AcceptanceStrategy {
28
29 private double constant;
30
31 /**
32 * Empty constructor for the BOA framework.
33 */
34 public AC_Gap() {
35 }
36
37 public AC_Gap(NegotiationSession negoSession, double c) {
38 this.negotiationSession = negoSession;
39 this.constant = c;
40 }
41
42 @Override
43 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
44 Map<String, Double> parameters) throws Exception {
45 this.negotiationSession = negoSession;
46 if (parameters.get("c") != null) {
47 constant = parameters.get("c");
48 } else {
49 throw new Exception("Constant \"c\" for the threshold was not set.");
50 }
51 }
52
53 @Override
54 public String printParameters() {
55 return "[c: " + constant + "]";
56 }
57
58 @Override
59 public Actions determineAcceptability() {
60 if (!negotiationSession.getOwnBidHistory().getHistory().isEmpty()) {
61 double opponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
62 .getMyUndiscountedUtil();
63 double prevMyBidUtil = negotiationSession.getOwnBidHistory().getLastBidDetails().getMyUndiscountedUtil();
64
65 if (opponentBidUtil + constant >= prevMyBidUtil) {
66 return Actions.Accept;
67 }
68 }
69 return Actions.Reject;
70 }
71
72 @Override
73 public Set<BOAparameter> getParameterSpec() {
74 Set<BOAparameter> set = new HashSet<BOAparameter>();
75 set.add(new BOAparameter("c", 0.01,
76 "Accept when opponent's bid utility plus constant c is greater than utility of previous offer"));
77 return set;
78 }
79
80 @Override
81 public String getName() {
82 return "Other - Gap";
83 }
84}
Note: See TracBrowser for help on using the repository browser.