Example #1
0
 public override void Configure(params RVariant[] args)
 {
     base.Configure(args);
     _mode = Config[2];
     SeerH = new HashForeseer(Config[3], Config[4], new HorzVertForeseer());
     SeerV = new HashForeseer(Config[3], Config[4], new HorzVertForeseer());
 }
Example #2
0
        public int PredictionEnTransformXor(Foreseer foreseer)
        {
            IntField orig = this.Clone();

            foreseer.Initialize(orig);
            int wrongPredictions = 0;

            int p = 0;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++, p++)
                {
                    int predicted = foreseer.Foresee(orig, x, y);
                    Data[p] = orig.Data[p] ^ predicted;
                    if (Data[p] != 0)
                    {
                        wrongPredictions++;
                    }
                    foreseer.Learn(orig, x, y, orig.Data[p], predicted);
                }
            }

            return(wrongPredictions);
        }
Example #3
0
 public VariableSizeForeseer(int width, int height, int xpos, Foreseer fallback)
 {
     _width    = width;
     _height   = height;
     _xpos     = xpos;
     _fallback = fallback;
 }
Example #4
0
 public FixedSizeMonoForeseer(int width, int height, int xpos, Foreseer fallback)
 {
     _width    = width;
     _height   = height;
     _xpos     = xpos;
     _fallback = fallback;
 }
Example #5
0
        public void PredictionDeTransformXor(Foreseer foreseer)
        {
            IntField diff = this.Clone();

            foreseer.Initialize(this);

            int p = 0;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++, p++)
                {
                    int predicted = foreseer.Foresee(this, x, y);
                    Data[p] = diff.Data[p] ^ predicted;
                    foreseer.Learn(this, x, y, this.Data[p], predicted);
                }
            }
        }
Example #6
0
        public void Prediction(Foreseer foreseer)
        {
            IntField orig = this.Clone();

            foreseer.Initialize(orig);

            int p = 0;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++, p++)
                {
                    int predicted = foreseer.Foresee(orig, x, y);
                    Data[p] = predicted;
                    foreseer.Learn(orig, x, y, orig.Data[p], predicted);
                }
            }
        }
Example #7
0
        public HashForeseer(int maxW, int maxH, Foreseer fallback)
        {
            _fallback = fallback;
            var seq   = new[] { 3, 4, 5, 7, 9, 13, 17, 21 };
            var sizes = new List <Size>();

            for (int xi = 0; xi < seq.Length; xi++)
            {
                for (int yi = 0; yi < seq.Length; yi++)
                {
                    if (seq[xi] <= maxW && seq[yi] <= maxH)
                    {
                        sizes.Add(new Size(seq[xi], seq[yi]));
                    }
                }
            }
            _sizes = sizes.OrderByDescending(sz => sz.Width * sz.Height).ToArray();
        }
Example #8
0
        public void PredictionEnTransformDiff(Foreseer foreseer, int modulus)
        {
            IntField orig = this.Clone();

            foreseer.Initialize(orig);

            int p = 0;

            for (int y = 0; y < Height; y++)
            {
                for (int x = 0; x < Width; x++, p++)
                {
                    int predicted = foreseer.Foresee(orig, x, y);
                    Data[p] = orig.Data[p] - predicted;
                    if (Data[p] < 0)
                    {
                        Data[p] += modulus;
                    }
                    foreseer.Learn(orig, x, y, orig.Data[p], predicted);
                }
            }
        }
Example #9
0
 public override void Configure(params RVariant[] args)
 {
     base.Configure(args);
     Seer = new FixedSizeForeseer((int)Config[0], (int)Config[1], (int)Config[2], new HorzVertForeseer());
 }
Example #10
0
 public override void Configure(params RVariant[] args)
 {
     base.Configure(args);
     Seer = new FixedSizeForeseer((int)Config[0], (int)Config[1], (int)Config[2], new HorzVertForeseer());
     RLE  = new RunLength01LongShortCodec((int)Config[3], (int)Config[4]);
 }