示例#1
0
 public AnycastDemand(AnycastDemand demand)
 {
     _sourceNode       = demand._sourceNode;
     _upstreamVolume   = demand._upstreamVolume;
     _downstreamVolume = demand._downstreamVolume;
     _demandPathUp     = demand._demandPathUp;
     _demandPathDown   = demand._demandPathDown;
     _selectedDC       = demand._selectedDC;
     _dataCenterNodes  = demand._dataCenterNodes;
     _numberOfDc       = demand._dataCenterNodes.Count;
     //[0] upstream, [1] downstream
     _pathsToAndFromDataCenters = new Dictionary <int, List <List <Path> > >(demand._pathsToAndFromDataCenters);
     _numberOfPaths             = demand._pathsToAndFromDataCenters.Count;
 }
示例#2
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);
        }