source: src/main/java/agents/anac/y2014/BraveCat/AcceptanceStrategies/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: 1.7 KB
Line 
1package agents.anac.y2014.BraveCat.AcceptanceStrategies;
2
3import java.util.HashMap;
4
5import agents.anac.y2014.BraveCat.OfferingStrategies.OfferingStrategy;
6import agents.anac.y2014.BraveCat.OpponentModels.OpponentModel;
7import agents.anac.y2014.BraveCat.necessaryClasses.NegotiationSession;
8import genius.core.boaframework.Actions;
9
10public 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}
Note: See TracBrowser for help on using the repository browser.