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