/** Returns a map with an entry for each traversed link, and associated to it the demand's traffic carried in that link. * If selected by the user, the carried traffic is given as a fraction respect to the demand offered traffic * @param normalizedToOfferedTraffic see above * @return see above */ public SortedMap<Link, Double> getTraversedLinksAndCarriedTraffic(final boolean normalizedToOfferedTraffic) { final SortedMap<Link, Double> res = new TreeMap<>(); final double normalizationFactor = (normalizedToOfferedTraffic ? (offeredTraffic <= Configuration.precisionFactor ? 1.0 : 1 / offeredTraffic) : 1.0); for (MulticastTree r : getMulticastTrees()) for (Link e : r.getLinkSet()) { final Double currentVal = res.get(e); final double newValue = (currentVal == null ? 0 : currentVal) + (r.getCarriedTraffic() * normalizationFactor); res.put(e, newValue); } return res; }
/** * <p>Returns the sum of the {@link com.net2plan.interfaces.networkDesign.Link Links} length in kms of the tree.</p> * @return The tree total length in km */ public double getTreeTotalLengthInKm () { checkAttachedToNetPlanObject(); double accum = 0; for (Link e : getLinkSet()) accum += e.getLengthInKm(); return accum; }
private TBFToFromCarriedTraffic(MulticastTree tree, boolean onlyThisLayer) { super(tree.getNetPlan()); this.initialElement = tree; this.onlyThisLayer = onlyThisLayer; this.initialFR = null; this.auxLayerInNodes = null; final Set<Link> linksAllLayers = new HashSet<>(); final Set<Demand> demandsAllLayers = new HashSet<>(); final Set<MulticastDemand> mDemandsAllLayers = new HashSet<>(); mDemandsAllLayers.add(tree.getMulticastDemand()); linksAllLayers.addAll(tree.getLinkSet()); if (!onlyThisLayer) updatePropagationDownWards(linksAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); if (!onlyThisLayer) updatePropagationUpWards(demandsAllLayers, mDemandsAllLayers, linksAllLayers, demandsAllLayers, mDemandsAllLayers); final Set<NetworkLayer> layersToKeepAllElements = onlyThisLayer ? Sets.difference(new HashSet<>(netPlan.getNetworkLayers()), Sets.newHashSet(tree.getLayer())) : new HashSet<>(); updateAllButLinksDemandsMDemandsUsingExistingInfo(linksAllLayers, demandsAllLayers, mDemandsAllLayers, layersToKeepAllElements); }
final boolean shoulbBeUp = (tree.getLinkSet().stream().allMatch(e->e.isUp) && (tree.getNodeSet().stream().allMatch(n->n.isUp))); final boolean travZeroCapLinks = tree.getLinkSet().stream().anyMatch(e->e.capacity < Configuration.precisionFactor); if (shoulbBeUp && cache_multicastTreesDown.contains(tree)) throw new RuntimeException (); if (!shoulbBeUp && !tree.getLinkSet().isEmpty() && !cache_multicastTreesDown.contains(tree)) throw new RuntimeException (); if (travZeroCapLinks && !cache_multicastTreesTravLinkZeroCap.contains(tree)) throw new RuntimeException ();
@Override public List<AjtColumnInfo<MulticastTree>> getNonBasicUserDefinedColumnsVisibleOrNot() { final List<AjtColumnInfo<MulticastTree>> res = new LinkedList<> (); res.add(new AjtColumnInfo<MulticastTree>(this , Node.class, null , "A", "Ingress node", null , d->d.getIngressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , String.class, null , "Bs", "Egress nodes", null , d->d.getMulticastDemand().getEgressNodes().stream().map(n->n.getName().equals("")? "Node " + n.getIndex() : n.getName()).collect(Collectors.joining(",")) , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , String.class, null , "Bs (reached)", "Reached egress nodes", null , d->d.getEgressNodesReached().stream().map(n->n.getName().equals("")? "Node " + n.getIndex() : n.getName()).collect(Collectors.joining(",")) , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Integer.class, null , "# Bs not reached", "Number of non-reached egress nodes", null , d->d.getMulticastDemand().getEgressNodes().size() - d.getEgressNodesReached().size() , AGTYPE.SUMINT , d-> d.getMulticastDemand().getEgressNodes().size() - d.getEgressNodesReached().size() > 0? Color.RED : null)); res.add(new AjtColumnInfo<MulticastTree>(this , MulticastDemand.class, null , "Demand", "Associated multicast demand", null , d->d.getMulticastDemand() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Double.class, null , "Carried traffic (" + getTableNetworkLayer().getDemandTrafficUnits() + ")", "Carried traffic by the multicast tree", null , d->d.getCarriedTraffic() , AGTYPE.SUMDOUBLE , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Double.class, null , "Occupied capacity (" + getTableNetworkLayer().getLinkCapacityUnits() + ")", "Occupied capacity in the traversed links", null, d->d.getOccupiedLinkCapacity() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Collection.class, null , "Traversed links", "Traversed links in the non-failure state", null, d->d.getLinkSet() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Double.class, null , "Total tree length (km)", "Sum of the lengths of all the tree links (accumulating any lower layer propagation lengths if any)", null, d->d.getTreeTotalLengthInKm() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(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), from the origin node, to destination nodes reached", null, d->d.getTreeMaximumPropagationDelayInMs() , AGTYPE.NOAGGREGATION , d->{ final double m = d.getMulticastDemand().getMaximumAcceptableE2EWorstCaseLatencyInMs(); if (m >= 0) return null; return d.getTreeMaximumPropagationDelayInMs () > m? Color.RED : null; })); res.add(new AjtColumnInfo<MulticastTree>(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.getTreeMaximumPathLengthInKm() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<MulticastTree>(this , Double.class, null , "Worst e2e length (hops)", "Current worst case end-to-end propagation length in number of traversed links", null, d->d.getTreeMaximumPathLengthInHops() , AGTYPE.NOAGGREGATION , null)); return res; }
private List<Triple<String,String,String>> getMulticastTreeInfoTables (MulticastTree t) { final DecimalFormat df = new DecimalFormat("###.##"); final NetPlan np = t.getNetPlan(); final List<Triple<String,String,String>> res = new ArrayList <> (); res.add(Triple.of("Tree index/id" , "Tree " + t.getIndex() + " (id " + t.getId() + ")", "multicastTre" + t.getId())); res.add(Triple.of("Layer" , "" + getLayerName(t.getLayer()) , "layer" + t.getLayer().getId())); res.add(Triple.of("Tree demand" , "Multicast demand " + t.getMulticastDemand().getIndex() + " (id " + t.getMulticastDemand().getId() + ")" , "multicastDemand" + t.getMulticastDemand().getId())); res.add(Triple.of("M. Demand offered traffic" , "" + df.format(t.getMulticastDemand().getOfferedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()) , "")); res.add(Triple.of("M. Demand carried traffic" , "" + df.format(t.getMulticastDemand().getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()) , "")); res.add(Triple.of("Tree carried traffic" , "" + df.format(t.getCarriedTraffic()) + " " + np.getDemandTrafficUnitsName(t.getLayer()), "")); res.add(Triple.of("Is up?" , "" + !t.isDown(), "")); res.add(Triple.of("Worst link utilization" , "" + df.format(t.getLinkSet().stream().mapToDouble(e->e.getUtilization()).max().orElse(0)), "")); res.add(Triple.of("E2E num. hops (av / max)" , "" + df.format(t.getTreeAveragePathLengthInHops()) + " / " + df.format(t.getTreeMaximumPathLengthInHops()) , "")); res.add(Triple.of("E2E length in km (av / max)" , "" + df.format(t.getTreeAveragePathLengthInHops()) + " / " + df.format(t.getTreeMaximumPathLengthInKm()) + " km", "")); res.add(Triple.of("E2E length in ms (av / max)" , "" + df.format(t.getTreeAveragePropagationDelayInMs()) + " / " + df.format(t.getTreeMaximumPropagationDelayInMs()) + " ms", "")); return res; } private List<Triple<String,String,String>> getDemandInfoTables (Demand d)
for (Link ee : t.getLinkSet())
final Set<Link> currentLinkSet = other.getLinkSet().stream(). map(x->(Link)thatToThisTranslation.get(x)). collect(Collectors.toSet());