source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_ConstDiscounted.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: 1.9 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.Map;
4
5import genius.core.bidding.BidDetails;
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;
11
12/**
13 * This Acceptance Condition accepts an opponent bid if the utility is above a
14 * constant.
15 *
16 * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
17 * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
18 *
19 * @author Alex Dirkzwager, Mark Hendrikx
20 * @version 15-12-11
21 */
22public class AC_ConstDiscounted extends AcceptanceStrategy {
23
24 private double constant;
25
26 /**
27 * Empty constructor for the BOA framework.
28 */
29 public AC_ConstDiscounted() {
30 }
31
32 public AC_ConstDiscounted(NegotiationSession negoSession, double c) {
33 this.negotiationSession = negoSession;
34 this.constant = c * (Math.pow(negoSession.getDiscountFactor(), negoSession.getTime()));
35 }
36
37 @Override
38 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
39 Map<String, Double> parameters) throws Exception {
40 this.negotiationSession = negoSession;
41 if (parameters.get("c") != null) {
42 constant = parameters.get("c");
43 } else {
44 throw new Exception("Constant \"c\" for the threshold was not set.");
45 }
46 }
47
48 @Override
49 public String printParameters() {
50 return "[c: " + constant + "]";
51 }
52
53 @Override
54 public Actions determineAcceptability() {
55 BidDetails opponentBid = negotiationSession.getOpponentBidHistory().getLastBidDetails();
56 if (opponentBid.getMyUndiscountedUtil() > constant) {
57 return Actions.Accept;
58 }
59 return Actions.Reject;
60 }
61
62 @Override
63 public String getName() {
64 return "Other - ConstDiscounted";
65 }
66}
Note: See TracBrowser for help on using the repository browser.