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