Exemplo n.º 1
0
        public void AddExposureToTreaty(ExposureDataAdaptor otherExposure)
        {
            if (!TreatyIncludesPrimaryData)
            {
                this.UseAggregatedRITEs = otherExposure.UseAggregatedRITEs;
            }
            else
            {
                if (this.UseAggregatedRITEs != otherExposure.UseAggregatedRITEs)
                {
                    throw new InvalidOperationException("Cannot combine extracts from different versions of disaggregation tool, all input primary contracts to a Treaty must be of same disaggreation version!");
                }
            }

            this._characteristics.UnionWith(otherExposure.Characteristics);
            this._rites.UnionWith(otherExposure.ContractRITES);
            this._schedules.UnionWith(otherExposure.Schedules);

            //Combine Dictionarys
            this._characteristicsDict = MergeDictionarys(this._characteristicsDict, otherExposure._characteristicsDict);
            this._ritesDict           = MergeDictionarys(this._ritesDict, otherExposure._ritesDict);
            this._schedulesDict       = MergeDictionarys(this._schedulesDict, otherExposure._schedulesDict);

            //Combine Contract COls
            this.ContractCOLs.UnionWith(otherExposure.ContractCOLs);

            //Combine Aggregate Mappings
            this.RiskCharIDtoAggregateID  = MergeDictionarys(this.RiskCharIDtoAggregateID, otherExposure.RiskCharIDtoAggregateID);
            this.DisaggRitCharToDisAggRIT = MergeDictionarys(this.DisaggRitCharToDisAggRIT, otherExposure.DisaggRitCharToDisAggRIT);
            this.AggregateIDtoDisaggIDs   = MergeDictionarys(this.AggregateIDtoDisaggIDs, otherExposure.AggregateIDtoDisaggIDs);
        }
Exemplo n.º 2
0
        public ReferenceResultOutput ExecutePeriod(long conID, GraphType type, List <Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > > ListOfguLossDict)
        {
            ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID);
            string error;

            // Gu Loss can be for many contracts for need Dictionary of Mapper as input..
            Dictionary <long, IRITEindexMapper> indexMappers = GetMappers(expData);

            //Need to get mapper for current executing contract to build graph..
            IRITEindexMapper mapperForContract = indexMappers[conID];

            GraphInfo graphInfo = GetGraph(type, expData, mapperForContract);
            Graph     graph     = graphInfo.Graph;

            //Output object
            ReferenceResultOutput ResultOutput = new ReferenceResultOutput(0, 0);

            foreach (Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > >
                     guLossDict in ListOfguLossDict)
            {
                //Execute each event
                graph.EventReset();

                GULossAdaptor guLossAdaptor = new GULossAdaptor(indexMappers, guLossDict, graph.DeclarationsForAssociatedContracts, true);

                GraphExecuterAdaptor MainExecuter = new GraphExecuterAdaptor(graphInfo);

                ResultOutput += MainExecuter.RunExecution(guLossAdaptor);
            }

            return(ResultOutput);
        }
Exemplo n.º 3
0
 public TreatyContractExtractor(ExposureDataAdaptor _expData, GraphBuildCache _graphCache)
     : base(_expData)
 {
     graphCache             = _graphCache;
     PrimaryDeclarationsSet = new Dictionary <long, Declarations>();
     SetContractSubject();
 }
Exemplo n.º 4
0
 public PrimaryContractExtractor(ExposureDataAdaptor _expData)
     : base(_expData)
 {
     DedComponent = new Dictionary <PrimarySubject, DeductibleCollection>();
     LimComponent = new Dictionary <PrimarySubject, LimitCollection>();
     SetContractSubject();
 }
Exemplo n.º 5
0
        private HashSet <GraphInfo> BuildPosition(HashSet <long> conIDs)
        {
            HashSet <GraphInfo> position = new HashSet <GraphInfo>();

            foreach (long ID in conIDs)
            {
                GraphInfo contract;
                if (graphCache.GetGraphInfo(ID, out contract))
                {
                    position.Add(contract);
                }
                else
                {
                    GraphBuilder        builder = new GraphBuilder(graphCache);
                    ExposureDataAdaptor expData = graphCache.GetExposure(ID);
                    GraphType           type    = graphCache.GetSettings(ID).GraphType;
                    IRITEindexMapper    mapper  = GetMapper(expData);

                    contract = builder.MakeGraph(type, expData, mapper);
                    graphCache.Add(ID, contract);
                    position.Add(contract);
                }
            }

            return(position);
        }
Exemplo n.º 6
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        //public GUInputGenerator(long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        //{
        //    PartitionDataAdpator PData = new PartitionDataAdpator(PD);
        //    expData = PData.GetExposureAdaptor(conID);
        //    subperils = _COLSet.GetSubperils();
        //    timestyle = _timestyle;
        //    lossstyle = _lossstyle;

        //}

        public GUInputGenerator(ExposureDataAdaptor _expData, HashSet <string> _subperils, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            expData   = _expData;
            subperils = _subperils;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
        }
