source: src/main/java/agents/anac/y2019/podagent/Group1_AS.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: 2.5 KB
Line 
1package agents.anac.y2019.podagent;
2
3import java.util.HashSet;
4import java.util.Map;
5import java.util.Set;
6
7import genius.core.BidHistory;
8import genius.core.boaframework.AcceptanceStrategy;
9import genius.core.boaframework.Actions;
10import genius.core.boaframework.BOAparameter;
11import genius.core.boaframework.NegotiationSession;
12import genius.core.boaframework.OfferingStrategy;
13import genius.core.boaframework.OpponentModel;
14import genius.core.timeline.DiscreteTimeline;
15
16public class Group1_AS extends AcceptanceStrategy {
17 public Group1_AS() {
18 }
19
20 public Group1_AS(NegotiationSession negoSession, OfferingStrategy strat, double friendliness, double panic) {
21 this.negotiationSession = negoSession;
22 this.offeringStrategy = strat;
23
24 }
25
26 @Override
27 public void init(NegotiationSession negoSession, OfferingStrategy strat, OpponentModel opponentModel,
28 Map<String, Double> parameters) throws Exception {
29
30 this.negotiationSession = negoSession;
31 this.offeringStrategy = strat;
32 this.opponentModel = opponentModel;
33 }
34
35 /**
36 * Determine whether to accept or not. We use a standard metric of comparing the offer to our next bid,
37 * but because out agent uniquely relies so heavily on our bidding strategy we only give up when we are out of turns
38 * without the need for complicated methods of acceptance.
39 *
40 * @return Actions.Reject if our BS is not in panicMode,
41 * or we are contesting a hard-headed opponent below a threshold.
42 * @return Actions.Accept if we are out of turns, our next bid is lower,
43 * or a hard-headed opponent beats a threshold.
44 */
45 @Override
46 public Actions determineAcceptability() {
47
48 if (negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= offeringStrategy
49 .getNextBid().getMyUndiscountedUtil()) {
50 return Actions.Accept;
51 }
52 if (!getPanicMode()) {
53 return Actions.Reject;
54 }
55 boolean hardHead = false;
56 if (opponentModel instanceof Group1_OM) {
57 hardHead = ((Group1_OM) opponentModel).isHardHeaded();
58 }
59 if(hardHead) {
60 if(negotiationSession.getOpponentBidHistory().getLastBidDetails().getMyUndiscountedUtil() >= 0.95) {
61 return Actions.Accept;
62 }
63 return Actions.Reject;
64 }
65 return Actions.Reject;
66 }
67
68 /**
69 * Get PanicMode from Bidding Strategy
70 *
71 * @return boolean in PanicMode or not
72 */
73 private Boolean getPanicMode() {
74 if(offeringStrategy instanceof Group1_BS) {
75 return ((Group1_BS) offeringStrategy).getPanicMode();
76 }
77 else {
78 return false;
79 }
80 }
81
82 @Override
83 public String getName() {
84 return "Group1_AS";
85 }
86}
Note: See TracBrowser for help on using the repository browser.