source: src/main/java/negotiator/boaframework/acceptanceconditions/other/AC_Previous.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: 2.6 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 accepts an opponent bid if the utility is higher
16 * than the previous bid the agent made.
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 */
23public class AC_Previous extends AcceptanceStrategy {
24
25 private double a;
26 private double b;
27
28 /**
29 * Empty constructor for the BOA framework.
30 */
31 public AC_Previous() {
32 }
33
34 public AC_Previous(NegotiationSession negoSession, double alpha, double beta) {
35 this.negotiationSession = negoSession;
36 this.a = alpha;
37 this.b = beta;
38 }
39
40 @Override
41 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
42 Map<String, Double> parameters) throws Exception {
43 this.negotiationSession = negoSession;
44 if (parameters.get("a") != null || parameters.get("b") != null) {
45 a = parameters.get("a");
46 b = parameters.get("b");
47 } else {
48 throw new Exception("Parameters were not set.");
49 }
50 }
51
52 @Override
53 public String printParameters() {
54 String str = "[a: " + a + " b: " + b + "]";
55 return str;
56 }
57
58 @Override
59 public Actions determineAcceptability() {
60 if (!negotiationSession.getOwnBidHistory().getHistory().isEmpty()) {
61 double opponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
62 .getMyUndiscountedUtil();
63 double ownLastBidUtil = negotiationSession.getOwnBidHistory().getLastBidDetails().getMyUndiscountedUtil();
64 if (a * opponentBidUtil + b >= ownLastBidUtil) {
65 return Actions.Accept;
66 }
67 }
68 return Actions.Reject;
69
70 }
71
72 @Override
73 public Set<BOAparameter> getParameterSpec() {
74
75 Set<BOAparameter> set = new HashSet<BOAparameter>();
76 set.add(new BOAparameter("a", 1.0,
77 "Accept when the opponent's utility * a + b is greater than the utility of our previous bid"));
78 set.add(new BOAparameter("b", 0.0,
79 "Accept when the opponent's utility * a + b is greater than the utility of our previous bid"));
80
81 return set;
82 }
83
84 @Override
85 public String getName() {
86 return "Other - Previous";
87 }
88}
Note: See TracBrowser for help on using the repository browser.