source: src/main/java/agents/anac/y2015/AgentNeo/OwnBids.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.y2015.AgentNeo;
2
3import java.util.ArrayList;
4
5import genius.core.Bid;
6import genius.core.utility.AbstractUtilitySpace;
7import genius.core.utility.AdditiveUtilitySpace;
8
9public class OwnBids {
10
11 private ArrayList<Bid> BidHistory;
12 private Bid minBidInHistory;
13
14 public OwnBids() {
15 BidHistory = new ArrayList<Bid>();
16 }
17
18 protected void addBid(Bid bid, AbstractUtilitySpace utilitySpace) {
19 // if (BidHistory.indexOf(bid) == -1) {
20 BidHistory.add(bid);
21 System.out.println(minBidInHistory + "OWN BIDS");
22 // }
23 try {
24 if (BidHistory.size() == 1) {
25 this.minBidInHistory = BidHistory.get(0);
26
27 } else {
28
29 if (utilitySpace.getUtility(bid) < utilitySpace
30 .getUtility(this.minBidInHistory)) {
31 this.minBidInHistory = bid;
32
33 }
34 }
35 } catch (Exception e) {
36 System.out.println("error in addBid method of OwnBidHistory class "
37 + e.getMessage());
38 }
39 }
40
41 protected Bid GetMinBidInHistory() {
42
43 return this.minBidInHistory;
44 }
45
46 protected Bid getLastBid() {
47 if (BidHistory.size() >= 1) {
48 return BidHistory.get(BidHistory.size() - 1);
49 } else {
50 return null;
51 }
52 }
53
54 protected int numOfBidsProposed() {
55 System.out.println("No. of bids proposed = " + BidHistory.size());
56 return BidHistory.size();
57 }
58
59 protected Bid chooseLowestBidInHistory(AdditiveUtilitySpace utilitySpace) {
60 double minUtility = 100;
61 Bid minBid = null;
62 try {
63 for (Bid bid : BidHistory) {
64 if (utilitySpace.getUtility(bid) < minUtility) {
65 minUtility = utilitySpace.getUtility(bid);
66 minBid = bid;
67 }
68 }
69 } catch (Exception e) {
70 System.out.println("Exception in chooseLowestBidInHistory");
71 }
72 return minBid;
73 }
74}
Note: See TracBrowser for help on using the repository browser.