source: src/main/java/agents/anac/y2010/Southampton/utils/concession/SpecialTimeConcessionFunction.java

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

Initial import : Genius 9.0.0

File size: 1002 bytes
Line 
1package agents.anac.y2010.Southampton.utils.concession;
2
3public class SpecialTimeConcessionFunction extends ConcessionFunction {
4
5 private double beta;
6 private double breakoff;
7 private double defaultBeta;
8
9 public SpecialTimeConcessionFunction(double beta, double defaultBeta, double breakoff) {
10 this.beta = beta;
11 this.breakoff = breakoff;
12 this.defaultBeta = defaultBeta;
13 }
14
15 @Override
16 public double getConcession(double startUtility, long currentTime, double totalTime) {
17 double utilityBeta = startUtility - (startUtility - breakoff) * Math.pow(currentTime / totalTime, 1.0 / beta);
18 double utilityDefaultBeta = startUtility - (startUtility - breakoff) * Math.pow(currentTime / totalTime, 1.0 / defaultBeta);
19 double gamePercent = currentTime / totalTime;
20 if(gamePercent < 0.2)
21 {
22 return utilityDefaultBeta;
23 }
24 if(gamePercent < 0.4)
25 {
26 return (utilityDefaultBeta * (1 - ((gamePercent - 0.2)/0.2))) + (utilityBeta * ((gamePercent - 0.2)/0.2));
27 }
28 return utilityBeta;
29 }
30}
Note: See TracBrowser for help on using the repository browser.