source: src/main/java/negotiator/boaframework/sharedagentstate/anac2011/NiceTitForTatSAS.java

Last change on this file was 127, checked in by Wouter Pasman, 6 years ago

#41 ROLL BACK of rev.126 . So this version is equal to rev. 125

File size: 2.0 KB
Line 
1package negotiator.boaframework.sharedagentstate.anac2011;
2
3import java.util.ArrayList;
4
5import genius.core.bidding.BidDetails;
6import genius.core.boaframework.NegotiationSession;
7import genius.core.boaframework.SharedAgentState;
8
9/**
10 * This is the shared code of the acceptance condition and bidding strategy of ANAC 2011 Nice Tit for Tat.
11 * The code was taken from the ANAC2011 Nice Tit for Tat and adapted to work within the BOA framework.
12 *
13 * @author Mark Hendrikx
14 */
15public class NiceTitForTatSAS extends SharedAgentState{
16
17 private NegotiationSession negotiationSession;
18
19 public NiceTitForTatSAS (NegotiationSession negoSession) {
20 negotiationSession = negoSession;
21 NAME = "NiceTitForTat";
22 }
23
24 public ArrayList<BidDetails> filterBetween(double minU, double maxU, double minT, double maxT) {
25 ArrayList<BidDetails> filterBids = new ArrayList<BidDetails>();
26 for (BidDetails b : negotiationSession.getOpponentBidHistory().getHistory()) {
27 if (minU < b.getMyUndiscountedUtil() &&
28 b.getMyUndiscountedUtil() <= maxU &&
29 minT < b.getTime() &&
30 b.getTime() <= maxT)
31 filterBids.add(b);
32 }
33 return filterBids;
34 }
35
36 public ArrayList<BidDetails> discountedFilterBetween(double minU, double maxU, double minT, double maxT) {
37 ArrayList<BidDetails> filterBids = new ArrayList<BidDetails>();
38 for (BidDetails b : negotiationSession.getOpponentBidHistory().getHistory()) {
39 if (minU < negotiationSession.getDiscountedUtility(b.getBid(), b.getTime()) &&
40 negotiationSession.getDiscountedUtility(b.getBid(), b.getTime()) <= maxU &&
41 minT < b.getTime() &&
42 b.getTime() <= maxT)
43 filterBids.add(b);
44 }
45 return filterBids;
46 }
47
48
49 public ArrayList<BidDetails> filterBetweenTime(double minT, double maxT){
50 return filterBetween(0,1, minT, maxT);
51 }
52
53 public boolean isDomainBig() {
54 negotiationSession.getUtilitySpace().getDomain().getNumberOfPossibleBids();
55 return negotiationSession.getUtilitySpace().getDomain().getNumberOfPossibleBids() > 10000;
56 }
57}
Note: See TracBrowser for help on using the repository browser.