1 public class Estimator {
9 public Estimator(int stages) {
14 this.probtable = new double[31];
16 this.probtable[i++] = 0.5000;
17 this.probtable[i++] = 0.5398;
18 this.probtable[i++] = 0.5793;
19 this.probtable[i++] = 0.6179;
20 this.probtable[i++] = 0.6554;
21 this.probtable[i++] = 0.6915;
22 this.probtable[i++] = 0.7257;
23 this.probtable[i++] = 0.7580;
24 this.probtable[i++] = 0.7881;
25 this.probtable[i++] = 0.8159;
26 this.probtable[i++] = 0.8413;
27 this.probtable[i++] = 0.8643;
28 this.probtable[i++] = 0.8849;
29 this.probtable[i++] = 0.9032;
30 this.probtable[i++] = 0.9192;
31 this.probtable[i++] = 0.9332;
32 this.probtable[i++] = 0.9452;
33 this.probtable[i++] = 0.9554;
34 this.probtable[i++] = 0.9641;
35 this.probtable[i++] = 0.9713;
36 this.probtable[i++] = 0.9772;
37 this.probtable[i++] = 0.9821;
38 this.probtable[i++] = 0.9861;
39 this.probtable[i++] = 0.9893;
40 this.probtable[i++] = 0.9918;
41 this.probtable[i++] = 0.9938;
42 this.probtable[i++] = 0.9953;
43 this.probtable[i++] = 0.9965;
44 this.probtable[i++] = 0.9974;
45 this.probtable[i++] = 0.9981;
46 this.probtable[i++] = 0.9987;
51 public boolean estimate(int time, double variance2, boolean fake) {
54 this.variance += variance2;
59 if(this.stages == 0) {
60 //System.out.print("variance2: " + (int)(this.variance*100) + "(/100); ");
61 this.variance = Math.sqrt(this.variance);
62 //System.out.println("variance: " + (int)(this.variance*100) + "(/100)");
68 public double getProbability(int x, int y) {
76 double prob = prob(r) - prob(l);
80 private double prob(int s) {
81 int tmp = (int)((s - this.time) * 10 / this.variance);
82 //System.out.println(tmp);
83 int abs = (int)Math.abs(tmp);
85 if(abs > this.probtable.length - 1) {
88 prob = this.probtable[abs];
97 public int getTime() {
101 public double getVariance() {
102 return this.variance;
105 public boolean isPartial() {