source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_Const.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.1 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.bidding.BidDetails;
8import genius.core.boaframework.AcceptanceStrategy;
9import genius.core.boaframework.Actions;
10import genius.core.boaframework.BOAparameter;
11import genius.core.boaframework.NegotiationSession;
12import genius.core.boaframework.OfferingStrategy;
13import genius.core.boaframework.OpponentModel;
14
15/**
16 * This Acceptance Condition accepts an opponent bid if the utility is above a
17 * constant.
18 *
19 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
20 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
21 *
22 * @author Alex Dirkzwager, Mark Hendrikx
23 * @version 15-12-11
24 */
25public class AC_Const extends AcceptanceStrategy {
26
27 private double constant;
28
29 /**
30 * Empty constructor for the BOA framework.
31 */
32 public AC_Const() {
33 }
34
35 public AC_Const(NegotiationSession negoSession, double c) {
36 this.negotiationSession = negoSession;
37 this.constant = c;
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 if (parameters.get("c") != null) {
45 constant = parameters.get("c");
46 } else {
47 throw new Exception("Constant \"c\" for the threshold was not set.");
48 }
49 }
50
51 @Override
52 public String printParameters() {
53 return "[c: " + constant + "]";
54 }
55
56 @Override
57 public Actions determineAcceptability() {
58 BidDetails opponentBid = negotiationSession.getOpponentBidHistory().getLastBidDetails();
59 if (opponentBid.getMyUndiscountedUtil() > constant) {
60 return Actions.Accept;
61 }
62 return Actions.Reject;
63 }
64
65 @Override
66 public Set<BOAparameter> getParameterSpec() {
67
68 Set<BOAparameter> set = new HashSet<BOAparameter>();
69 set.add(new BOAparameter("c", 0.9, "If utility of opponent's bid greater than c, then accept"));
70
71 return set;
72 }
73
74 @Override
75 public String getName() {
76 return "Other - Const";
77 }
78}
Note: See TracBrowser for help on using the repository browser.