1 |
|
---|
2 | package agents.anac.y2018.fullagent;
|
---|
3 |
|
---|
4 | import java.util.HashMap;
|
---|
5 | import java.util.HashSet;
|
---|
6 | import java.util.Map;
|
---|
7 | import java.util.Set;
|
---|
8 | import negotiator.boaframework.AcceptanceStrategy;
|
---|
9 | import negotiator.boaframework.Actions;
|
---|
10 | import negotiator.boaframework.BOAparameter;
|
---|
11 | import negotiator.boaframework.NegotiationSession;
|
---|
12 | import negotiator.boaframework.OfferingStrategy;
|
---|
13 | import negotiator.boaframework.OpponentModel;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * This Acceptance Condition will accept an opponent bid if the utility is
|
---|
17 | * higher than the bid the agent is ready to present
|
---|
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 | */
|
---|
23 |
|
---|
24 | public class AcceptanceStrategy_lgsmi extends AcceptanceStrategy {
|
---|
25 |
|
---|
26 |
|
---|
27 | private double a;
|
---|
28 | private double b;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Empty constructor for the BOA framework.
|
---|
32 | */
|
---|
33 |
|
---|
34 | public AcceptanceStrategy_lgsmi() {
|
---|
35 | }
|
---|
36 |
|
---|
37 | // public AcceptanceStrategy_lgsmi(NegotiationSession negoSession, OfferingStrategy strat, double alpha, double beta) //{
|
---|
38 | // this.negotiationSession = negoSession;
|
---|
39 | // this.offeringStrategy = strat;
|
---|
40 | // this.a = alpha;
|
---|
41 | // this.b = beta;
|
---|
42 | // }
|
---|
43 |
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
47 | Map<String, Double> parameters) throws Exception {
|
---|
48 | this.negotiationSession = negoSession;
|
---|
49 | this.offeringStrategy = strat;
|
---|
50 |
|
---|
51 | if (parameters.get("a") != null || parameters.get("b") != null) {
|
---|
52 | a = parameters.get("a");
|
---|
53 | b = parameters.get("b");
|
---|
54 | } else {
|
---|
55 | a = 1;
|
---|
56 | b = 0;
|
---|
57 | }
|
---|
58 | }
|
---|
59 |
|
---|
60 | @Override
|
---|
61 | public String printParameters() {
|
---|
62 | String str = "[a: " + a + " b: " + b + "]";
|
---|
63 | return str;
|
---|
64 | }
|
---|
65 |
|
---|
66 | @Override
|
---|
67 | public Actions determineAcceptability() {
|
---|
68 | double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
69 | double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
70 | .getMyUndiscountedUtil();
|
---|
71 |
|
---|
72 | if (a * lastOpponentBidUtil + b >= nextMyBidUtil) {
|
---|
73 | return Actions.Accept;
|
---|
74 | }
|
---|
75 | return Actions.Reject;
|
---|
76 | }
|
---|
77 |
|
---|
78 | @Override
|
---|
79 |
|
---|
80 | public Set<BOAparameter> getParameterSpec(){
|
---|
81 |
|
---|
82 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
83 | set.add(new BOAparameter("a", 1.0,
|
---|
84 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
85 | set.add(new BOAparameter("b", 0.0,
|
---|
86 | "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
|
---|
87 |
|
---|
88 |
|
---|
89 | return set;
|
---|
90 | }
|
---|
91 |
|
---|
92 |
|
---|
93 |
|
---|
94 | public Map<String, Double> getParameters() {
|
---|
95 | Map<String, Double> map = new HashMap<String, Double>();
|
---|
96 | //Accept when the opponent's utility * a + b is greater than the utility of our current bid
|
---|
97 | map.put("a", 1.0);
|
---|
98 | map.put("b", 0.0);
|
---|
99 | return map;
|
---|
100 | }
|
---|
101 |
|
---|
102 | @Override
|
---|
103 | public String getName() {
|
---|
104 | return "AcceptanceStrategy_lgsmi";
|
---|
105 |
|
---|
106 | }
|
---|
107 | }
|
---|