1 | package agents.anac.y2014.BraveCat.AcceptanceStrategies;
|
---|
2 |
|
---|
3 | import java.util.HashMap;
|
---|
4 |
|
---|
5 | import agents.anac.y2014.BraveCat.OfferingStrategies.OfferingStrategy;
|
---|
6 | import agents.anac.y2014.BraveCat.OpponentModels.OpponentModel;
|
---|
7 | import agents.anac.y2014.BraveCat.necessaryClasses.NegotiationSession;
|
---|
8 | import genius.core.boaframework.Actions;
|
---|
9 |
|
---|
10 | public class AC_Next extends AcceptanceStrategy {
|
---|
11 | private double a;
|
---|
12 | private double b;
|
---|
13 |
|
---|
14 | public AC_Next() {
|
---|
15 | }
|
---|
16 |
|
---|
17 | public AC_Next(NegotiationSession negoSession, OfferingStrategy strat, double alpha, double beta) {
|
---|
18 | this.negotiationSession = negoSession;
|
---|
19 | this.offeringStrategy = strat;
|
---|
20 | this.a = alpha;
|
---|
21 | this.b = beta;
|
---|
22 | }
|
---|
23 |
|
---|
24 | @Override
|
---|
25 | public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
|
---|
26 | HashMap<String, Double> parameters) throws Exception {
|
---|
27 | this.negotiationSession = negoSession;
|
---|
28 | this.offeringStrategy = strat;
|
---|
29 |
|
---|
30 | if ((parameters.get("a") != null) || (parameters.get("b") != null)) {
|
---|
31 | this.a = ((Double) parameters.get("a")).doubleValue();
|
---|
32 | this.b = ((Double) parameters.get("b")).doubleValue();
|
---|
33 | } else {
|
---|
34 | this.a = 1.0D;
|
---|
35 | this.b = 0.0D;
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public String printParameters() {
|
---|
41 | String str = "[a: " + this.a + " b: " + this.b + "]";
|
---|
42 | return str;
|
---|
43 | }
|
---|
44 |
|
---|
45 | @Override
|
---|
46 | public Actions determineAcceptability() {
|
---|
47 | double nextMyBidUtil = this.offeringStrategy.getNextBid().getMyUndiscountedUtil();
|
---|
48 | double lastOpponentBidUtil = this.negotiationSession.getOpponentBidHistory().getLastBidDetails()
|
---|
49 | .getMyUndiscountedUtil();
|
---|
50 |
|
---|
51 | if (this.a * lastOpponentBidUtil + this.b >= nextMyBidUtil) {
|
---|
52 | return Actions.Accept;
|
---|
53 | }
|
---|
54 | return Actions.Reject;
|
---|
55 | }
|
---|
56 | } |
---|