コード例 #1
0
        public void TestBucket()
        {
            MonteCarloOperations operations = new MonteCarloOperations();

            int[] Estimation = operations.CalculateEstimated();
            int   min = Estimation[0], max = Estimation[2];
            var   bucket = new Bucketing(10, 40, 160);
            //Assert.That(operations.Simulate)
        }
コード例 #2
0
        //Monte carlo algorithm, more iterations more accurate estimation with costs of performance
        public Bucketing Simulate()
        {
            int totalCostOfRandomPlans = 0;
            int iterations             = 10000;

            int[] Estimation = CalculateEstimated();
            int   min = Estimation[0], max = Estimation[2];
            //int HowManyBuckets = max - min;
            Bucketing bucket = new Bucketing(10, min, max);


            for (int i = 0; i < iterations; i++)
            {
                int randomPlanCost = GenerateRandomEstimate();

                bucket.addValueToBucket(randomPlanCost);

                totalCostOfRandomPlans += randomPlanCost;
            }
            this.AverageEstimation = totalCostOfRandomPlans / (iterations);

            return(bucket);
        }