/** The destination node of the lighptath, that must the destination node of the associated lightpath request * @return see above */ public WNode getB () { return new WNode (r.getEgressNode()); } /** Returns the associated lightpath request
final String st_b_r = r.getEgressNode().getName(); LinkedList<Triple<Double, String, Double>> el = elements_r.get(r); LinkedList<Pair<double[], double[]>> imp = impairments_r.get(r); final String st_b_r = r.getEgressNode().getName(); LinkedList<Triple<Double, String, Double>> el = elements_r.get(r); LinkedList<Pair<double[], double[]>> imp = impairments_r.get(r);
final String st_b_r = r.getEgressNode().getName(); final List<Quadruple<Double, String, Double, String>> el = elements_r.get(r); final List<Quadruple<Map<String, double[]>, Double, Map<String, double[]>, Double>> imp = impairments_r.get(r); final String st_b_r = r.getEgressNode().getName(); final List<Quadruple<Double, String, Double, String>> el = elements_r.get(r); final List<Quadruple<Map<String, double[]>, Double, Map<String, double[]>, Double>> imp = impairments_r.get(r);
/** Given a set of traffic routes and their carried traffic returns a destination-based routing in the form x_te (amount of traffic targeted to node t, transmitted through link e). * * @param nodes List of nodes * @param links List of links * @param demands List of demands * @param routes List of routes * @return Destination-based routing in the form x_te (amount of traffic targeted to node t, transmitted through link e) */ public static DoubleMatrix2D convert_xp2xte(List<Node> nodes, List<Link> links, List<Demand> demands, List<Route> routes) { int E = links.size(); int N = nodes.size(); DoubleMatrix2D x_te = DoubleFactory2D.sparse.make(N, E, 0); for (Route route : routes) { final int t = route.getEgressNode().getIndex(); for (Link link : route.getSeqLinks()) { final int e = link.getIndex(); x_te.setQuick(t, e, x_te.getQuick(t, e) + route.getCarriedTraffic()); } } return x_te; }
out.append("<td>" + r.getDemand().getIndex() + "</td>"); out.append("<td>" + printNode(r.getIngressNode())+ "</td>"); out.append("<td>" + printNode(r.getEgressNode())+ "</td>"); out.append("<td>" + seqNodesString(r.getSeqLinks()) + "</td>"); out.append("<td>" + df_2.format(r.getLengthInKm()) + "</td>"); out.append("</td>"); out.append("<td>" + printNode(segment.getIngressNode()) + "</td>"); out.append("<td>" + printNode(segment.getEgressNode()) + "</td>"); out.append("<td>" + seqNodesString(segment.getSeqLinks()) + "</td>"); out.append("<td>" + df_2.format(segment.getLengthInKm()) + "</td>");
out.append("<td>" + r.getIndex() + "</td>"); out.append("<td>" + r.getIngressNode().getName() + "</td>"); out.append("<td>" + r.getEgressNode().getName() + "</td>"); out.append("<td>" + r.getDemand().getIndex() + " (" + df_6.format(r.getDemand().getOfferedTraffic()) + ")</td>"); out.append("<td>" + df_6.format(r.getCarriedTraffic()) + "</td>");
@Override public List<AjtColumnInfo<Route>> getNonBasicUserDefinedColumnsVisibleOrNot() { final NetPlan np = callback.getDesign(); final NetworkLayer layer = this.getTableNetworkLayer(); final List<AjtColumnInfo<Route>> res = new LinkedList<> (); res.add(new AjtColumnInfo<Route>(this , Demand.class, null , "Demand", "Associated demand", null , d->d.getDemand() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Node.class, null , "A", "Ingress node", null , d->d.getIngressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Node.class, null , "B", "Egress node", null , d->d.getEgressNode() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Boolean.class, null , "Is up?", "The route is considered up if it is not traversing failed links or nodes", null , d->!d.isDown() , AGTYPE.COUNTTRUE, r->r.getCarriedTrafficInNoFailureState() > 0 && r.isDown()? Color.RED : null)); res.add(new AjtColumnInfo<Route>(this , Boolean.class, null , "Trav. 0-cap links?", "Indicates if the route is traversing links with zero capacity", null , d->!d.isTraversingZeroCapLinks() , AGTYPE.COUNTTRUE, r->r.getCarriedTrafficInNoFailureState() > 0 && r.isTraversingZeroCapLinks()? Color.RED : null)); res.add(new AjtColumnInfo<Route>(this , Demand.class, null , "Bidirectional pair", "If the route is bidirectional, provides its bidirectional pair", null , d->d.getBidirectionalPair() , AGTYPE.NOAGGREGATION, null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "Main routes", "If this is a backup route, shows the routes I am backing up", null , d->d.getRoutesIAmBackup(), AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "Backup routes", "If this is a main route, shows the its back up routes", null , d->d.getBackupRoutes(), AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Carried traffic (" + layer.getDemandTrafficUnits() + ")", "Carried traffic by the route", (d,val)->d.setCarriedTraffic((Double) val , null), d->d.getCarriedTraffic() , AGTYPE.SUMDOUBLE , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Occupied capacity (" + layer.getLinkCapacityUnits() + ")", "Occupied capacity in the traversed links. If the occupied capacity is different in different links, no information is shown", null , d->d.isOccupyingDifferentCapacitiesInDifferentLinksInNoFailureState()? "--" : d.getSeqOccupiedCapacitiesIfNotFailing().get(0) , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "# links", "Number of traversed links", null , d->d.getSeqLinks() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Collection.class, null , "# resources", "Number of traversed resources", null , d->d.getSeqResourcesTraversed() , AGTYPE.NOAGGREGATION , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "Length (km)", "Length of the route, considering also the length of the lower layer links traversed if any", null , d->d.getLengthInKm() , AGTYPE.MAXDOUBLE , null)); res.add(new AjtColumnInfo<Route>(this , Double.class, null , "E2e latency (ms)", "End-to-end latency considering links and resources traversed, and propagation time in lower layer links if any", null , d->d.getPropagationDelayInMiliseconds() , AGTYPE.MAXDOUBLE , d->{ final double m = d.getDemand().getMaximumAcceptableE2EWorstCaseLatencyInMs(); if (m >= 0) return null; return d.getPropagationDelayInMiliseconds () > m? Color.RED : null; })); return res; }
/** <p>Obtains a {@code JGraphT} graph from a given route map.</p> * * @param routes List of routes * @return {@code JGraphT} graph */ public static org.jgrapht.Graph<Node, Route> getGraphFromRouteMap(List<Route> routes) { org.jgrapht.Graph<Node, Route> graph = new DirectedWeightedMultigraph<Node, Route>(Route.class); if (routes != null) { for (Route route : routes) { Node originNode = route.getIngressNode(); Node destinationNode = route.getEgressNode(); if (!graph.containsVertex(originNode)) graph.addVertex(originNode); if (!graph.containsVertex(destinationNode)) graph.addVertex(destinationNode); graph.addEdge(originNode, destinationNode, route); } } return graph; }
/** Creates a RSA object reading the information from the existing Route object (and its WDM-related attributes). * @param r the route object * @param initializeWithTheInitialState if {@code true}, the RSA object created gets the information from the route primary path: sequence of links, and if not, from the route current sequence of traversed links. */ public RSA (Route r , boolean initializeWithTheInitialState) { this.ingressNode = r.getIngressNode(); this.egressNode = r.getEgressNode(); this.seqLinks = initializeWithTheInitialState ? new ArrayList<>(Route.getSeqLinks(r.getInitialState().getSecond())) : new ArrayList<> (r.getSeqLinks()); try { if (!isNonNegativeInteger(r.getOccupiedCapacity())) throw new WDMException (""); if (!isNonNegativeInteger(r.getOccupiedCapacityInNoFailureState())) throw new WDMException (""); final IntMatrix2D candidateSeqFreqSlots = StringUtils.readIntMatrix (r.getAttribute(initializeWithTheInitialState? WDMUtils.SEQUENCE_OF_FREQUENCYSLOTS_INITIAL_ROUTE_ATTRIBUTE_NAME : WDMUtils.SEQUENCE_OF_FREQUENCYSLOTS_ATTRIBUTE_NAME)); this.seqFrequencySlots_se = candidateSeqFreqSlots.rows() > 0? candidateSeqFreqSlots : IntFactory2D.dense.make(0,this.seqLinks.size()); final int[] candidateSeqRegenerators = r.getAttribute(initializeWithTheInitialState? WDMUtils.SEQUENCE_OF_REGENERATORS_INITIAL_ROUTE_ATTRIBUTE_NAME : WDMUtils.SEQUENCE_OF_REGENERATORS_ATTRIBUTE_NAME) == null? new int [seqLinks.size()] : StringUtils.toIntArray(StringUtils.split(initializeWithTheInitialState? r.getAttribute(SEQUENCE_OF_REGENERATORS_INITIAL_ROUTE_ATTRIBUTE_NAME): r.getAttribute(SEQUENCE_OF_REGENERATORS_ATTRIBUTE_NAME), " ")); this.seqRegeneratorsOccupancy_e = candidateSeqRegenerators.length == 0 ? new int[this.seqLinks.size()] : candidateSeqRegenerators; } catch (Exception e) { throw new WDMException("RSA not correctly defined"); } if (initializeWithTheInitialState && getNumSlots() != r.getInitialState().getThird().get(0)) throw new WDMException("The occupied link capacity is different to the number of slots"); if (!initializeWithTheInitialState && getNumSlots() != r.getOccupiedCapacityInNoFailureState()) throw new WDMException("The occupied link capacity is different to the number of slots"); checkValidity(); }
out.append(String.format("<tr><td>%d</td><td>%d</td><td>%d (%s)</td><td>%d (%s)</td><td>%s</td><td>%.3g</td><td>%.3g</td><td>%.3g</td><td>%.3g</td><td>%s</td></tr>", r.getIndex () , d.getIndex(), r.getIngressNode().getIndex() , r.getIngressNode().getName(), r.getEgressNode().getIndex() , r.getEgressNode().getName(), r.getSeqLinks(), T_r_prop[rIndex], T_r_tx[rIndex], T_r_buf[rIndex], T_r[rIndex], r.getAttributes()));
/** <p>Given a list of Network Element, it computes the node-network element incoming incidence matrix. This is a matrix with as many rows as nodes, and as many columns as network elements. Position (<i>n</i>, <i>e</i>) has a 1 if element <i>e</i> (<i>e = 0</i> refers to the first element n {@code elements}, <i>e = 1</i> refers to the second one, and so on) is terminated in node <i>n</i> (<i>n = 0</i> refers to the first node in {@code nodes}, <i>n = 1</i> refers to the second one, and so on), and 0 otherwise.</p> * * @param nodes List of nodes * @param elements List of Network Elements * @return Node-link incoming incidence matrix * @see com.net2plan.interfaces.networkDesign.NetworkLayer */ public static DoubleMatrix2D getIncomingIncidenceMatrix(List<Node> nodes, List<? extends NetworkElement> elements) { int N = nodes.size(); int E = elements.size(); DoubleMatrix2D A_ne = DoubleFactory2D.sparse.make(N, E); for (NetworkElement o : elements) if (o instanceof Link) { Link e = (Link) o; A_ne.set(e.getDestinationNode().getIndex(), e.getIndex(), 1); } else if (o instanceof Demand) { Demand e = (Demand) o; A_ne.set(e.getEgressNode().getIndex(), e.getIndex(), 1); } else if (o instanceof Route) { Route e = (Route) o; A_ne.set(e.getEgressNode().getIndex(), e.getIndex(), 1); } else throw new Net2PlanException("Error making the matrix"); return A_ne; }
/** <p>Given a list of Network Elements, it computes the node-network element incidence matrix. This is a matrix with as many rows as nodes, and as many columns as elements. Position (<i>n</i>, <i>e</i>) has a 1 if element <i>e</i> (<i>e = 0</i> refers to the first element}, <i>e = 1</i> refers to the second one, and so on) is initiated in node <i>n</i> (<i>n = 0</i> refers to the first node , <i>n = 1</i> refers to the second one, and so on), -1 if it ends in node n, and 0 otherwise.</p> * @param nodes List of nodes * @param elements List of elements * @return Incidence matrix * @see com.net2plan.interfaces.networkDesign.NetworkLayer */ public static DoubleMatrix2D getIncidenceMatrix(List<Node> nodes, List<? extends NetworkElement> elements) { int N = nodes.size(); int E = elements.size(); DoubleMatrix2D A_ne = DoubleFactory2D.sparse.make(N, E); for (NetworkElement o : elements) if (o instanceof Link) { Link e = (Link) o; A_ne.set(e.getOriginNode().getIndex(), e.getIndex(), 1); A_ne.set(e.getDestinationNode().getIndex(), e.getIndex(), -1); } else if (o instanceof Demand) { Demand e = (Demand) o; A_ne.set(e.getIngressNode().getIndex(), e.getIndex(), 1); A_ne.set(e.getEgressNode().getIndex(), e.getIndex(), -1); } else if (o instanceof Route) { Route e = (Route) o; A_ne.set(e.getIngressNode().getIndex(), e.getIndex(), 1); A_ne.set(e.getEgressNode().getIndex(), e.getIndex(), -1); } else throw new Net2PlanException("Error making the matrix"); return A_ne; }
delta_nn.set(e.getIngressNode().getIndex(), e.getEgressNode().getIndex(), delta_nn.get(e.getIngressNode().getIndex(), e.getEgressNode().getIndex()) + 1); } else throw new Net2PlanException("Error making the matrix");
final Node d = r.getEgressNode(); final int oIndex = cand_o.get(o); final int dIndex = cand_d.get(d);
final GUINode gnDestination = vs.getCanvasAssociatedGUINode(pickedRoute.getEgressNode(), pickedRoute.getLayer()); gnOrigin.setBorderPaint(VisualizationConstants.DEFAULT_GUINODE_COLOR_ORIGINFLOW); gnOrigin.setFillPaint(VisualizationConstants.DEFAULT_GUINODE_COLOR_ORIGINFLOW);
System.out.println ("Node " + r.getIngressNode().getIndex() + " -> " + r.getEgressNode().getIndex() + ": Cost: " + cost + ", traffic: " + r.getCarriedTraffic());
final Pair<Node,Node> cplNodePair= Pair.of(r.getIngressNode() , r.getEgressNode()); final Integer transponderTypeLp = transponderTypeOfNewLps.get(r); final double maxOpticalReachKm = transponderTypeLp == null? Double.MAX_VALUE : tpInfo.getOpticalReachKm(transponderTypeLp);