Exemple #1
0
        private List <RilData> ExtrapolateFutureData(List <RilData> pastData)
        {
            const int nbSlices = 1000;

            //get growth Coefficient
            SpawnCoeff  spawnCoeffs  = CalculateSpawnCoefficient(pastData, 0.3f, nbSlices);
            GrowthCoeff growthCoeffs = CalculateGrowthCoefficient(pastData, 0.3f, nbSlices);

            return(PredictFutureData(pastData, spawnCoeffs, growthCoeffs));
        }
Exemple #2
0
        private static List <RilData> PredictFutureData(List <RilData> pastData,
                                                        SpawnCoeff spawnCoeffs,
                                                        GrowthCoeff growthCoeffs)
        {
            if (spawnCoeffs.Values.Length != growthCoeffs.Values.Length)
            {
                throw new Exception("Coefficient arrays are not the same length");
            }

            List <RilData> newData = new List <RilData>(pastData);

            Random rnd = new Random();

            for (int i = 0; i < spawnCoeffs.Values.Length; i++)
            {
                int   nbOfDataToCreate        = (int)Math.Ceiling(spawnCoeffs.Values[i]);
                float timespanBetweenTwoSpawn = spawnCoeffs.NormalizedTimespanOfSlice / nbOfDataToCreate;
                float batSize = growthCoeffs.Values[i] / nbOfDataToCreate;
                float lastT   = 1f; // we start the time at the end of the normalized timeline

                for (int dataToCreateIndex = 0; dataToCreateIndex < nbOfDataToCreate; dataToCreateIndex++)
                {
                    float futureT = lastT + timespanBetweenTwoSpawn;

                    //noise function for Nb log
                    RilData pastDatatoGetPosFrom = pastData[rnd.Next(0, pastData.Count - 1)];
                    float[] futurePos            = new[] { pastDatatoGetPosFrom.X, pastDatatoGetPosFrom.Y };

                    futurePos[0] += (rnd.Next(0, 50) - 25);
                    futurePos[1] += (rnd.Next(0, 50) - 25);
                    RilData rilData = new RilData("future", futurePos[0], futurePos[1], futureT)
                    {
                        //TODO : Add Noise here for organic results
                        NOMBRE_LOG = batSize
                    };

                    newData.Add(rilData);
                }
            }

            //Reassign new T with max being extrapolation
            float newMaxT = newData.Max(data => data.T);

            foreach (RilData rilData in pastData)
            {
                rilData.SetT(rilData.T / newMaxT);
            }

            return(newData);
        }