public Bid chooseBestFromHistory(UtilitySpace utilitySpace) { double max = -1; Bid maxBid = null; try { for (Bid bid : bidHistory) { if (max < utilitySpace.getUtility(bid)) { max = utilitySpace.getUtility(bid); maxBid = bid; } } } catch (Exception e) { System.out.println("ChooseBestfromhistory exception"); } return maxBid; }
public void updateOppRec(Bid oppbid, Object sender) { if (partyOrder.size() < partyNum - 1) { partyOrder.add(sender); oppMax.add(oppbid); } else { try { if (fUtilitySpace.getUtility(oppMax.get(partyOrder.indexOf(sender))) < fUtilitySpace.getUtility(oppbid)) oppMax.set(partyOrder.indexOf(sender), oppbid); } catch (Exception e) { System.out.println("error in updateOppRec method" + e.getMessage()); } } }
public void addBid(Bid bid, UtilitySpace utilitySpace) { if (bidHistory.indexOf(bid) == -1) { bidHistory.add(bid); } try { if (bidHistory.size() == 1) { this.bid_maximum_from_opponent = bidHistory.get(0); } else { if (utilitySpace.getUtility(bid) > utilitySpace.getUtility(this.bid_maximum_from_opponent)) { this.bid_maximum_from_opponent = bid; } } } catch (Exception e) { System.out.println("error in addBid method" + e.getMessage()); } }
public Bid getMiniBestOpp() { // Bid bid = null; // int temp = 0; Bid bid = oppMax.get(0); for (int i = 0; i < partyNum - 1; i++) { try { // System.out.println("test in method // getMiniBestOpp"+oppMax.get(0)+","+fUtilitySpace.getUtility(oppMax.get(0))); // System.out.println("test in method // getMiniBestOpp"+oppMax.get(1)+","+fUtilitySpace.getUtility(oppMax.get(1))); if (fUtilitySpace.getUtility(bid) > fUtilitySpace.getUtility(oppMax.get(i))) bid = oppMax.get(i); } catch (Exception e) { System.out.println("error in method getMiniBestOpp"); } } return bid; }