Exemplo n.º 7
0
 public ContractExtractor(ExposureDataAdaptor _expData)
 {
     ExpData         = _expData;
     jsonParseResult = _expData.ContractJSON;
     CoverComponent  = new Dictionary <Subject, Dictionary <string, Cover> >();
     Declarations    = new Declarations();
     SetContractDeclarations();
 }
Exemplo n.º 8
0
        public VectorGUInputGenerator GetGeneratorForContract(long conID)
        {
            ExposureDataAdaptor expData     = pData.GetExposureAdaptor(conID);
            RITEmapper1         mapper      = new RITEmapper1(expData, new RAPSettings(subperils), subperilConfig);
            GUInputGenerator    guGenerator = GeneratorFactory.GetGeneratorForContract(conID);

            return(new VectorGUInputGenerator(guGenerator, mapper));
        }
Exemplo n.º 9
0
        //RITE.ID -> numBldgs -> <timestamp -> list of loss>

        public GUInputGenerator(PartitionData PD, long conID, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossstyle)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(PD);

            expData   = PData.GetExposureAdaptor(conID);
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossstyle = _lossstyle;
            //    Dictionary<long, Dictionary<int, Tuple<int, List<float>>>> GULosses = new Dictionary<long, Dictionary<int, Tuple<int, List<float>>>>();
        }
Exemplo n.º 10
0
        public PLTGenerator(PartitionData _PD, long _conID, int pid, COLCollection _COLSet, TimeStyle _timestyle, LossStyle _lossStyle, DateTime _start, DateTime _end)
        {
            PartitionDataAdpator PData = new PartitionDataAdpator(_PD);

            expData   = PData.GetExposureAdaptor(conID);
            PD        = _PD;
            conID     = _conID;
            COLSet    = _COLSet;
            timestyle = _timestyle;
            lossStyle = _lossStyle;
            PLT       = new PeriodLossTable(pid, _COLSet, _timestyle, _lossStyle, _start, _end);
        }
Exemplo n.º 11
0
        public FixedPrimaryGraph(ExposureDataAdaptor _expdata)
            : base(_expdata.ContractID)
        {
            expdata = _expdata;

            //Build Graph here....
            graphNodes          = new List <GraphNode>();
            parentToChildrenMap = new Dictionary <GraphNode, List <GraphNode> >();
            atomicCoverageRITEs = new HashSet <CoverageAtomicRITE>();

            //Add Contract Declarations
            Declarations = new Declarations();
        }
Exemplo n.º 12
0
        private ExposureDataAdaptor GetTreatyExposureData(ContractExposure contractExposure)
        {
            ExposureDataAdaptor treatyAdaptor = new ExposureDataAdaptor(contractExposure, NGFM_API);

            treatyAdaptor.ExtractPositionData();

            foreach (long conID in treatyAdaptor.Positions.GetDependentContracts())
            {
                ExposureDataAdaptor childContractData = GetExposureAdaptor(conID);
                treatyAdaptor.CombineExposure(childContractData);
            }

            return(treatyAdaptor);
        }
Exemplo n.º 13
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();
        }
Exemplo n.º 14
0
        private IRITEindexMapper GetMapper(ExposureDataAdaptor expData)
        {
            IRITEindexMapper indexMapper;

            if (graphCache.GetIndexMapper(expData.ContractID, out indexMapper))
            {
                return(indexMapper);
            }
            else
            {
                RAPSettings rapsettings = graphCache.GetSettings(expData.ContractID).RAPsettings;
                indexMapper = new RITEmapper1(expData, rapsettings, new RMSSubPerilConfig());
                graphCache.Add(expData.ContractID, indexMapper);
                return(indexMapper);
            }
        }
Exemplo n.º 15
0
        private ContractExtractor GetContract(ExposureDataAdaptor expData, GraphBuildCache graphCache)
        {
            //Make all graph nodes for Graph
            List <GraphNode>  IntitialGraphNodes = new List <GraphNode>();
            ContractExtractor contract;

            if (expData.TreatyExposure)
            {
                contract = new TreatyContractExtractor(expData, graphCache);
            }
            else
            {
                contract = new PrimaryContractExtractor(expData);
            }

            return(contract);
        }
Exemplo n.º 16
0
        private Dictionary <long, IRITEindexMapper> GetMappers(ExposureDataAdaptor expData)
        {
            Dictionary <long, IRITEindexMapper> indexMappers = new Dictionary <long, IRITEindexMapper>();

            if (expData.TreatyExposure)
            {
                foreach (long conID in expData.Positions.GetDependentContracts())
                {
                    ExposureDataAdaptor childContractData = PDataAdaptor.GetExposureAdaptor(conID);
                    IRITEindexMapper    childMapper       = GetMapperForContract(childContractData);
                    indexMappers.Add(childContractData.ContractID, childMapper);
                }
                indexMappers.Add(expData.ContractID, null);
            }
            else
            {
                IRITEindexMapper Mapper = GetMapperForContract(expData);
                indexMappers.Add(expData.ContractID, Mapper);
            }

            return(indexMappers);
        }
