/** Returns the line rate of the lighptath request in Gbps * @return see above */ public double getLineRateGbps () { return d.getOfferedTraffic(); } /** Sets the line rate of the lighptath request in Gbps
@Override public List<AjtColumnInfo<Demand>> getNonBasicUserDefinedColumnsVisibleOrNot() { final List<AjtColumnInfo<Demand>> res = new LinkedList<> (); res.add(new AjtColumnInfo<Demand>(this , Node.class, null , "A", "Ingress node", null , d->d.getIngressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Node.class, null , "B", "Egress node", null , d->d.getEgressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Demand.class, null , "Bidirectional pair", "If the demand is bidirectional, provides its bidirectional pair", null , d->d.getBidirectionalPair() , AGTYPE.NOAGGREGATION, null)); res.add(new AjtColumnInfo<Demand>(this , Link.class, null , "Link coupled", "The link that this demand is coupled to (in this or other layer)", null , d->d.getCoupledLink() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "Offered traffic (" + getTableNetworkLayer().getLinkCapacityUnits() + ")", "Offered traffic by the demand", (d,val)->d.setOfferedTraffic((Double) val), d->d.getOfferedTraffic() , AGTYPE.SUMDOUBLE , null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "Carried traffic (" + getTableNetworkLayer().getLinkCapacityUnits() + ")", "Carried traffic by the demand", null , d->d.getCarriedTraffic() , AGTYPE.SUMDOUBLE , null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "% Lost traffic", "Percentage of the lost traffic by the demand", null, d->d.getOfferedTraffic() == 0? 0 : d.getBlockedTraffic() / d.getOfferedTraffic() , AGTYPE.NOAGGREGATION , d->d.getBlockedTraffic() > 0? Color.RED : Color.GREEN)); res.add(new AjtColumnInfo<Demand>(this , String.class, null , "QoS type", "A used-defined string identifying the type of traffic of the demand", (d,val)-> d.setQoSType((String)val) , d->d.getQosType(), AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Boolean.class, null , "Source routing?", "", (d,val)->d.setRoutingType((Boolean) val? RoutingType.SOURCE_ROUTING : RoutingType.HOP_BY_HOP_ROUTING), d->d.isSourceRouting() , AGTYPE.COUNTTRUE , null)); res.add(new AjtColumnInfo<Demand>(this , Boolean.class, null , "Is service chain?", "", null, d->d.isServiceChainRequest() , AGTYPE.COUNTTRUE , null)); res.add(new AjtColumnInfo<Demand>(this , String.class, null , "Resource types", "The sequence of resource types that has to be traversed by the routes of the demand, if it is a service chain", null, d->d.isSourceRouting()? d.getServiceChainSequenceOfTraversedResourceTypes().stream().collect(Collectors.joining(",")) : "" , AGTYPE.COUNTTRUE , null)); res.add(new AjtColumnInfo<Demand>(this , String.class, null , "Routing cycles", "Indicates whether there are routing cycles: loopless (no cycle in some route), open cycles (traffic reaches egress node after some cycles in some route), closed cycles (traffic does not reach the egress node in some route)", null, d->d.getRoutingCycleType().name() , AGTYPE.NOAGGREGATION , d->d.getRoutingCycleType() == RoutingCycleType.LOOPLESS? null : Color.ORANGE)); res.add(new AjtColumnInfo<Demand>(this , String.class, null , "Bifurcated?", "Indicates whether the demand is satisfied by more than one path from origin to destination", null, d->!d.isSourceRouting() ? "-" : (d.isBifurcated()) ? String.format("Yes (%d)", d.getRoutes().size()) : "No" , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Integer.class, null , "# routes", "Number of associated routes", null, d->!d.isSourceRouting() ? 0 : d.getRoutes().size() , AGTYPE.SUMINT, null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "Worst e2e lat (ms)", "Current worst case end-to-end propagation time in miliseconds (accumulating any lower layer propagation times if any)", null, d->d.getWorstCasePropagationTimeInMs() , AGTYPE.NOAGGREGATION , d->{ final double maxMs = d.getMaximumAcceptableE2EWorstCaseLatencyInMs(); return maxMs <= 0? null : (d.getWorstCasePropagationTimeInMs() > maxMs? Color.RED : null); })); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "Worst e2e length (km)", "Current worst case end-to-end propagation length in km (accumulating any lower layer propagation lengths if any)", null, d->d.getWorstCaseLengthInKm() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "Limit e2e lat (ms)", "Maximum end-to-end propagation time in miliseconds (accumulating any lower layer propagation times if any)", (d,val)-> d.setMaximumAcceptableE2EWorstCaseLatencyInMs((Double)val) , d->d.getMaximumAcceptableE2EWorstCaseLatencyInMs() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Double.class, null , "CAGR(%)" , "Compound annual growth factor for this demand", (d,val)->d.setOfferedTrafficPerPeriodGrowthFactor((Double) val), d->d.getOfferedTrafficPerPeriodGrowthFactor() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Demand>(this , Integer.class, null , "#Monit points" , "Number of samples of the offered traffic stored, coming from a monitoring or forecasting traffic process", null , d->d.getMonitoredOrForecastedOfferedTraffic().getSize() , AGTYPE.NOAGGREGATION , null)); return res; }
/** Returns the current offered traffic of this service chain request (that may carried partially, totally or none) * @return see above */ public double getCurrentOfferedTrafficInGbps () { return sc.getOfferedTraffic(); }
private static TmEstimationResults createTakingEstimatedValuesFromCurrentNp (NetworkLayer layer , Map<Link,Double> monitOfSomeLinkTraffics , Map<Demand,Double> monitOfSomeDemands , Map<MulticastDemand,Double> monitOfSomeMDemands) { final NetPlan np = layer.getNetPlan(); final double output_averageDeviation_d = Math.sqrt(monitOfSomeDemands.entrySet().stream().mapToDouble(e-> { Demand d = e.getKey(); double est = e.getValue(); double val = d.getOfferedTraffic(); return Math.pow (est - val , 2); }).sum ()); final double output_averageDeviation_md = Math.sqrt(monitOfSomeMDemands.entrySet().stream().mapToDouble(e-> { MulticastDemand d = e.getKey(); double est = e.getValue(); double val = d.getOfferedTraffic(); return Math.pow (est - val , 2); }).sum ()); final double output_averageDeviation_e = Math.sqrt(monitOfSomeLinkTraffics.entrySet().stream().mapToDouble(e-> { Link d = e.getKey(); double est = e.getValue(); double val = d.getCarriedTraffic(); return Math.pow (est - val , 2); }).sum ()); final Map<Demand,Double> sol_offered_d = np.getDemands(layer).stream().collect(Collectors.toMap(d->d , d->d.getOfferedTraffic ())); final Map<MulticastDemand,Double> sol_offered_md = np.getMulticastDemands(layer).stream().collect(Collectors.toMap(d->d , d->d.getOfferedTraffic ())); final TmEstimationResults tm = new TmEstimationResults(layer, output_averageDeviation_d, output_averageDeviation_md, output_averageDeviation_e, sol_offered_d, sol_offered_md); return tm; } public String toStringQualityMerits ()
private double getMinimumNonZeroTrafficOrCapacityValue (NetPlan netPlan) { double res = Double.MAX_VALUE; for (Demand d : netPlan.getDemands ()) if (d.getOfferedTraffic() > 0) res = Math.min (res , d.getOfferedTraffic()); for (Link e : netPlan.getLinks ()) if (e.getCapacity() > 0) res = Math.min (res , e.getCapacity()); if (res == Double.MAX_VALUE) throw new Net2PlanException ("Too large offered traffics and link capacities"); return res; } }
private double getMinimumNonZeroTrafficOrCapacityValue (NetPlan netPlan) { double res = Double.MAX_VALUE; for (Demand d : netPlan.getDemands ()) if (d.getOfferedTraffic() > 0) res = Math.min (res , d.getOfferedTraffic()); for (Link e : netPlan.getLinks ()) if (e.getCapacity() > 0) res = Math.min (res , e.getCapacity()); if (res == Double.MAX_VALUE) throw new Net2PlanException ("Too large offered traffics and link capacities"); return res; } }
private double getMinimumNonZeroTrafficOrCapacityValue (NetPlan netPlan) { double res = Double.MAX_VALUE; for (Demand d : netPlan.getDemands ()) if (d.getOfferedTraffic() > 0) res = Math.min (res , d.getOfferedTraffic()); for (Link e : netPlan.getLinks ()) if (e.getCapacity() > 0) res = Math.min (res , e.getCapacity()); if (res == Double.MAX_VALUE) throw new Net2PlanException ("Too large offered traffics and link capacities"); return res; } }
private double computeObjectiveFunctionFromNetPlan (NetPlan np) { double objFunc = 0; for (Demand d : np.getDemands()) { final double h_d = d.getOfferedTraffic(); objFunc += (this.cc_control_fairnessFactor.getDouble() == 1)? Math.log(h_d) : Math.pow(h_d, 1-this.cc_control_fairnessFactor.getDouble()) / (1-this.cc_control_fairnessFactor.getDouble()); } return objFunc; }
/** * Creates a demand in the opposite direction as this, and with the same attributes, and associate both as bidirectional pairs. * If this demand is already bidirectional, makes nothing and returns null * @return the newly created demand */ public Demand createBidirectionalPair () { checkAttachedToNetPlanObject(); if (this.isBidirectional()) return null; final Demand d = netPlan.addDemand(this.ingressNode, this.egressNode, this.getOfferedTraffic() , this.routingType , this.attributes, this.layer); this.bidirectionalPair = d; d.bidirectionalPair = this; return d; }
private List<Triple<String,String,String>> getLayerInfoTables (NetworkLayer layer) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = layer.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); final String capUnits = np.getLinkCapacityUnitsName(layer); final String trafUnits = np.getDemandTrafficUnitsName(layer); res.add(Triple.of("Layer index/id" , "Layer " + layer.getIndex() + " (id " + layer.getId() + ")", "layer" + layer.getId())); res.add(Triple.of("Name" , layer.getName().equals("")? "No name" : layer.getName(), "")); res.add(Triple.of("Description" , layer.getDescription().equals("")? "No description" : layer.getDescription(), "")); res.add(Triple.of("Demand traffic units" , trafUnits.equals("")? "Not specified" : trafUnits, "")); res.add(Triple.of("Link capacity units" , capUnits.equals("")? "Not specified" : capUnits, "")); final double totalOccupiedCap = np.getLinks(layer).stream().mapToDouble(e->e.getOccupiedCapacity()).sum(); final double totalCap = np.getLinks(layer).stream().mapToDouble(e->e.getCapacity()).sum(); final double totalOfferedTrac = np.getDemands(layer).stream().mapToDouble(e->e.getOfferedTraffic()).sum(); final double totalCarriedTrac = np.getDemands(layer).stream().mapToDouble(e->e.getCarriedTraffic()).sum(); final double totalOffMultTraffic = np.getMulticastDemands(layer).stream().mapToDouble(e->e.getOfferedTraffic()).sum(); final double totalCarMultTraffic = np.getMulticastDemands(layer).stream().mapToDouble(e->e.getCarriedTraffic()).sum(); res.add(Triple.of("# links (total occupied / capacity)", "" + np.getNumberOfLinks(layer) + " (" + df.format(totalOccupiedCap) + " / " + df.format(totalCap) + ") " + capUnits + ")" , "")); res.add(Triple.of("# demands (total carried / offered)", "" + np.getNumberOfDemands(layer) + " (" + df.format(totalCarriedTrac) + " / " + df.format(totalOfferedTrac) + ") " + trafUnits, "")); res.add(Triple.of("# routes", "" + np.getNumberOfRoutes(layer) , "")); res.add(Triple.of("# forwarding rules", "" + np.getNumberOfForwardingRules(layer) , "")); res.add(Triple.of("# multicast demands (total carried / offered)", "" + np.getNumberOfMulticastDemands(layer) + " (" + df.format(totalCarMultTraffic) + " / " + df.format(totalOffMultTraffic) + ") " + trafUnits, "")); res.add(Triple.of("# multicast trees", "" + np.getNumberOfMulticastTrees(layer) , "")); return res; } private List<Triple<String,String,String>> getNodeInfoTables (Node n , NetworkLayer layer)
private double getAverageAllStatesExtraCarriedTrafficAfterPotentialAllocation (Demand ipDemand , double lineRateGbps , List<Link> seqLinksIfSingleSRGToleranceIsNeeded) { double extraCarriedTraffic = Math.min(ipDemand.getBlockedTraffic() , lineRateGbps); if (singleSRGToleranceNot11Type) { for (SharedRiskGroup srg : netPlan.getSRGs()) { if (srg.affectsAnyOf(seqLinksIfSingleSRGToleranceIsNeeded)) continue; // no extra carried traffic Set<Route> affectedRoutes = srg.getAffectedRoutes(wdmLayer); double carriedTrafficThisFailure = 0; for (Route ipRoute : ipDemand.getRoutes()) { Set<Route> wdmRoutes = ipRoute.getSeqLinks().get(0).getCoupledDemand().getRoutes(); for (Route r : wdmRoutes) if (!affectedRoutes.contains(r)) carriedTrafficThisFailure += r.getCarriedTraffic(); } extraCarriedTraffic += Math.min(lineRateGbps , Math.max(0 , ipDemand.getOfferedTraffic() - carriedTrafficThisFailure)); } } return extraCarriedTraffic / (singleSRGToleranceNot11Type? (netPlan.getNumberOfSRGs() + 1) : 1); }
private boolean isIpDemandFullySatisfied (Demand d) { if (d.getBlockedTraffic() > 1e-3) return false; if (singleSRGToleranceNot11Type) { for (SharedRiskGroup srg : netPlan.getSRGs()) { Set<Route> affectedRoutes = srg.getAffectedRoutes(wdmLayer); double carriedTrafficThisFailure = 0; for (Route ipRoute : d.getRoutes()) { final Set<Route> lps = ipRoute.getSeqLinks().get(0).getCoupledDemand().getRoutes(); for (Route wdmRoute : lps) if (!affectedRoutes.contains(wdmRoute)) carriedTrafficThisFailure += wdmRoute.getCarriedTraffic(); } if (carriedTrafficThisFailure + 1e-3 < d.getOfferedTraffic()) return false; } } return true; }
for (Node s : np.getNodes()) double outTraffic = 0; for (Demand d : s.getOutgoingDemands()) outTraffic += d.getOfferedTraffic(); lowerBoundNumLps_1 += Math.ceil(outTraffic / moduleCapacity.getDouble()); for (Node t : np.getNodes()) double inTraffic = 0; for (Demand d : t.getIncomingDemands()) inTraffic += d.getOfferedTraffic(); lowerBoundNumLps_2 += Math.ceil(inTraffic / moduleCapacity.getDouble()); for (Demand d : np.getNodePairDemands(s,t,false)) lowerBoundNumLps_3 += numHopsSP * d.getOfferedTraffic();
/** Given a destination-based routing in the form f_te (fractions of traffic in a node, that is forwarded through each of its output links), and an offered traffic to the network, it generates the resulting demand-link routing in the form x_de (amount of traffic from demand d, transmitted through link e). * If the routing of a demand has closed loops a {@code ClosedCycleRoutingException} is thrown * * @param numNodes Number of nodes * @param numDemandsInLayer Number of demand in the layer * @param links List of links * @param demandsToConvert List of demands * @param f_te For each destination node <i>t</i> and each link <i>e</i>, {@code f_te[t][e]} sets the fraction of the traffic targeted to node <i>t</i> that arrives (or is generated in) node <i>a(e)</i> (the origin node of link <i>e</i>), that is forwarded through link <i>e</i>. It must hold that for every node <i>n</i> different of <i>t</i>, the sum of the fractions <i>f<sub>te</sub></i> along its outgoing links must be lower or equal than 1 (unchecked) * @return Demand-link routing in the form x_de (amount of traffic from demand d, transmitted through link e), total carried traffic per demand, carried traffic per link, and routing cycle type (loopless, with open cycles...) per demand */ public static Quadruple<DoubleMatrix2D, DoubleMatrix1D, DoubleMatrix1D, List<RoutingCycleType>> convert_fte2xde(int numNodes, int numDemandsInLayer , List<Link> links, SortedSet<Demand> demandsToConvert, DoubleMatrix2D f_te) { final DoubleMatrix2D f_de = convert_fte2fde(numDemandsInLayer , demandsToConvert, f_te); DoubleMatrix1D h_d = DoubleFactory1D.dense.make(numDemandsInLayer); for (Demand d : demandsToConvert) h_d.set(d.getIndex(), d.getOfferedTraffic()); return convert_fde2xde(numNodes, links, demandsToConvert, h_d, f_de); }
public String finish (StringBuilder st , double simTime) { if (simulation_outFileNameRoot.getString().equals("")) return null; traceOf_h_d1.printToFile(new File (simulation_outFileNameRoot.getString() + "_hd1.txt")); traceOf_h_d2.printToFile(new File (simulation_outFileNameRoot.getString() + "_hd2.txt")); traceOf_u1_e.printToFile(new File (simulation_outFileNameRoot.getString() + "_ue1.txt")); traceOf_u2_e.printToFile(new File (simulation_outFileNameRoot.getString() + "_ue2.txt")); traceOf_objFunction.printToFile(new File (simulation_outFileNameRoot.getString() + "_objFunc.txt")); Map<String,String> param = new HashMap<String,String> (algorithmParameters); param.put("solverName", "ipopt"); param.put("solverLibraryName", ""); param.put("maxSolverTimeInSeconds", "-1"); new Offline_cba_congControLinkBwSplitTwolQoS().executeAlgorithm(copyInitialNetPlan , param , this.net2PlanParameters); DoubleMatrix1D jom_hd1 = DoubleFactory1D.dense.make (D1); DoubleMatrix1D jom_hd2 = DoubleFactory1D.dense.make (D2); DoubleMatrix1D jom_ue1 = DoubleFactory1D.dense.make (E); DoubleMatrix1D jom_ue2 = DoubleFactory1D.dense.make (E); int counter_1 = 0; int counter_2 = 0; for (Demand d : copyInitialNetPlan.getDemands ()) if (d.getAttribute("type").equals ("1")) jom_hd1.set (counter_1 ++ , d.getOfferedTraffic()); else jom_hd2.set (counter_2 ++ , d.getOfferedTraffic()); for (Link e : copyInitialNetPlan.getLinks ()) { jom_ue1.set (e.getIndex () , Double.parseDouble (e.getAttribute("u_1"))); jom_ue2.set (e.getIndex () , Double.parseDouble (e.getAttribute("u_2"))); } final double jomObjcFunc = Double.parseDouble (copyInitialNetPlan.getAttribute("netUtility")); TimeTrace.printToFile(new File (simulation_outFileNameRoot.getString() + "_jom_hd1.txt"), jom_hd1); TimeTrace.printToFile(new File (simulation_outFileNameRoot.getString() + "_jom_hd2.txt"), jom_hd2); TimeTrace.printToFile(new File (simulation_outFileNameRoot.getString() + "_jom_ue1.txt"), jom_ue1); TimeTrace.printToFile(new File (simulation_outFileNameRoot.getString() + "_jom_ue2.txt"), jom_ue2); TimeTrace.printToFile(new File (simulation_outFileNameRoot.getString() + "_jom_objFunc.txt"), jomObjcFunc); return null; }
private Pair<Map<Demand,Demand>,Map<Route,Route>> initializeNetPlanLinksBidirDemandsAndRoutes (NetPlan np) { /* Remove lower half demands from np */ np.removeAllRoutes(); for (Node n1 : np.getNodes()) for (Node n2 : np.getNodes()) if (n1.getIndex () > n2.getIndex ()) for (Demand d : np.getNodePairDemands(n1, n2,false)) d.remove (); np.addRoutesFromCandidatePathList(netPlan.computeUnicastCandidatePathList(null , tcfa_maxNumberPathsPerDemand.getInt(), tcfa_maxPathLengthInKm.getDouble(), tcfa_maxPathNumberOfHops.getInt(), -1, -1, -1, -1 , null)); /* Add symmetric demands and routes */ Map<Demand,Demand> opposite_d = new HashMap<Demand,Demand> (); Map<Route,Route> opposite_r = new HashMap<Route,Route> (); for (Demand d : new HashSet<Demand> (np.getDemands())) { final Demand opDemand = np.addDemand(d.getEgressNode(), d.getIngressNode(), d.getOfferedTraffic(), RoutingType.SOURCE_ROUTING , null); opposite_d.put(d,opDemand); opposite_d.put(opDemand,d); for (Route r : new HashSet<Route> (d.getRoutes ())) { final Route oppRoute = np.addRoute(opDemand, r.getCarriedTraffic(), r.getOccupiedCapacity() , oppositeSeqLinks (r.getSeqLinks()), null); opposite_r.put(r,oppRoute); opposite_r.put(oppRoute,r); } } return Pair.of(opposite_d,opposite_r); }
private List<Triple<String,String,String>> getRouteInfoTables (Route r) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = r.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); res.add(Triple.of("Route index/id" , "Route " + r.getIndex() + " (id " + r.getId() + ")", "route" + r.getId())); res.add(Triple.of("Layer" , "" + getLayerName(r.getLayer()) , "layer" + r.getLayer().getId())); res.add(Triple.of("Route demand index/id" , "" + r.getDemand().getIndex() + " (id " + r.getDemand().getId() + ")" , "demand" + r.getDemand().getId())); res.add(Triple.of("Demand offered traffic" , "" + df.format(r.getDemand().getOfferedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()) , "")); res.add(Triple.of("Demand carried traffic" , "" + df.format(r.getDemand().getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()) , "")); res.add(Triple.of("Route carried traffic" , "" + df.format(r.getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(r.getLayer()), "")); res.add(Triple.of("Is up?" , "" + np.isUp(r.getPath()), "")); res.add(Triple.of("Worst link utilization" , "" + df.format(r.getSeqLinks().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); if (r.isServiceChain()) res.add(Triple.of("Worst resource utilization" , "" + df.format(r.getSeqResourcesTraversed().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); res.add(Triple.of("Is service chain?" , "" + r.getDemand().isServiceChainRequest(), "")); res.add(Triple.of("Route length (km)" , "" + df.format(r.getLengthInKm()) + " km", "")); res.add(Triple.of("Route length (ms)" , "" + df.format(r.getPropagationDelayInMiliseconds()) + " ms", "")); res.add(Triple.of("Is backup route?" , "" + r.isBackupRoute(), "")); for (Route pr : r.getRoutesIAmBackup()) res.add(Triple.of("-- Primary route" , "Route " + pr.getIndex() , "route" + pr.getId())); res.add(Triple.of("Has backup routes?" , "" + r.hasBackupRoutes(), "")); for (Route br : r.getBackupRoutes()) res.add(Triple.of("-- Backup route" , "Route " + br.getIndex() , "route" + br.getId())); return res; } private List<Triple<String,String,String>> getMulticastTreeInfoTables (MulticastTree t)
private double [] getVectorIPDemandAverageAllStatesBlockedTraffic () { double [] res = new double [Dip]; for (Demand ipDemand : netPlan.getDemands(ipLayer)) { res [ipDemand.getIndex()] = ipDemand.getBlockedTraffic(); if (singleSRGToleranceNot11Type) { for (SharedRiskGroup srg : netPlan.getSRGs()) { Set<Route> affectedRoutes = srg.getAffectedRoutes(wdmLayer); double carriedTrafficThisFailure = 0; for (Route ipRoute : ipDemand.getRoutes()) { final Set<Route> wdmRoutes = ipRoute.getSeqLinks().get(0).getCoupledDemand().getRoutes(); for (Route r : wdmRoutes) if (!affectedRoutes.contains(r)) carriedTrafficThisFailure += r.getCarriedTraffic(); } res [ipDemand.getIndex()] += Math.max(0 , ipDemand.getOfferedTraffic() - carriedTrafficThisFailure); } } res [ipDemand.getIndex()] /= (singleSRGToleranceNot11Type? (netPlan.getNumberOfSRGs() + 1) : 1); } return res; }
minTrafficInTheLinks += d.getOfferedTraffic() * seqLinks.size();
private void updateDemandRoutingFromWeightsKnown (Demand d) { final Node a_d = d.getIngressNode(); final double h_d = d.getOfferedTraffic(); final DoubleMatrix1D weightsKnown_e = this.routing_mostUpdatedLinkPriceKnownByNode_ne.viewRow(a_d.getIndex ()); DoubleMatrix1D a_k = DoubleFactory1D.dense.make (R); for (Route r : d.getRoutes()) { double val = 0; for (Link e : r.getSeqLinks()) val += weightsKnown_e.get(e.getIndex()) + 1; a_k.set(r.getIndex (), val); } DoubleMatrix1D x_r = GradientProjectionUtils.regularizedProjection_sumEquality (a_k , control_routeIndexes_d [d.getIndex ()] , null , h_d , this.gradient_regularizationEpsilon.getDouble()); for (Route r : d.getRoutes ()) r.setCarriedTraffic(x_r.get(r.getIndex ()) , x_r.get(r.getIndex ())); }