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.boaframework.AcceptanceStrategy;
|
---|
8 | import genius.core.boaframework.Actions;
|
---|
9 | import genius.core.boaframework.BOAparameter;
|
---|
10 | import genius.core.boaframework.NegotiationSession;
|
---|
11 | import genius.core.boaframework.OfferingStrategy;
|
---|
12 | import 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 Conditions is a combination of AC_Time and AC_Next
|
---|
19 | *
|
---|
20 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
21 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
22 | *
|
---|
23 | * @author Alex Dirkzwager
|
---|
24 | */
|
---|
25 | public class AC_CombiV2 extends AcceptanceStrategy {
|
---|
26 |
|
---|
27 | private double a;
|
---|
28 | private double b;
|
---|
29 | private double c;
|
---|
30 | private double d;
|
---|
31 | private double time;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Empty constructor for the BOA framework.
|
---|
35 | */
|
---|
36 | public AC_CombiV2() {
|
---|
37 | }
|
---|
38 |
|
---|
39 | public AC_CombiV2(NegotiationSession negoSession, OfferingStrategy strat, double a, double b, double t, double c,
|
---|
40 | double d) {
|
---|
41 | this.negotiationSession = negoSession;
|
---|
42 | this.offeringStrategy = strat;
|
---|
43 | this.a = a;
|
---|
44 | this.b = b;
|
---|
45 | this.c = c;
|
---|
46 | this.d = d;
|
---|
47 | this.time = t;
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
52 | Map<String, Double> parameters) throws Exception {
|
---|
53 | this.negotiationSession = negoSession;
|
---|
54 | this.offeringStrategy = strat;
|
---|
55 | if (parameters.get("a") != null || parameters.get("b") != null
|
---|
56 | || parameters.get("c") != null && parameters.get("t") != null) {
|
---|
57 | a = parameters.get("a");
|
---|
58 | b = parameters.get("b");
|
---|
59 | c = parameters.get("c");
|
---|
60 | d = parameters.get("d");
|
---|
61 | time = parameters.get("t");
|
---|
62 | } else {
|
---|
63 | throw new Exception("Paramaters were not correctly set");
|
---|
64 | }
|
---|
65 | }
|
---|
66 |
|
---|
67 | @Override
|
---|
68 | public String printParameters() {
|
---|
69 | return "[a: " + a + " b: " + b + " t: " + time + " c: " + c + " d: " + d + "]";
|
---|
70 | }
|
---|
71 |
|
---|
72 | @Override
|
---|
73 | public Actions determineAcceptability() {
|
---|
74 | double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
75 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
76 | .getMyUndiscountedUtil();
|
---|
77 |
|
---|
78 | if (lastOpponentBidUtil > d) {
|
---|
79 | return Actions.Accept;
|
---|
80 | }
|
---|
81 |
|
---|
82 | if (negotiationSession.getDiscountFactor() != 0.0 && c < negotiationSession.getDiscountFactor()) {
|
---|
83 | if (a * lastOpponentBidUtil + b >= nextMyBidUtil) {
|
---|
84 | return Actions.Accept;
|
---|
85 | }
|
---|
86 | } else {
|
---|
87 | if (a * lastOpponentBidUtil + b >= nextMyBidUtil && negotiationSession.getTime() >= time) {
|
---|
88 | return Actions.Accept;
|
---|
89 | }
|
---|
90 | }
|
---|
91 | return Actions.Reject;
|
---|
92 | }
|
---|
93 |
|
---|
94 | @Override
|
---|
95 | public Set<BOAparameter> getParameterSpec() {
|
---|
96 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
97 | set.add(new BOAparameter("a", 1.0, "Multiplier"));
|
---|
98 | set.add(new BOAparameter("b", 0.0, "Constant"));
|
---|
99 | set.add(new BOAparameter("c", 0.8, "Threshold discount"));
|
---|
100 | set.add(new BOAparameter("d", 0.95, "Threshold"));
|
---|
101 | set.add(new BOAparameter("t", 0.99, "Time"));
|
---|
102 |
|
---|
103 | return set;
|
---|
104 | }
|
---|
105 |
|
---|
106 | @Override
|
---|
107 | public String getName() {
|
---|
108 | return "Other - CombiV2";
|
---|
109 | }
|
---|
110 | }
|
---|