1 | package negotiator.boaframework.acceptanceconditions.other;
|
---|
2 |
|
---|
3 | import java.util.HashSet;
|
---|
4 | import java.util.Map;
|
---|
5 | import java.util.Set;
|
---|
6 |
|
---|
7 | import genius.core.bidding.BidDetails;
|
---|
8 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
9 | import genius.core.boaframework.Actions;
|
---|
10 | import genius.core.boaframework.BOAparameter;
|
---|
11 | import genius.core.boaframework.NegotiationSession;
|
---|
12 | import genius.core.boaframework.OfferingStrategy;
|
---|
13 | import 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 | */
|
---|
25 | public 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 | } |
---|