Exemplo n.º 17
0
        public ExposureDataAdaptor GetExposureAdaptor(long conID)
        {
            ExposureDataAdaptor exposure;

            if (!expData.TryGetValue(conID, out exposure))
            {
                ContractExposure contractExposure = GetExposure(conID);
                if (contractExposure.ContractType.IsReinsuranceContract())
                {
                    exposure = GetTreatyExposureData(contractExposure);
                }
                else
                {
                    exposure = new ExposureDataAdaptor(contractExposure, NGFM_API);
                    exposure.GetPrimaryData();
                }

                expData.Add(conID, exposure);
            }

            return(exposure);
        }
Exemplo n.º 18
0
        private void GetTermsForGraph(ExposureDataAdaptor expData, GraphOfNodes graph)
        {
            string message;
            DeclarationExtractor declarationExtractor = new DeclarationExtractor(expData);

            declarationExtractor.GetDeclarations(graph.Declarations, out message);
            FinancialTermExtractor fintermExtractor;

            if (graph.Declarations.ContractType == "Primary Policy")
            {
                fintermExtractor = new PrimaryTermExtractor(expData, graph.Declarations);
            }
            else if (graph.Declarations.ContractType == "Catastrophe Treaty")
            {
                fintermExtractor = new TreatyTermExtractor(expData, graph.Declarations, graphCache);
            }
            else
            {
                throw new NotSupportedException();
            }

            fintermExtractor.GetTermsForGraph(graph, out message);
        }
Exemplo n.º 19
0
        public double Execute(long conID, GraphType type, Dictionary <string, Dictionary <int, Dictionary <long, Tuple <double, uint, List <float> > > > > guLoss)
        {
            ExposureDataAdaptor expData = PDataAdaptor.GetExposureAdaptor(conID);
            string error;

            //Stopwatch watch = new Stopwatch();
            //watch.Start();
            Graph graph = GetGraph(type, expData);
            //watch.Stop();

            //long graphTime = watch.ElapsedMilliseconds;

            GraphExecuter Executer;

            if (graph is PrimaryGraph)
            {
                Executer = new PrimaryGraphExecuter(graph as PrimaryGraph);
            }
            else if (graph is TreatyGraph)
            {
                Executer = new TreatyGraphExecuter(graph as TreatyGraph);
            }
            else
            {
                throw new NotSupportedException("Can only handle graph of type Treaty and Primary");
            }

            //Execute Graph and Allocate graph
            double payout = Executer.Execute(guLoss);

            //Allocate Graph
            //GraphAllocation Allocater = new GraphAllocation(graph);
            //Allocater.AllocateGraph();

            return(payout);
        }
Exemplo n.º 20
0
 public FixedGraphOverlapSubperil(ExposureDataAdaptor expData) : base(expData)
 {
 }
Exemplo n.º 21
0
 public FixedGraph3(ExposureDataAdaptor expData) : base(expData)
 {
 }
Exemplo n.º 22
0
 public FixedMatrixGraphJPTY(ExposureDataAdaptor expData)
     : base(expData)
 {
 }
Exemplo n.º 23
0
        public PLTGenerator GetGeneratorForContract(ExposureDataAdaptor _expData)
        {
            GUInputGenerator guGenerator = GeneratorFactory.GetGeneratorForContract(_expData);

            return(new PLTGenerator(guGenerator, Start, End));
        }
Exemplo n.º 24
0
 public FixedMatrixGraphAmlin1(ExposureDataAdaptor expData) : base(expData)
 {
 }
Exemplo n.º 25
0
 public FixedTreaty1(ExposureDataAdaptor _expData, GraphBuildCache _cache)
     : base(_expData.ContractID)
 {
     expdata = _expData;
     cache   = _cache;
 }
Exemplo n.º 26
0
 public AutoGraphBuilder(ExposureDataAdaptor _expData, GraphBuildCache _graphChache)
 {
     expData     = _expData;
     graphChache = _graphChache;
 }
Exemplo n.º 27
0
 public void CombineExposure(ExposureDataAdaptor otherExposure)
 {
     this._characteristics.UnionWith(otherExposure.Characteristics);
     this._rites.UnionWith(otherExposure.ContractRITES);
     this._schedules.UnionWith(otherExposure.Schedules);
 }
Exemplo n.º 28
0
 public FixedMatrixGraph(ExposureDataAdaptor _expData)
 {
     expData = _expData;
 }
Exemplo n.º 29
0
 public StepPolicyGraph(ExposureDataAdaptor expData) : base(expData)
 {
 }
Exemplo n.º 30
0
        private Graph GetGraph(GraphType type, ExposureDataAdaptor expData)
        {
            GraphBuilder builder = new GraphBuilder(GraphCache);

            return(builder.MakeGraph(type, expData));
        }