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 accept an opponent bid after a certain time has
|
---|
16 | * passed
|
---|
17 | *
|
---|
18 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
19 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
20 | *
|
---|
21 | * @author Alex Dirkzwager, Mark Hendrikx
|
---|
22 | * @version 15-12-11
|
---|
23 | */
|
---|
24 | public class AC_Time extends AcceptanceStrategy {
|
---|
25 |
|
---|
26 | private double constant;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Empty constructor for the BOA framework.
|
---|
30 | */
|
---|
31 | public AC_Time() {
|
---|
32 | }
|
---|
33 |
|
---|
34 | public AC_Time(NegotiationSession negoSession, double c) {
|
---|
35 | this.negotiationSession = negoSession;
|
---|
36 | this.constant = c;
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
41 | Map<String, Double> parameters) throws Exception {
|
---|
42 | this.negotiationSession = negoSession;
|
---|
43 | if (parameters.get("t") != null) {
|
---|
44 | constant = parameters.get("t");
|
---|
45 | } else {
|
---|
46 | throw new Exception("Constant \"c\" for the threshold was not set.");
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public String printParameters() {
|
---|
52 | return "[c: " + constant + "]";
|
---|
53 | }
|
---|
54 |
|
---|
55 | @Override
|
---|
56 | public Actions determineAcceptability() {
|
---|
57 | if (negotiationSession.getTime() > constant) {
|
---|
58 | return Actions.Accept;
|
---|
59 | }
|
---|
60 | return Actions.Reject;
|
---|
61 | }
|
---|
62 |
|
---|
63 | @Override
|
---|
64 | public Set<BOAparameter> getParameterSpec() {
|
---|
65 |
|
---|
66 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
67 | set.add(new BOAparameter("t", 0.99, "If time greater than t, then accept"));
|
---|
68 |
|
---|
69 | return set;
|
---|
70 | }
|
---|
71 |
|
---|
72 | @Override
|
---|
73 | public String getName() {
|
---|
74 | return "Other - Time";
|
---|
75 | }
|
---|
76 | } |
---|