source: src/main/java/agents/anac/y2011/ValueModelAgent/BidWrapper.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: 1.6 KB
Line 
1package agents.anac.y2011.ValueModelAgent;
2
3import java.util.Comparator;
4
5import genius.core.Bid;
6import genius.core.utility.AbstractUtilitySpace;
7
8public class BidWrapper {
9 public boolean sentByUs;
10 public boolean sentByThem;
11 public int lastSentBid;
12 public double ourUtility;
13 public double theirUtility;
14 public double theirUtilityReliability;
15 public Bid bid;
16
17 public BidWrapper(Bid bid, AbstractUtilitySpace space, double maxUtil) {
18 this.bid = bid;
19 sentByUs = false;
20 sentByThem = false;
21 try {
22 ourUtility = space.getUtility(bid) / maxUtil;
23 } catch (Exception e) {
24 ourUtility = 0;
25 }
26 theirUtility = 0;
27 }
28
29 public void update(ValueModeler model) {
30 try {
31 ValueDecrease val = model.utilityLoss(bid);
32 theirUtility = 1 - val.getDecrease();
33 theirUtilityReliability = val.getReliabilty();
34 } catch (Exception ex) {
35
36 }
37 }
38
39 public class OpponentUtilityComperator implements Comparator<BidWrapper> {
40
41 public int compare(BidWrapper o1, BidWrapper o2) {
42 if (o1.theirUtility < o2.theirUtility) {
43 return 1;
44 }
45 if (o1.theirUtility > o2.theirUtility) {
46 return -1;
47 }
48 return 0;
49 }
50
51 }
52
53 public class OurUtilityComperator implements Comparator<BidWrapper> {
54
55 public int compare(BidWrapper o1, BidWrapper o2) {
56 if (o1.ourUtility < o2.ourUtility) {
57 return 1;
58 }
59 if (o1.ourUtility > o2.ourUtility) {
60 return -1;
61 }
62 return 0;
63 }
64
65 }
66
67 public boolean equals(BidWrapper o) {
68 return bid.equals(o.bid);
69 }
70
71 @Override
72 public boolean equals(Object obj) {
73 if (obj instanceof BidWrapper)
74 return equals((BidWrapper) obj);
75 return false;
76 }
77
78}
Note: See TracBrowser for help on using the repository browser.