1 | package negotiator.boaframework.acceptanceconditions.other;
|
---|
2 |
|
---|
3 | import java.util.HashSet;
|
---|
4 | import java.util.Map;
|
---|
5 | import java.util.Set;
|
---|
6 |
|
---|
7 | import genius.core.boaframework.AcceptanceStrategy;
|
---|
8 | import genius.core.boaframework.Actions;
|
---|
9 | import genius.core.boaframework.BOAparameter;
|
---|
10 | import genius.core.boaframework.NegotiationSession;
|
---|
11 | import genius.core.boaframework.OfferingStrategy;
|
---|
12 | import genius.core.boaframework.OpponentModel;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * This is the decoupled Acceptance Conditions Based on Tim Baarslag's paper on
|
---|
16 | * Acceptance Conditions: "Acceptance Conditions in Automated Negotiation"
|
---|
17 | *
|
---|
18 | * This Acceptance Condition accepts a bid if the utility of the opponent's bid
|
---|
19 | * plus a constant (the gap) is higher than the utility of the next bid. The
|
---|
20 | * acceptance condition is a restricted version of AC_next.
|
---|
21 | *
|
---|
22 | * Decoupling Negotiating Agents to Explore the Space of Negotiation Strategies
|
---|
23 | * T. Baarslag, K. Hindriks, M. Hendrikx, A. Dirkzwager, C.M. Jonker
|
---|
24 | *
|
---|
25 | * @author Alex Dirkzwager
|
---|
26 | */
|
---|
27 | public class AC_Gap extends AcceptanceStrategy {
|
---|
28 |
|
---|
29 | private double constant;
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Empty constructor for the BOA framework.
|
---|
33 | */
|
---|
34 | public AC_Gap() {
|
---|
35 | }
|
---|
36 |
|
---|
37 | public AC_Gap(NegotiationSession negoSession, double c) {
|
---|
38 | this.negotiationSession = negoSession;
|
---|
39 | this.constant = c;
|
---|
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 | if (parameters.get("c") != null) {
|
---|
47 | constant = parameters.get("c");
|
---|
48 | } else {
|
---|
49 | throw new Exception("Constant \"c\" for the threshold was not set.");
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | @Override
|
---|
54 | public String printParameters() {
|
---|
55 | return "[c: " + constant + "]";
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Override
|
---|
59 | public Actions determineAcceptability() {
|
---|
60 | if (!negotiationSession.getOwnBidHistory().getHistory().isEmpty()) {
|
---|
61 | double opponentBidUtil = negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
62 | .getMyUndiscountedUtil();
|
---|
63 | double prevMyBidUtil = negotiationSession.getOwnBidHistory().getLastBidDetails().getMyUndiscountedUtil();
|
---|
64 |
|
---|
65 | if (opponentBidUtil + constant >= prevMyBidUtil) {
|
---|
66 | return Actions.Accept;
|
---|
67 | }
|
---|
68 | }
|
---|
69 | return Actions.Reject;
|
---|
70 | }
|
---|
71 |
|
---|
72 | @Override
|
---|
73 | public Set<BOAparameter> getParameterSpec() {
|
---|
74 | Set<BOAparameter> set = new HashSet<BOAparameter>();
|
---|
75 | set.add(new BOAparameter("c", 0.01,
|
---|
76 | "Accept when opponent's bid utility plus constant c is greater than utility of previous offer"));
|
---|
77 | return set;
|
---|
78 | }
|
---|
79 |
|
---|
80 | @Override
|
---|
81 | public String getName() {
|
---|
82 | return "Other - Gap";
|
---|
83 | }
|
---|
84 | } |
---|