Esempio n. 1
0
        public RITEmapper1(ExposureDataAdaptor _expData, RAPSettings _rapsettings, ISubPerilConfig _subperilConfig)
        {
            expData = _expData;
            HashSet <string> subPerilInputList = new HashSet <string>(_rapsettings.SubPerils.Union(_expData.ContractCOLs.GetSubperils()));

            SPmapping                  = new SubPerilMapping(_subperilConfig, subPerilInputList);
            preBldgIndex               = new Dictionary <long, Dictionary <string, int> >();
            CummulativeBuildingMap     = new Dictionary <long, int>();
            UniqueARTIEIndexToRITEID   = new Dictionary <int, long>();
            UniqueARTIEIndexToSubPeril = new Dictionary <int, string>();

            aggregatemapper = new AggregateRITEMapper(expData);
            BuildIndexDictionary();
        }
Esempio n. 2
0
        AggregateAndFilter(Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > inputDict)
        {
            Dictionary <string, Dictionary <int, Dictionary <long, Tuple <List <double>, List <uint>, List <float> > > > > outputDict = new Dictionary <string, Dictionary <int, Dictionary <long, Tuple <List <double>, List <uint>, List <float> > > > >();
            AggregateRITEMapper aggregateRITEmapper = mapper.GetAggregateMapper();
            bool UseAggragatRITEs = aggregateRITEmapper.UseAggregateMapping;

            foreach (string subperil in inputDict.Keys)
            {
                Dictionary <long, Tuple <double, uint, List <float> > > LossesByRITE = inputDict[subperil][0];
                Dictionary <long, Tuple <List <double>, List <uint>, List <float> > > AggregatedLossesByRITE = new Dictionary <long, Tuple <List <double>, List <uint>, List <float> > >();

                foreach (KeyValuePair <long, Tuple <double, uint, List <float> > > pair in LossesByRITE)
                {
                    long currentRITEId = pair.Key;

                    if (aggregateRITEmapper.RITEInContract(currentRITEId))
                    //if (true) // Sunny Hack remove Immeadiateley !!!!!!!!!!!
                    {
                        long originalAggregateRITEID = aggregateRITEmapper.OriginalAggregateID(currentRITEId);
                        int  NumOfSamples            = LossesByRITE[currentRITEId].Item3.Count;

                        if (AggregatedLossesByRITE.ContainsKey(originalAggregateRITEID))
                        {
                            //Set Factors
                            AggregatedLossesByRITE[originalAggregateRITEID].Item1.AddRange(Enumerable.Repeat(LossesByRITE[currentRITEId].Item1, NumOfSamples));
                            //Set Timestamps
                            AggregatedLossesByRITE[originalAggregateRITEID].Item2.AddRange(Enumerable.Repeat(LossesByRITE[currentRITEId].Item2, NumOfSamples));
                            //Set GULoss
                            AggregatedLossesByRITE[originalAggregateRITEID].Item3.AddRange(LossesByRITE[currentRITEId].Item3);
                        }
                        else
                        {
                            AggregatedLossesByRITE[originalAggregateRITEID] = new Tuple <List <double>, List <uint>, List <float> >(
                                Enumerable.Repeat(LossesByRITE[currentRITEId].Item1, NumOfSamples).ToList(),
                                Enumerable.Repeat(LossesByRITE[currentRITEId].Item2, NumOfSamples).ToList(),
                                new List <float>(LossesByRITE[currentRITEId].Item3));
                        }
                    }
                }

                outputDict.Add(subperil, new Dictionary <int, Dictionary <long, Tuple <List <double>, List <uint>, List <float> > > >
                {
                    { 0, AggregatedLossesByRITE }
                });
            }

            return(outputDict);
        }
Esempio n. 3
0
 public GULossTransformer(IRITEindexMapper _mapper)
 {
     mapper = _mapper;
     aggreagetRITEmapper = mapper.GetAggregateMapper();
 }