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 acceptance condition uses two versions of AC_next. The used AC_next
|
---|
16 | * depends on if the discount of the domain is (non)-negligible. The parameter e
|
---|
17 | * determines when a domain is marked as discounted or not.
|
---|
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 | */
|
---|
24 | public class AC_CombiV4 extends AcceptanceStrategy {
|
---|
25 |
|
---|
26 | private double a;
|
---|
27 | private double b;
|
---|
28 | private double c;
|
---|
29 | private double d;
|
---|
30 | private double e;
|
---|
31 | private boolean discountedDomain;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Empty constructor for the BOA framework.
|
---|
35 | */
|
---|
36 | public AC_CombiV4() {
|
---|
37 | }
|
---|
38 |
|
---|
39 | public AC_CombiV4(NegotiationSession negoSession, OfferingStrategy strat, double a, double b, double c, double d,
|
---|
40 | double e) {
|
---|
41 |
|
---|
42 | this.negotiationSession = negoSession;
|
---|
43 | this.offeringStrategy = strat;
|
---|
44 | this.a = a;
|
---|
45 | this.b = b;
|
---|
46 | this.c = c;
|
---|
47 | this.d = d;
|
---|
48 | this.e = e;
|
---|
49 |
|
---|
50 | if (negotiationSession.getDiscountFactor() < 0.00001 || negotiationSession.getDiscountFactor() > e) {
|
---|
51 | discountedDomain = false;
|
---|
52 | } else {
|
---|
53 | discountedDomain = true;
|
---|
54 | }
|
---|
55 | }
|
---|
56 |
|
---|
57 | @Override
|
---|
58 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
59 | Map<String, Double> parameters) throws Exception {
|
---|
60 | this.negotiationSession = negoSession;
|
---|
61 | this.offeringStrategy = strat;
|
---|
62 | if (parameters.get("a") != null || parameters.get("b") != null
|
---|
63 | || parameters.get("c") != null && parameters.get("d") != null && parameters.get("e") != null) {
|
---|
64 | a = parameters.get("a");
|
---|
65 | b = parameters.get("b");
|
---|
66 | c = parameters.get("c");
|
---|
67 | d = parameters.get("d");
|
---|
68 | e = parameters.get("e");
|
---|
69 | if (negotiationSession.getDiscountFactor() < 0.00001 || negotiationSession.getDiscountFactor() > e) {
|
---|
70 | discountedDomain = false;
|
---|
71 | } else {
|
---|
72 | discountedDomain = true;
|
---|
73 | }
|
---|
74 | } else {
|
---|
75 | throw new Exception("Paramaters were not correctly set");
|
---|
76 | }
|
---|
77 | }
|
---|
78 |
|
---|
79 | @Override
|
---|
80 | public String printParameters() {
|
---|
81 | return "[a: " + a + " b: " + b + " c: " + c + " d: " + d + " e: " + e + "]";
|
---|
82 | }
|
---|
83 |
|
---|
84 | @Override
|
---|
85 | public Actions determineAcceptability() {
|
---|
86 | double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
87 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
88 | .getMyUndiscountedUtil();
|
---|
89 |
|
---|
90 | double target = 0;
|
---|
91 | if (!discountedDomain) {
|
---|
92 | // no discount mode
|
---|
93 | target = a * lastOpponentBidUtil + b;
|
---|
94 | } else {
|
---|
95 | // discount mode
|
---|
96 | target = c * lastOpponentBidUtil + d;
|
---|
97 | }
|
---|
98 | if (target > 1.0) {
|
---|
99 | target = 1.0;
|
---|
100 | }
|
---|
101 |
|
---|
102 | if (target >= nextMyBidUtil) {
|
---|
103 | return Actions.Accept;
|
---|
104 | }
|
---|
105 |
|
---|
106 | return Actions.Reject;
|
---|
107 | }
|
---|
108 |
|
---|
109 | @Override
|
---|
110 | public Set<BOAparameter> getParameterSpec() {
|
---|
111 |
|
---|
112 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
113 | set.add(new BOAparameter("a", 1.0, "Multiplier"));
|
---|
114 | set.add(new BOAparameter("b", 0.0, "Constant"));
|
---|
115 | set.add(new BOAparameter("c", 1.0, "Multiplier discount"));
|
---|
116 | set.add(new BOAparameter("d", 0.0, "Constant discount"));
|
---|
117 | set.add(new BOAparameter("e", 0.8, "Threshold discount"));
|
---|
118 |
|
---|
119 | return set;
|
---|
120 | }
|
---|
121 |
|
---|
122 | @Override
|
---|
123 | public String getName() {
|
---|
124 | return "Other - CombiV4";
|
---|
125 | }
|
---|
126 | }
|
---|