source: src/main/java/negotiator/boaframework/sharedagentstate/anac2011/BRAMAgentSAS.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.4 KB
Line 
1package negotiator.boaframework.sharedagentstate.anac2011;
2import genius.core.Bid;
3import genius.core.boaframework.NegotiationSession;
4import genius.core.boaframework.SharedAgentState;
5
6/**
7 * This is the shared code of the acceptance condition and bidding strategy of ANAC 2011 BRAMAagent.
8 * The code was taken from the ANAC2011 BRAMAagent and adapted to work within the BOA framework.
9 *
10 * @author Mark Hendrikx
11 */
12public class BRAMAgentSAS extends SharedAgentState{
13
14 private NegotiationSession negotiationSession;
15
16 //The threshold will be calculated as percentage of the required utility depending of the elapsed time
17 private final double THRESHOLD_PERC_FLEXIBILITY_1 = 0.07;
18 private final double THRESHOLD_PERC_FLEXIBILITY_2 = 0.15;
19 private final double THRESHOLD_PERC_FLEXIBILITY_3 = 0.3;
20 private final double THRESHOLD_PERC_FLEXIBILITY_4 = 0.8;
21 private double threshold = 0;
22
23 public BRAMAgentSAS (NegotiationSession negoSession) {
24 negotiationSession = negoSession;
25 NAME = "BRAMAgent";
26 }
27
28
29 public double getThreshold() {
30 return threshold;
31 }
32
33
34 /**
35 * This function calculates the threshold.
36 * It takes into consideration the time that passed from the beginning of the game.
37 * As time goes by, the agent becoming more flexible to the offers that it is willing to accept.
38 *
39 * @return - the threshold
40 */
41 public double getNewThreshold(Bid minBid, Bid maxBid) {
42 double time = negotiationSession.getTime();
43 double minUtil = negotiationSession.getUtilitySpace().getUtilityWithDiscount(minBid, time);
44 double maxUtil = negotiationSession.getUtilitySpace().getUtilityWithDiscount(maxBid, time);
45 double thresholdBestBidDiscount = 0.0;
46
47 if(negotiationSession.getTimeline().getTime() < 60.0 / 180.0) {
48 thresholdBestBidDiscount = maxUtil - (maxUtil-minUtil)* THRESHOLD_PERC_FLEXIBILITY_1;
49
50 } else if(negotiationSession.getTimeline().getTime() < 150.0 / 180.0) {
51 thresholdBestBidDiscount = maxUtil - (maxUtil-minUtil) * THRESHOLD_PERC_FLEXIBILITY_2;
52 }
53 else if (negotiationSession.getTimeline().getTime() < 175.0 / 180.0)
54 thresholdBestBidDiscount = maxUtil - (maxUtil-minUtil)* THRESHOLD_PERC_FLEXIBILITY_3;
55 else {
56 thresholdBestBidDiscount = maxUtil - (maxUtil-minUtil)* THRESHOLD_PERC_FLEXIBILITY_4;
57 }
58
59 threshold = thresholdBestBidDiscount;
60 return thresholdBestBidDiscount;
61 }
62}
Note: See TracBrowser for help on using the repository browser.