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 AC_next to determine when to accept. In
|
---|
16 | * addition, the agent also accepts when a given time has passed, and the
|
---|
17 | * utility of the opponent's bid is higher than a given 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 | */
|
---|
24 | public class AC_CombiV3 extends AcceptanceStrategy {
|
---|
25 |
|
---|
26 | private double a;
|
---|
27 | private double b;
|
---|
28 | private double c;
|
---|
29 | private double time;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Empty constructor for the BOA framework.
|
---|
33 | */
|
---|
34 | public AC_CombiV3() {
|
---|
35 | }
|
---|
36 |
|
---|
37 | public AC_CombiV3(NegotiationSession negoSession, OfferingStrategy strat, double a, double b, double t, double c) {
|
---|
38 | this.negotiationSession = negoSession;
|
---|
39 | this.offeringStrategy = strat;
|
---|
40 | this.a = a;
|
---|
41 | this.b = b;
|
---|
42 | this.c = c;
|
---|
43 | this.time = t;
|
---|
44 | }
|
---|
45 |
|
---|
46 | @Override
|
---|
47 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
48 | Map<String, Double> parameters) throws Exception {
|
---|
49 | this.negotiationSession = negoSession;
|
---|
50 | this.offeringStrategy = strat;
|
---|
51 | if (parameters.get("a") != null || parameters.get("b") != null
|
---|
52 | || parameters.get("c") != null && parameters.get("t") != null) {
|
---|
53 | a = parameters.get("a");
|
---|
54 | b = parameters.get("b");
|
---|
55 | c = parameters.get("c");
|
---|
56 | time = parameters.get("t");
|
---|
57 | } else {
|
---|
58 | throw new Exception("Paramaters were not correctly set");
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 | @Override
|
---|
63 | public String printParameters() {
|
---|
64 | return "[a: " + a + " b: " + b + " t: " + time + " c: " + c + "]";
|
---|
65 | }
|
---|
66 |
|
---|
67 | @Override
|
---|
68 | public Actions determineAcceptability() {
|
---|
69 | double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
70 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
71 | .getMyUndiscountedUtil();
|
---|
72 |
|
---|
73 | double target = a * nextMyBidUtil + b;
|
---|
74 | if (target > 1.0) {
|
---|
75 | target = 1.0;
|
---|
76 | }
|
---|
77 | if (lastOpponentBidUtil >= target) {
|
---|
78 | return Actions.Accept;
|
---|
79 | }
|
---|
80 |
|
---|
81 | if (negotiationSession.getTime() > time && lastOpponentBidUtil > c) {
|
---|
82 | return Actions.Accept;
|
---|
83 | }
|
---|
84 | return Actions.Reject;
|
---|
85 | }
|
---|
86 |
|
---|
87 | @Override
|
---|
88 | public Set<BOAparameter> getParameterSpec() {
|
---|
89 |
|
---|
90 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
91 | set.add(new BOAparameter("a", 1.0, "Multiplier"));
|
---|
92 | set.add(new BOAparameter("b", 0.0, "Constant"));
|
---|
93 | set.add(new BOAparameter("c", 0.95, "Threshold"));
|
---|
94 | set.add(new BOAparameter("t", 0.99, "Time"));
|
---|
95 |
|
---|
96 | return set;
|
---|
97 | }
|
---|
98 |
|
---|
99 | @Override
|
---|
100 | public String getName() {
|
---|
101 | return "Other - CombiV3";
|
---|
102 | }
|
---|
103 |
|
---|
104 | }
|
---|