source: src/main/java/agents/anac/y2014/BraveCat/OpponentModels/OpponentModel.java@ 126

Last change on this file since 126 was 126, checked in by Aron Hammond, 6 years ago

Added function to calculate opposition to MultiLateralAnalysis.java

Moved code to add RLBOA listeners to RLBOAUtils is misc package

Added input for strategyParameters to SessionPanel (gui)

!! close SessionInfo after tournament; this caused /tmp/ to fill up with GeniusData files

Our own package:

  • Added opponents and strategies that are mentioned in the report
  • Change class hierarchy, agents can now extend from RLBOAagentBilateral to inherit RL functionality.
  • States extend from AbstractState
File size: 3.3 KB
Line 
1package agents.anac.y2014.BraveCat.OpponentModels;
2
3import java.io.Serializable;
4import java.util.HashMap;
5
6import agents.anac.y2014.BraveCat.necessaryClasses.NegotiationSession;
7import genius.core.Bid;
8import genius.core.NegotiationResult;
9import genius.core.bidding.BidDetails;
10import genius.core.boaframework.BoaType;
11import genius.core.issue.Issue;
12import genius.core.protocol.BilateralAtomicNegotiationSession;
13import genius.core.utility.AbstractUtilitySpace;
14import genius.core.utility.AdditiveUtilitySpace;
15import genius.core.utility.UTILITYSPACETYPE;
16
17public abstract class OpponentModel {
18 protected NegotiationSession negotiationSession;
19 protected AbstractUtilitySpace opponentUtilitySpace;
20 private boolean cleared;
21
22 public void init(NegotiationSession negotiationSession, HashMap<String, Double> parameters,
23 UTILITYSPACETYPE utilitySpaceType) throws Exception {
24 this.negotiationSession = negotiationSession;
25 this.opponentUtilitySpace = (AbstractUtilitySpace) negotiationSession.getUtilitySpace().copy();
26 this.cleared = false;
27 }
28
29 public void init(NegotiationSession negotiationSession) throws Exception {
30 this.negotiationSession = negotiationSession;
31 this.cleared = false;
32 }
33
34 public void init(NegotiationSession negotiationSession, UTILITYSPACETYPE utilitySpaceType) throws Exception {
35 this.negotiationSession = negotiationSession;
36 this.opponentUtilitySpace = (AbstractUtilitySpace) negotiationSession.getUtilitySpace().copy();
37 this.cleared = false;
38 }
39
40 public void updateModel(Bid opponentBid) {
41 updateModel(opponentBid, this.negotiationSession.getTime());
42 }
43
44 public abstract void updateModel(Bid paramBid, double paramDouble);
45
46 public double getBidEvaluation(Bid bid) throws Exception {
47 try {
48 return this.opponentUtilitySpace.getUtility(bid);
49 } catch (Exception e) {
50 }
51 return -1.0D;
52 }
53
54 public double getBidEvaluation(BidDetails bid) throws Exception {
55 return 0;
56 }
57
58 public double getRealBidEvaluation(Bid bid) throws Exception {
59 return 0;
60 }
61
62 public AbstractUtilitySpace getOpponentUtilitySpace() {
63 return this.opponentUtilitySpace;
64 }
65
66 public void setOpponentUtilitySpace(BilateralAtomicNegotiationSession fNegotiation) {
67 }
68
69 public void setOpponentUtilitySpace(AdditiveUtilitySpace opponentUtilitySpace) {
70 }
71
72 public double getWeight(Issue issue) {
73 if (opponentUtilitySpace instanceof AdditiveUtilitySpace) {
74 return ((AdditiveUtilitySpace) this.opponentUtilitySpace).getWeight(issue.getNumber());
75 }
76 return 0;
77 }
78
79 public double[] getIssueWeights() {
80 double[] estimatedIssueWeights = new double[this.negotiationSession.getUtilitySpace().getDomain().getIssues()
81 .size()];
82 int i = 0;
83 for (Issue issue : this.negotiationSession.getUtilitySpace().getDomain().getIssues()) {
84 estimatedIssueWeights[i] = getWeight(issue);
85 i++;
86 }
87 return estimatedIssueWeights;
88 }
89
90 public void cleanUp() {
91 this.negotiationSession = null;
92 this.cleared = true;
93 }
94
95 public boolean isCleared() {
96 return this.cleared;
97 }
98
99 public String getName() {
100 return "Default";
101 }
102
103 public final void storeData(Serializable object) {
104 this.negotiationSession.setData(BoaType.OPPONENTMODEL, object);
105 }
106
107 public final Serializable loadData() {
108 return this.negotiationSession.getData(BoaType.OPPONENTMODEL);
109 }
110
111 public void endSession(NegotiationResult result) {
112 }
113}
Note: See TracBrowser for help on using the repository browser.