source: src/main/java/agents/anac/y2019/minf/etc/AC_Next.java

Last change on this file was 200, checked in by Katsuhide Fujita, 5 years ago

Add ANAC 2019 agents

  • Property svn:executable set to *
File size: 3.4 KB
Line 
1package agents.anac.y2019.minf.etc;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.boaframework.AcceptanceStrategy;
8import genius.core.boaframework.Actions;
9import genius.core.boaframework.BOAparameter;
10import genius.core.boaframework.NegotiationSession;
11import genius.core.boaframework.OfferingStrategy;
12import genius.core.boaframework.OpponentModel;
13import genius.core.timeline.Timeline;
14
15public class AC_Next extends AcceptanceStrategy {
16
17 private double a;
18 private double b;
19
20 /** Negotiation Information */
21 private NegotiationInfo negotiationInfo;
22
23 public AC_Next(){
24 }
25
26 public AC_Next(NegotiationInfo negInfo){
27 negotiationInfo = negInfo;
28 }
29
30 public AC_Next(NegotiationSession negoSession, OfferingStrategy strat,
31 double alpha, double beta) {
32 this.negotiationSession = negoSession;
33 this.offeringStrategy = strat;
34 this.a = alpha;
35 this.b = beta;
36 }
37
38 @Override
39 public void init(NegotiationSession negoSession, OfferingStrategy strat,
40 OpponentModel opponentModel, Map<String, Double> parameters)
41 throws Exception {
42 this.negotiationSession = negoSession;
43 this.offeringStrategy = strat;
44
45 if (parameters.get("a") != null || parameters.get("b") != null) {
46 a = parameters.get("a");
47 b = parameters.get("b");
48 } else {
49 a = 1;
50 b = 0;
51 }
52 }
53
54 @Override
55 public String printParameters() {
56 String str = "[a: " + a + " b: " + b + "]";
57 return str;
58 }
59
60 @Override
61 public Actions determineAcceptability() {
62 double time = negotiationSession.getTime();
63 double lastOpponentBidUtil = negotiationSession.getOpponentBidHistory()
64 .getLastBidDetails().getMyUndiscountedUtil();
65 double nextMyBidUtil = offeringStrategy.getNextBid().getMyUndiscountedUtil();
66 double threshold = negotiationInfo.getThreshold(time);
67
68 if (a * lastOpponentBidUtil + b >= (nextMyBidUtil + threshold)/2.0D) {
69 return Actions.Accept;
70 }
71
72 if (time >= 0.975 && lastOpponentBidUtil >= 0.9D) {
73 return Actions.Accept;
74 }
75
76 if (threshold <= negotiationSession.getUtilitySpace().getReservationValueUndiscounted()){
77 return Actions.Break;
78 }
79
80 if (negotiationSession.getTimeline().getType() == Timeline.Type.Time && time >= 0.999) {
81 if (negotiationSession.getUtilitySpace().getReservationValueUndiscounted() <= lastOpponentBidUtil) {
82 return Actions.Accept;
83 }
84 }
85
86 if (negotiationSession.getTimeline().getType() == Timeline.Type.Rounds
87 && negotiationSession.getTimeline().getCurrentTime() == negotiationSession.getTimeline().getTotalTime()-1){
88 if (negotiationSession.getUtilitySpace().getReservationValueUndiscounted() <= lastOpponentBidUtil) {
89 if(!negotiationInfo.isFirst() ||
90 negotiationSession.getOpponentBidHistory().getBestBidDetails().getMyUndiscountedUtil()
91 != negotiationSession.getOpponentBidHistory().getWorstBidDetails().getMyUndiscountedUtil()){
92 return Actions.Accept;
93 }
94 }
95 }
96
97 return Actions.Reject;
98 }
99
100 @Override
101 public Set<BOAparameter> getParameterSpec() {
102
103 Set<BOAparameter> set = new HashSet<BOAparameter>();
104 set.add(new BOAparameter("a", 1.0,
105 "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
106 set.add(new BOAparameter("b", 0.0,
107 "Accept when the opponent's utility * a + b is greater than the utility of our current bid"));
108
109 return set;
110 }
111
112 @Override
113 public String getName() {
114 return "AC_Next";
115 }
116}
Note: See TracBrowser for help on using the repository browser.