source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_Time.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 1.9 KB
Line 
1package negotiator.boaframework.acceptanceconditions.other;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.boaframework.AcceptanceStrategy;
8import genius.core.boaframework.Actions;
9import genius.core.boaframework.BOAparameter;
10import genius.core.boaframework.NegotiationSession;
11import genius.core.boaframework.OfferingStrategy;
12import 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 */
24public 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}
Note: See TracBrowser for help on using the repository browser.