Ejemplo n.º 1
0
        public List <Demand> CreateAnycastDemands(Scenario demands, PathAllocator pathAllocator)
        {
            List <Demand> anycastDemands = new List <Demand>();
            List <int>    dataCenters    = new List <int>(demands.DataCenters.DataCenterNodes.ToList());
            Dictionary <int, AnycastDemandData> demandsData = demands.AnycastDemands.GetAnycastDemandDataDictionary();

            foreach (var key in demandsData)
            {
                var dict = new Dictionary <int, List <List <Path> > >();
                foreach (var d in dataCenters)
                {
                    var pathsUp   = new List <Path>(pathAllocator.GetCandidatePaths(key.Value.ClientNode, d));
                    var pathsDown = new List <Path>(pathAllocator.GetCandidatePaths(d, key.Value.ClientNode));
                    var paths     = new List <List <Path> >();
                    paths.Add(pathsUp);
                    paths.Add(pathsDown);
                    dict.Add(d, paths);
                }
                AnycastDemand a = new AnycastDemand(key.Value.ClientNode, key.Value.DownstreamVolume,
                                                    key.Value.UpstreamVolume, dataCenters, dict);
                anycastDemands.Add(a);
            }
            return(anycastDemands);
        }
Ejemplo n.º 2
0
        public List <Demand> CreateUnicastDemands(Scenario demands, PathAllocator pathAllocator)
        {
            List <Demand> unicastDemands = new List <Demand>();
            Dictionary <int, UnicastDemandData> demandsData = demands.UnicastDemands.GetUnicastDemandDataDictionary();

            foreach (var key in demandsData)
            {
                UnicastDemand u = new UnicastDemand(key.Value.SourceNode, key.Value.DestinationNode,
                                                    key.Value.DemandVolume,
                                                    pathAllocator.GetCandidatePaths(key.Value.SourceNode, key.Value.DestinationNode));
                unicastDemands.Add(u);
            }

            return(unicastDemands);
        }