Пример #1
0
        public Distributions(Asset asset, WeightRate weightRate, PDFType pdf, InputModel model)
        {
            yearsOfAdditions  = asset.yearsOfAdd;
            yearsOfWithdrawls = asset.yearsOfWith;
            additions         = asset.addPerYear;
            this.pdf          = pdf;
            withdrawls        = asset.withperYear;
            initialAmount     = asset.currAmount;
            this.model        = model;
            this.asset        = asset;
            percentiles       = new List <Percentiles>(9);

            switch (pdf)
            {
            case PDFType.Normal:
                weightedRates = weightRate.weightedRatesNormal;
                break;

            case PDFType.Laplace:
                weightedRates = weightRate.weightedRatesLaplace;
                break;

            case PDFType.T:
                weightedRates = weightRate.weightedRatesT;
                break;
            }
            Allpercentiles = new List <Percentiles>(weightedRates.Count);
            GetYearlyBreakdown();
            CalculateAverageWithdrawls();
            Sort();
            ConfidenceIntervals();
            ProbabilityOfSuccess();
        }
Пример #2
0
 private void CalculateWeightRate()
 {
     Parallel.For(0, amount * 2, element =>
     {
         weightRates[element] = new WeightRate(assets[element]);
         rateTasks.Add(Task.Run(() => { allDistributions.Add(new Distributions(assets[element], weightRates[element], PDFType.Normal, model)); }));
         rateTasks.Add(Task.Run(() => { allDistributions.Add(new Distributions(assets[element], weightRates[element], PDFType.Laplace, model)); }));
         rateTasks.Add(Task.Run(() => { allDistributions.Add(new Distributions(assets[element], weightRates[element], PDFType.T, model)); }));
     });
     Task.WaitAll(rateTasks.ToArray());
 }