Esempio n. 1
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);
        }
Esempio n. 2
0
 public void Add(long conID, GraphInfo contract)
 {
     if (!graphList.ContainsKey(conID))
     {
         graphList.Add(conID, contract);
     }
 }
Esempio n. 3
0
        public ContractAtomicRITE(GraphInfo _contractGraph, string _subPeril, ExposureType _expType, PositionType _positionType)
        {
            contractGraph = _contractGraph;
            SubPeril      = _subPeril;
            ExpType       = _expType;
            positionType  = _positionType;

            CurrentAllocationStateCollection = new AllocationStateCollection2(1);

            if (_contractGraph.Graph.IsExecuted)
            {
                subjectLoss = _contractGraph.Graph.exResults.GetFilteredTimeSeries(_subPeril, _expType);
            }
        }
Esempio n. 4
0
        public bool GetGraphInfo(long conID, out GraphInfo contract)
        {
            if (graphList.TryGetValue(conID, out contract))
            {
                contract.Graph.PeriodReset();
                return(true);
            }
            else
            {
                return(false);
            }

            //GraphBuilder builder = new GraphBuilder();
            //ExposureDataAdaptor expData = new ExposureDataAdaptor(_pd, conID);

            //if (exSettings.ContainsKey(conID))
            //{
            //    contract = builder.MakeGraph(exSettings[conID].GraphType, expData);
            //    Add(conID, contract);
            //    return contract;
            //}
            //else
            //    throw new InvalidOperationException("Cannot find execution settings for contract: " + conID);
        }
Esempio n. 5
0
 public void PrepareContract(long ConID, GraphType type = GraphType.Auto)
 {
     ExposureDataAdaptor expData   = PDataAdaptor.GetExposureAdaptor(ConID);
     IRITEindexMapper    mapper    = GetMapperForContract(expData);
     GraphInfo           graphInfo = GetGraph(type, expData, mapper);
 }
Esempio n. 6
0
        public GraphInfo MakeGraph(GraphType type, ExposureDataAdaptor expData, IRITEindexMapper indexMapper)
        {
            GraphInfo graphInfo;

            if (graphCache.GetGraphInfo(expData.ContractID, out graphInfo))
            {
                return(graphInfo);
            }

            Graph graph;

            switch (type)
            {
            case GraphType.Auto:
                ContractExtractor contract = GetContract(expData, graphCache);
                contract.Extract();

                AutoGraphStyle style = GetGraphStyle(contract);
                //AutoGraphStyle style = AutoGraphStyle.Matrix;
                //AutoGraphStyle style = AutoGraphStyle.Node;

                AutoGraphBuilder builder;

                if (style == AutoGraphStyle.Node)
                {
                    builder = new AutoGraphOfNodesBuilder(contract);
                }
                else
                {
                    builder = new AutoGraphOfMatrixBuilder(contract, indexMapper);
                }

                graph     = builder.Build();
                graphInfo = new GraphInfo(style, graph);
                break;

            case GraphType.FixedGraph1:
                graph     = new FixedGraph1(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraph2:
                graph     = new FixedGraph2(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlap:
                graph     = new FixedGraphOverlap(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlapSubperil:
                graph     = new FixedGraphOverlapSubperil(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedGraphOverlapSubperil2:
                graph     = new FixedGraphOverlapSubperil2(expData);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;

            case GraphType.FixedTreaty1:
                graph     = new FixedTreaty1(expData, graphCache);
                graphInfo = new GraphInfo(AutoGraphStyle.Node, graph);
                break;
            //case GraphType.FixedMatrixGraphJPTY:
            //    graph  = new FixedMatrixGraphJPTY(expData);
            //    graphInfo = new GraphInfo(AutoGraphStyle.Matrix, graph);
            //    //graph.Initialize();
            //    break;

            default:
                throw new NotSupportedException("Cannot currently support this treaty type");
            }


            graph.Initialize();

            if (graph is FixedPrimaryGraph || graph is FixedTreaty1)   ///need to remove FixedTreaty1 condition
            {
                GetTermsForGraph(expData, graph as GraphOfNodes);
            }

            graph.PeriodReset();

            graphCache.Add(graph.ContractID, graphInfo);
            return(graphInfo);
        }
Esempio n. 7
0
 public GraphExecuterAdaptor(GraphInfo _graphInfo)
 {
     graphInfo = _graphInfo;
 }