source: src/main/java/agents/anac/y2011/ValueModelAgent/ValueDecrease.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: 2.3 KB
Line 
1package agents.anac.y2011.ValueModelAgent;
2
3public class ValueDecrease{
4 private double decrease;
5 //well its not real std deviation, its
6 //an abstraction, but is similar some what to weighted average
7 private double avDev;
8 private double reliabilty;
9 private int lastSent;
10 private double highestReliability;
11
12
13 ValueDecrease(double val, double rel,double dev){
14 avDev = dev;
15 reliabilty = rel;
16 decrease = val;
17 lastSent=-1;
18 highestReliability=rel;
19 }
20 public double getDecrease(){
21 return decrease;
22 }
23 public void forceChangeDecrease(double newDecrease){
24 decrease = newDecrease;
25 }
26 public double getReliabilty(){
27 return reliabilty;
28 }
29 public double getMaxReliabilty(){
30 return reliabilty;
31 }
32 public double getDeviance(){
33 return avDev;
34 }
35 public int lastSent(){
36 return lastSent;
37 }
38 public void sent(int bidIndex){
39 lastSent = bidIndex;
40 }
41 //if the value is 100% reliable and the change is also very reliable
42 //what chunk of the value should be given to the new value
43 //the actual effect of the new value is dependent on the reliabilty
44 //of both.
45 static private final double tempralDifferenceGamma = 0.1;
46 private double sq(double x){return x*x;}
47 public void updateWithNewValue(double newVal,double newReliability){
48 if(reliabilty!=0.02){
49 double newChunk = newReliability*(1-reliabilty);
50 double temporalC = reliabilty*tempralDifferenceGamma*newReliability;
51 newChunk+=temporalC;
52 double oldChunk = reliabilty-temporalC;
53 double sumChunk = newChunk+oldChunk;
54 //newChunk/=sumChunk;
55 //oldChunk/=sumChunk;
56 double newDecrease = (newChunk*newVal+oldChunk*decrease)/sumChunk;
57 double change = Math.abs(newDecrease-decrease);
58 //this is a simplification of a real deviance calculation
59 double newDev = Math.sqrt((oldChunk/2*sq(avDev+change)
60 +oldChunk/2*sq(avDev-change)
61 +newChunk*sq(newVal-newDecrease))/sumChunk);
62 double temp = 1-change/(2*newDev);
63 reliabilty = oldChunk * (temp>0.2?temp:0.2);
64 temp = 1-(Math.abs(newDecrease-newVal)/(2*newDev));
65 reliabilty +=newChunk * (temp>0?temp:0);
66 decrease = newDecrease;
67 avDev = newDev;
68 if(highestReliability<reliabilty){
69 highestReliability = reliabilty;
70 }
71 }
72 //if this is the first time we really got this value than
73 //the original value is meaningless
74 else{
75 decrease = newVal;
76 reliabilty = newReliability;
77 avDev = 0.03;
78 }
79 }
80}
Note: See TracBrowser for help on using the repository browser.