public class NetPlan extends NetworkElement
Class defining a complete multi-layer network structure. Layers may
contain links, demands, routes and protection segments or forwarding rules,
while nodes and SRGs are defined with a network-wide scope, that is, they
appear in all layers. To simplify handling of single-layer designs, methods that may refer to
layer-specific elements have an optiona input parameter of type NetworkLayer
.
In case of not using this optional parameter, the action
will be applied to the default layer (by default it is first defined layer),
which can be modified using the setNetworkLayerDefault(NetworkLayer)
setNetworkLayerDefault())}
method.
Internal representation of the NetPlan
object is based on:
NetworkLayer
objects.Node
objects.Link
objects.Route
objects (depending on the selected Routing Type
.Unicast
or Multicast
demand objects. Protection Segment
objects.Shared Risk Group
objectsEach element has a unique identifier (represented as long
) assigned the moment they are created, and two elements
(irregardless of their type) cannot share this identifier. This id is incremental (but not necessarily consecutive) and perpetual (i.e after removing an element identifiers are no renumbered).
Also, elements have an index number that identify them among their own type (nodes, links, etc.). Indexes are renumbered when an element is removed and are zero base, that is the first element of its type is always 0 and the last is N-1 (where N is the total number of elements of the same type).
An instance of a NetPlan object can be set as unmodifiable through the
setModifiableState(boolean)
setModifiableState())} method. The instance will work
transparently as NetPlan
object unless you try to change it. Calling
any method that can potentially change the network (e.g. add/set/remove methods)
throws an UnsupportedOperationException
.
Constructor and Description |
---|
NetPlan()
Default constructor.
|
NetPlan(File file)
Generates a new network design from a given
.n2p file. |
NetPlan(InputStream inputStream)
Generates a new network design from an input stream.
|
Modifier and Type | Method and Description |
---|---|
Demand |
addDemand(Node ingressNode,
Node egressNode,
double offeredTraffic,
Map<String,String> attributes,
NetworkLayer... optionalLayerParameter)
Adds a new traffic demand.
|
Pair<Demand,Demand> |
addDemandBidirectional(Node ingressNode,
Node egressNode,
double offeredTraffic,
Map<String,String> attributes,
NetworkLayer... optionalLayerParameter)
Adds two demands, one in each direction,.
|
List<Demand> |
addDemandsFromTrafficMatrix(DoubleMatrix2D trafficMatrix,
NetworkLayer... optionalLayerParameter)
Adds new traffic demands froma traffic matrix given as a
DoubleMatrix2D object. |
NetworkLayer |
addLayer(String name,
String description,
String linkCapacityUnitsName,
String demandTrafficUnitsName,
Map<String,String> attributes)
Adds a new layer.
|
NetworkLayer |
addLayerFrom(NetworkLayer origin)
Creates a new layer and adds the links, routes etc. from the input layer.
|
Link |
addLink(Node originNode,
Node destinationNode,
double capacity,
double lengthInKm,
double propagationSpeedInKmPerSecond,
Map<String,String> attributes,
NetworkLayer... optionalLayerParameter)
Adds a new link.
|
Pair<Link,Link> |
addLinkBidirectional(Node originNode,
Node destinationNode,
double capacity,
double lengthInKm,
double propagationSpeedInKmPerSecond,
Map<String,String> attributes,
NetworkLayer... optionalLayerParameter)
Adds two links, one in each direction.
|
MulticastDemand |
addMulticastDemand(Node ingressNode,
Set<Node> egressNodes,
double offeredTraffic,
Map<String,String> attributes,
NetworkLayer... optionalLayerParameter)
Adds a new multicast traffic demand.
|
MulticastTree |
addMulticastTree(MulticastDemand demand,
double carriedTraffic,
double occupiedLinkCapacity,
Set<Link> linkSet,
Map<String,String> attributes)
Adds a new traffic multicast tree.
|
void |
addMulticastTreesFromCandidateTreeList(Map<MulticastDemand,List<Set<Link>>> cpl)
Adds multiple multicast trees from a Candidate Tree list.
|
Node |
addNode(double xCoord,
double yCoord,
String name,
Map<String,String> attributes)
Adds a new node to the network.
|
ProtectionSegment |
addProtectionSegment(List<Link> sequenceOfLinks,
double reservedCapacity,
Map<String,String> attributes)
Adds a new protection segment.
|
Route |
addRoute(Demand demand,
double carriedTraffic,
double occupiedLinkCapacity,
List<Link> sequenceOfLinks,
Map<String,String> attributes)
Adds a new traffic route
Important: Routing type must be
SOURCE_ROUTING . |
void |
addRoutesAndProtectionSegmentFromCandidate11PathList(Map<Demand,List<Pair<List<Link>,List<Link>>>> cpl11) |
void |
addRoutesFromCandidatePathList(double[] costs,
String... paramValuePairs)
Same as
addRoutesFromCandidatePathList(computeUnicastCandidatePathList(costs , paramValuePairs); |
void |
addRoutesFromCandidatePathList(Map<Demand,List<List<Link>>> cpl)
Adds multiples routes from a Candidate Path List.
|
void |
addRoutesFromCandidatePathList(NetworkLayer layer,
double[] costs,
String... paramValuePairs)
Same as
addRoutesFromCandidatePathList(computeUnicastCandidatePathList(layer , costs , paramValuePairs); |
SharedRiskGroup |
addSRG(double mttfInHours,
double mttrInHours,
Map<String,String> attributes)
Adds a new SRG.
|
void |
assignFrom(NetPlan netPlan)
Assigns the information from the input
NetPlan . |
void |
checkCachesConsistency()
For debug purposes: Checks the consistency of the internal cache (nodes, srgs, layers, links, demands, multicast demands, multicast trees, routes, protection segments).
|
NetworkLayer |
checkContiguousPath(List<Link> links,
NetworkLayer layer,
Node originNode,
Node destinationNode)
Checks that the input sequence of links belong to the same layer and follow a contiguous path.
|
NetworkLayer |
checkInThisNetPlanOptionalLayerParameter(NetworkLayer... optionalLayer)
Checks if the given layer is valid and belongs to this
NetPlan design. |
DoubleMatrix1D |
checkMatrixDemandLinkCarriedTrafficFlowConservationConstraints(DoubleMatrix2D x_de,
boolean xdeValueAsFractionsRespectToDemandOfferedTraffic,
NetworkLayer... optionalLayerParameter)
Checks the flow conservation constraints, and returns the traffic carried per demand.
|
DoubleMatrix2D |
checkMatrixDestinationLinkCarriedTrafficFlowConservationConstraints(DoubleMatrix2D x_te,
NetworkLayer... optionalLayerParameter)
Checks the flow conservation constraints, and returns the traffic carried per input output node pair.
|
Map<MulticastDemand,List<Set<Link>>> |
computeMulticastCandidatePathList(DoubleMatrix1D costs,
String solverName,
String solverLibraryName,
double maxSolverTimeInSecondsPerTree,
String... candidateTreeListParamValuePairs)
The same as
computeMulticastCandidatePathList for the default layer |
Map<MulticastDemand,List<Set<Link>>> |
computeMulticastCandidatePathList(NetworkLayer layer,
DoubleMatrix1D linkCosts,
String solverName,
String solverLibraryName,
double maxSolverTimeInSecondsPerTree,
String... candidateTreeListParamValuePairs)
Adds multicast trees specified by those trees that satisfy the options described below.
|
DoubleMatrix1D |
computeMulticastTreeCostVector(double[] costs,
NetworkLayer... optionalLayerParameter)
Returns an array with the cost of each multicast tree in the layer.
|
DoubleMatrix1D |
computeRouteCostVector(double[] costs,
NetworkLayer... optionalLayerParameter)
Returns an array with the cost of each route in the layer.
|
static Map<Demand,List<Pair<List<Link>,List<Link>>>> |
computeUnicastCandidate11PathList(Map<Demand,List<List<Link>>> cpl,
DoubleMatrix1D costs,
int disjointType)
Computes the list of disjoint path pairs for each demand.
|
Map<Demand,List<List<Link>>> |
computeUnicastCandidatePathList(double[] costs,
String... paramValuePairs)
Adds traffic routes specified by those paths that satisfy the candidate path list options described below.
|
Map<Demand,List<List<Link>>> |
computeUnicastCandidatePathList(NetworkLayer layer,
double[] costs,
String... paramValuePairs)
Adds traffic routes specified by those paths that satisfy the candidate path list options described below.
|
NetPlan |
copy()
Returns a deep copy of the current design.
|
void |
copyFrom(NetPlan originNetPlan)
Removes all information from the current
NetPlan and copy the information from the input NetPlan . |
static Map<NetworkElement,String> |
getAttributes(Collection<? extends NetworkElement> collection,
String attribute)
Returns the values of a given attribute for all the provided network elements.
|
Demand |
getDemand(int index,
NetworkLayer... optionalLayerParameter)
Returns the demand with the given index.
|
Demand |
getDemandFromId(long uid)
Returns the demand with the given unique identifier.
|
ArrayList<Long> |
getDemandIds(NetworkLayer... optionalLayerParameter)
Returns the array of demand unique ids for the given layer (i-th position, corresponds to index i).
|
List<Demand> |
getDemands(NetworkLayer... optionalLayerParameter)
Returns the array of demands for the given layer (i-th position, corresponds to index i).
|
List<Demand> |
getDemandsBlocked(NetworkLayer... optionalLayerParameter)
Returns the demands that have blocked traffic in the given layer.
|
Set<Demand> |
getDemandsCoupled(NetworkLayer... optionalLayerParameter)
Returns the set of unicast demands that are coupled.
|
double |
getDemandTotalBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total blocked traffic, summing up all the unicast demands, in the given layer.
|
double |
getDemandTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total carried traffic, summing up for all the unicast demands, in the given layer.
|
double |
getDemandTotalOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total offered traffic, summing up for all the unicast demands, in the given layer.
|
String |
getDemandTrafficUnitsName(NetworkLayer... optionalLayerParameter)
Returns the name of the traffic units of the demands of the given layer.
|
double |
getForwardingRuleCarriedTraffic(Demand demand,
Link link)
Returns the traffic that is carried using a forwarding rule, in the given layer.
|
Map<Pair<Demand,Link>,Double> |
getForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the forwarding rules for the given layer.
|
double |
getForwardingRuleSplittingFactor(Demand demand,
Link link,
NetworkLayer... optionalLayerParameter)
Returns the splitting factor of the forwarding rule of the given demand and link.
|
static Collection<Long> |
getIds(Collection<? extends NetworkElement> collection)
Returns the unique ids of the provided network elements.
|
static Collection<Integer> |
getIndexes(Collection<? extends NetworkElement> collection)
Returns the indexes of the provided network elements.
|
Link |
getLink(int index,
NetworkLayer... optionalLayerParameter)
Returns the link with the given index in the given layer.
|
String |
getLinkCapacityUnitsName(NetworkLayer... optionalLayerParameter)
Returns the name of the capacity units of the links of the given layer.
|
Link |
getLinkFromId(long uid)
Returns the link with the given unique identifier.
|
ArrayList<Long> |
getLinkIds(NetworkLayer... optionalLayerParameter)
Returns the array of link ids for the given layer (i-th position, corresponds to index i).
|
List<Link> |
getLinks(NetworkLayer... optionalLayerParameter)
Return a list of all the links in the given layer.
|
Set<Link> |
getLinksAreBottleneck(NetworkLayer... optionalLayerParameter)
Returns the set of links that are a bottleneck, i.e the fraction of occupied capacity respect to the total (including the capacities in the protection segments)
is highest.
|
Set<Link> |
getLinksCoupledToMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the set of links that are coupled to a multicast demand in the given layer.
|
Set<Link> |
getLinksCoupledToUnicastDemands(NetworkLayer... optionalLayerParameter)
Returns the set of links that are couple to a unicast demand in the given layer.
|
Set<Link> |
getLinksDown(NetworkLayer... optionalLayerParameter)
Returns the set of links that are down in the given layer.
|
Set<Link> |
getLinksDownAllLayers()
Returns the set of links that are down in all layers.
|
Set<Link> |
getLinksOversubscribed(NetworkLayer... optionalLayerParameter)
Returns the set of links oversuscribed: the total occupied capacity (including the traffic in the protection segments) exceeds the link capacity
(including the reserved capacity by the protection segments).
|
Set<Link> |
getLinksUp(NetworkLayer... optionalLayerParameter)
Returns the set of links that are up in the given layer.
|
Set<Link> |
getLinksUpAllLayers()
Returns the set of links that are up in all layers.
|
Set<Link> |
getLinksWithZeroCapacity(NetworkLayer... optionalLayerParameter)
Returns the set of links that have zero capacity in the given layer.
|
DoubleMatrix2D |
getMatrixDemand2LinkAssignment(NetworkLayer... optionalLayerParameter)
Returns the demand-link incidence matrix (a DxE matrix in
which an element δde is equal to the number of
times which traffic routes carrying traffic from demand d traverse
link e).
|
DoubleMatrix2D |
getMatrixDemand2LinkTrafficCarried(NetworkLayer... optionalLayerParameter)
Returns the demand-link incidence matrix (DxE in which an element δde is equal to the amount of traffic of each demand carried in each link).
|
DoubleMatrix2D |
getMatrixDemand2RouteAssignment(NetworkLayer... optionalLayerParameter)
Returns the demand-route incidence matrix (a DxR matrix in
which an element δdr is equal to 1 if traffic
route r is able to carry traffic from demand d).
|
DoubleMatrix2D |
getMatrixDemandBasedForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the splitting ratio matrix (fractions of traffic entering a node from
demand 'd', leaving that node through link 'e').
|
DoubleMatrix2D |
getMatrixDestination2LinkTrafficCarried(NetworkLayer... optionalLayerParameter) |
DoubleMatrix2D |
getMatrixDestinationBasedForwardingRules(NetworkLayer... optionalLayer)
A destination-based routing in the form of fractions fte (fraction of the traffic targeted to node t that arrives (or is generated in) node a(e)
(the initial node of link e), that is forwarded through link e).
|
DoubleMatrix2D |
getMatrixLink2LinkBidirectionalityMatrix(NetworkLayer... optionalLayerParameter)
Returns the link-link bidirectionality matrix (a ExE matrix where the element δee' equals 1 when each position e and e' represent a bidirectional
link at the given layer.
|
DoubleMatrix2D |
getMatrixLink2MulticastTreeAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-multicast incidence matrix (an ExT matrix in which an element δet is equal
to the number of times a multicast tree t traverse link e.
|
DoubleMatrix2D |
getMatrixLink2ProtectionSegmentAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-protection segment assignment matrix (an ExR matrix in
which an element δep is equal to the number of
times which protection segment r traverses link e).
|
DoubleMatrix2D |
getMatrixLink2RouteAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-route incidence matrix (an ExR matrix in
which an element δep is equal to the number of
times which traffic route r traverses link e).
|
DoubleMatrix2D |
getMatrixLink2SRGAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-srg assignment matrix (an ExS matrix in which an element δes equals 1 if link e
fails when SRG s is affected.
|
DoubleMatrix2D |
getMatrixMulticastDemand2LinkAssignment(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-link incidence matrix (a DxE matrix in
which an element δde is equal to the number of
times which multicast trees carrying traffic from demand d traverse
link e).
|
DoubleMatrix2D |
getMatrixMulticastDemand2LinkTrafficCarried(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-link incidence matrix (DxE in which an element δde is equal to the amount of traffic of
each multicast demand carried in each link).
|
DoubleMatrix2D |
getMatrixMulticastDemand2MulticastTreeAssignment(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-multicast tree incidence matrix (a DxT matrix in
which an element δdt is equal to 1 if multicast tree t is able to carry traffic from multicast demand d).
|
DoubleMatrix2D |
getMatrixMulticastTree2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the multicast tree-srg incidence matrix (an TxS matrix in which an element δts equals 1 when multicast tree t
fails when SRG s is affected.
|
DoubleMatrix2D |
getMatrixNode2NodeEuclideanDistance()
Returns the NxN Euclidean distance matrix (derived
from node coordinates), where N is the number of nodes within the network.
|
DoubleMatrix2D |
getMatrixNode2NodeHaversineDistanceInKm()
Returns the NxN Haversine distance matrix (derived
from node coordinates, where 'xCoord' is equal to longitude and 'yCoord'
is equal to latitude), where N is the number of nodes within the network.
|
DoubleMatrix2D |
getMatrixNode2NodeOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the traffic matrix, where rows and columns represent the ingress
node and the egress node, respectively, in increasing order of identifier.
|
DoubleMatrix2D |
getMatrixNodeDemandAdjacency(NetworkLayer... optionalLayerParameter)
Returns a NxN matrix where each position accounts from the humber of demands that node i (row) as ingress node and j (column) as egress node.
|
DoubleMatrix2D |
getMatrixNodeDemandIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand incidence matrix (a NxD in which an element δnd equals 1 if n is the ingress node of d,
-1 if n is the egress node of d and 0 otherwise).
|
DoubleMatrix2D |
getMatrixNodeDemandIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand incoming incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is terminated
in node n and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeDemandOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand outgoing incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is initiated
in node n and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeLinkAdjacency(NetworkLayer... optionalLayerParameter)
Returns the node-link adjacency matrix (a NxN matrix in which element δij is equals to the number of links from node i to node j.
|
DoubleMatrix2D |
getMatrixNodeLinkIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link incidence matrix (a NxE matrix in which element δne equals 1 if link e is initiated in node n, -1
if link e ends in node n, and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeLinkIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link incoming incidence matrix (a NxE matrix in which element δne equals 1 if link e is terminated in node n,
and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeLinkOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link outgoing incidence matrix (a NxE matrix in which element δne equals 1 if link e is initiated in node n,
and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeMulticastDemandAdjacency(NetworkLayer... optionalLayerParameter)
Returns a NxN matrix where each position accounts from the humber of multicast demands that node i (row) as ingress node and j (column) as an egress node.
|
DoubleMatrix2D |
getMatrixNodeMulticastDemandIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand incidence matrix (a NxD in which an element δnd equals 1 if n is the ingress node of d,
-1 if n is an egress node of d and 0 otherwise).
|
DoubleMatrix2D |
getMatrixNodeMulticastDemandIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand incoming incidence matrix (a NxD matrix in which element δnd equals 1 if multicast demand d is terminated
in node n and 0 otherwise.
|
DoubleMatrix2D |
getMatrixNodeMulticastDemandOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand outgoing incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is initiated
in node n and 0 otherwise.
|
DoubleMatrix2D |
getMatrixProtectionSegment2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the protection segment-srg incidence matrix (an PxS matrix in which an element δps equals 1 if protection segment p
fails when SRG s is affected.
|
DoubleMatrix2D |
getMatrixRoute2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the route-srg incidence matrix (an RxS matrix in which an element δrs equals 1 if route r
fails when SRG s is affected.
|
MulticastDemand |
getMulticastDemand(int index,
NetworkLayer... optionalLayerParameter)
Returns the multicast demand with the given index in the given layer.
|
MulticastDemand |
getMulticastDemandFromId(long uid)
Returns the multicast demand with the given unique identifier.
|
ArrayList<Long> |
getMulticastDemandIds(NetworkLayer... optionalLayerParameter)
Returns the array of multicast demand ids for the given layer (i-th position, corresponds to index i).
|
List<MulticastDemand> |
getMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the list of multicast demands for the given layer (i-th position, corresponds to multicast demand with index i).
|
List<MulticastDemand> |
getMulticastDemandsBlocked(NetworkLayer... optionalLayerParameter)
Returns the multicast demands that have blocked traffic in the given layer.
|
Set<MulticastDemand> |
getMulticastDemandsCoupled(NetworkLayer... optionalLayerParameter)
Returns the set of multicas demands that are coupled.
|
double |
getMulticastDemandTotalBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total blocked traffic, summing up for all the multicast demands, in the given layer.
|
double |
getMulticastDemandTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total carried traffic, summing up for all the multicast demands, in the given layer.
|
double |
getMulticastDemandTotalOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total offered traffic, summing up for all the multicast demands, in the given layer.
|
MulticastTree |
getMulticastTree(int index,
NetworkLayer... optionalLayerParameter)
Returns the multicast tree with the given index in the given layer. if no layer is provided, default layer is assumed.
|
MulticastTree |
getMulticastTreeFromId(long uid)
Returns the multicast tree with the given unique identifier.
|
ArrayList<Long> |
getMulticastTreeIds(NetworkLayer... optionalLayerParameter)
Returns the array of multicast tree ids for the given layer (i-th position, corresponds to index i).
|
List<MulticastTree> |
getMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns the array of multicast trees for the given layer (i-th position, corresponds to index i).
|
Set<MulticastTree> |
getMulticastTreesDown(NetworkLayer... optionalLayerParameter)
Returns the set of multicast trees that are down (i.e. that traverse a link or node that has failed).
|
String |
getNetworkDescription()
Returns the description associated to the
NetPlan object |
NetworkElement |
getNetworkElement(long id)
Return the network element with the given unique id.
|
static NetworkElement |
getNetworkElementByAttribute(Collection<? extends NetworkElement> listOfElements,
String attribute,
String value)
Returns the first network element among the ones passed as input parameters, that has the given key-value as attribute.
|
long |
getNetworkElementNextId()
Returns the next identifier for a new network element (layer, node, link, demand...)
|
static Collection<? extends NetworkElement> |
getNetworkElementsByAttribute(Collection<? extends NetworkElement> listOfElements,
String attribute,
String value)
Returns all the network elements among the ones passed as input parameters, that have the given key-value as attribute.
|
NetworkLayer |
getNetworkLayer(int index)
Returns the network layer with the given unique identifier.
|
NetworkLayer |
getNetworkLayer(String name)
Returns the network layer with the given name.
|
NetworkLayer |
getNetworkLayerDefault()
Return the default network layer.
|
NetworkLayer |
getNetworkLayerFromId(long uid)
Returns the network layer with the given unique identifier.
|
ArrayList<Long> |
getNetworkLayerIds()
Returns the array of layer ids (i-th position, corresponds to index i).
|
Set<NetworkLayer> |
getNetworkLayerInTopologicalOrder()
Returns network layers in bottom-up order, that is, starting from the
lower layers to the upper layers following coupling relationships.
|
List<NetworkLayer> |
getNetworkLayers()
Returns the array of network layers (i-th position, corresponds to index i).
|
String |
getNetworkName()
Returns the name associated to the netPlan object
|
Node |
getNode(int index)
Returns the node with the given index.
|
Node |
getNodeByName(String name)
Returns the first node with the given name.
|
Node |
getNodeFromId(long uid)
Returns the node with the given unique identifier.
|
ArrayList<Long> |
getNodeIds()
Returns the array of node ids (i-th position, corresponds to index i)
|
Set<Demand> |
getNodePairDemands(Node originNode,
Node destinationNode,
boolean returnDemandsInBothDirections,
NetworkLayer... optionalLayerParameter)
Gets the set of demands at the given layer from the input nodes (if
returnDemandsInBothDirections is true , also the reversed links are included). |
double |
getNodePairEuclideanDistance(Node originNode,
Node destinationNode)
Gets the Euclidean distance for a node pair.
|
double |
getNodePairHaversineDistanceInKm(Node originNode,
Node destinationNode)
Gets the Haversine distance for a node pair.
|
Set<Link> |
getNodePairLinks(Node originNode,
Node destinationNode,
boolean returnLinksInBothDirections,
NetworkLayer... optionalLayerParameter)
Gets the set of links at the given layer from the given nodes (if
returnLinksInBothDirections is true , also the reversed links are included). |
Set<ProtectionSegment> |
getNodePairProtectionSegments(Node originNode,
Node destinationNode,
boolean returnSegmentsInBothDirections,
NetworkLayer... optionalLayerParameter)
Return the set of protection segments at the given layer for the given nodes (if
returnSegmentsInBothDirections is true , also the reversed protection segments are included)
If no layer is provided, default layer is assumed. |
Set<Route> |
getNodePairRoutes(Node originNode,
Node destinationNode,
boolean returnRoutesInBothDirections,
NetworkLayer... optionalLayerParameter)
Gets the set of routes at the given layer from the given nodes (if
returnRoutesInBothDirections is true , also the reversed routes are included). |
List<Node> |
getNodes()
Returns the array of nodes (i-th position, corresponds to index i).
|
Set<Node> |
getNodesDown()
Returns the set of nodes that are down (iteration order corresponds to ascending order of indexes).
|
Set<Node> |
getNodesUp()
Returns the set of nodes that are up (iteration order correspond to ascending order of indexes).
|
int |
getNumberOfDemands(NetworkLayer... optionalLayerParameter)
Returns the number of demands at the given layer.
|
int |
getNumberOfForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the number of non-zero forwarding rules at the given layer.
|
int |
getNumberOfLayers()
Returns the number of layers defined.
|
int |
getNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns the number of links at the given layer.
|
int |
getNumberOfMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the number of multicast demands at the given layer.
|
int |
getNumberOfMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns the number of multicast trees at the given layer.
|
int |
getNumberOfNodePairs()
Returns the number of node pairs.
|
int |
getNumberOfNodes()
Returns the number of network nodes,
|
int |
getNumberOfProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns the number of protection segments at the given layer.
|
int |
getNumberOfRoutes(NetworkLayer... optionalLayerParameter)
Returns the number of routes at the given layer.
|
int |
getNumberOfSRGs()
Returns the number of shared risk groups (SRGs) defined
|
ProtectionSegment |
getProtectionSegment(int index,
NetworkLayer... optionalLayerParameter)
Returns the protection segment with the given index in the given layer. if no layer is provided, default layer is assumed.
|
ProtectionSegment |
getProtectionSegmentFromId(long uid)
Returns the protection segment with the given unique identifier.
|
ArrayList<Long> |
getProtectionSegmentIds(NetworkLayer... optionalLayerParameter)
Returns the array of protection segment ids for the given layer (i-th position, corresponds to index i).
|
List<ProtectionSegment> |
getProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns the array of protection segmets for the given layer (i-th position, corresponds to index i).
|
Set<ProtectionSegment> |
getProtectionSegmentsDown(NetworkLayer... optionalLayerParameter)
Returns the set of protection segments that are down (traverse a link or node that is failed).
|
Route |
getRoute(int index,
NetworkLayer... optionalLayerParameter)
Returns the route with the given index in the given layer. if no layer is provided, default layer is assumed
|
Route |
getRouteFromId(long uid)
Returns the route with the given unique identifier.
|
ArrayList<Long> |
getRouteIds(NetworkLayer... optionalLayerParameter)
Returns the array of route ids for the given layer (i-th position, corresponds to index i).
|
List<Route> |
getRoutes(NetworkLayer... optionalLayerParameter)
Returns the array of route ids for the given layer (i-th position, corresponds to index i).
|
Set<Route> |
getRoutesDown(NetworkLayer... optionalLayerParameter)
Returns the set of routes that are down (traverse a link or node that is failed).
|
Constants.RoutingType |
getRoutingType(NetworkLayer... optionalLayerParameter)
Returns the routing type of the given layer.
|
SharedRiskGroup |
getSRG(int index)
Returns the shared risk group with the given index
|
SharedRiskGroup |
getSRGFromId(long uid)
Returns the shared risk group with the given unique identifier.
|
ArrayList<Long> |
getSRGIds()
Returns the array of shared risk group ids (i-th position, corresponds to index i)
|
List<SharedRiskGroup> |
getSRGs()
Returns the array of shared risk groups (i-th position, corresponds to index i).
|
DoubleMatrix1D |
getVectorAttributeValues(Collection<? extends NetworkElement> collection,
String attributeKey)
Retuns a vector with the values of all given network elements for the given attribute key.
|
DoubleMatrix1D |
getVectorDemandBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the blocked traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorDemandCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorDemandOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorDemandTraversesOversubscribedLink(NetworkLayer... optionalLayerParameter)
Returns a vector where each index equals the demand index and the value is 1 if said demand traverses oversubscrined links, 0 otherwise.
|
DoubleMatrix1D |
getVectorDemandWorseCasePropagationTimeInMs(NetworkLayer... optionalLayerParameter)
Returns the vector with the worst propagation time (in ms) per demand at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkCapacityReservedForProtection(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link reserved for protection, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km in the links, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkOversubscribedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the oversubscibed traffic (oversubscribed traffic being the sum of all carried traffic, including protection segments minus the capacity, or 0 if such substraction is negative) in each link at the given layer.
|
DoubleMatrix1D |
getVectorLinkPropagationDelayInMiliseconds(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation delay in milliseconds in the links, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkPropagationSpeedInKmPerSecond(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation speed in km/s in the links, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkSpareCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the total carried traffic per link (counting the traffic in the traversed protection segments), at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkTotalOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the total occupied capacity in the links (counting the capacity occupied by the traffic in the traversed protection segments), at the given layer.
|
DoubleMatrix1D |
getVectorLinkUpState(NetworkLayer... optionalLayerParameter)
Returns a vector with the up/down state in the links (1 up, 0 down), at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorLinkUtilizationIncludingProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns a vector with the utilization per link, at the given layer.
|
DoubleMatrix1D |
getVectorLinkUtilizationNotIncludingProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns a vector with the utilization per link, at the given layer.
|
DoubleMatrix1D |
getVectorMulticastDemandBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the blocked traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastDemandCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastDemandOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastDemandTraversesOversubscribedLink(NetworkLayer... optionalLayerParameter)
Returns the vector indicating wheter a multicast demnd traverses (1) or not (0) oversubscribes links at the given layer.
|
DoubleMatrix1D |
getVectorMulticastDemandWorseCasePropagationTimeInMs(NetworkLayer... optionalLayerParameter)
Returns the vector with the worst propagation time (in ms) per multicast demand at the given layer. i-th vector corresponds to i-th index of the element..
|
DoubleMatrix1D |
getVectorMulticastTreeAverageNumberOfHops(NetworkLayer... optionalLayerParameter)
Returns a vector with the avergage number of hops per multicast tree at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastTreeCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastTreeNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastTreeOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorMulticastTreeOfferedTrafficOfAssociatedMulticastDemand(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per multicast tree from its associated multicast demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorNodeEgressUnicastTraffic(NetworkLayer... optionalLayerParameter)
Returns the vector with the total incoming offered traffic per node at the given layer. i-th vector corresponds to i-th index of the element. if no layer is provided, default layer is assumed.
|
DoubleMatrix1D |
getVectorNodeIngressUnicastTraffic(NetworkLayer... optionalLayerParameter)
Returns the vector with the total outgoing offered traffic per node at the given layer. i-th vector corresponds to i-th index of the element. if no layer is provided, default layer is assumed.
|
DoubleMatrix1D |
getVectorNodeUpState()
Returns a vector with the up/down state of the nodes (1 up, 0 down). i-th vector corresponds to i-th index of the element
|
DoubleMatrix1D |
getVectorProtectionSegmentCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per protection segment, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorProtectionSegmentLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km per protection segment, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorProtectionSegmentNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per protection segment, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorProtectionSegmentOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per protection segment, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRouteCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per route, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRouteLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km per route, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRouteNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per route (including the links in the traversed protection segments if any), at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRouteOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per route, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRouteOfferedTrafficOfAssociatedDemand(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic (from its associated demand) per route at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorRoutePropagationDelayInMiliseconds(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation delay in seconds per route, at the given layer. i-th vector corresponds to i-th index of the element.
|
DoubleMatrix1D |
getVectorSRGAvailability()
Returns a vector with the availability per Shared Risk Group (SRG).
|
boolean |
hasDemands(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or more demands at the given layer. |
boolean |
hasForwardingRules(NetworkLayer... optionalLayerParameter)
Returns
true if the network has at least one non-zero forwarding rule splitting ratio in any demand-link pair, in the given layer. |
boolean |
hasLinks(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or more links at the given layer. |
boolean |
hasMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or more multicast demands at the given layer. |
boolean |
hasMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or more multicast trees at the given layer. |
boolean |
hasNodes()
Returns
true if the network has nodes. |
boolean |
hasProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or more protection segments at the given layer. |
boolean |
hasRoutes(NetworkLayer... optionalLayerParameter)
Returns
true if the network has one or moreroutes at the given layer. |
boolean |
hasSRGs()
Returns
true if the network has one or more shared risk groups (SRGs) defined. |
boolean |
hasUnicastRoutingLoops(NetworkLayer... optionalLayerParameter)
Returns
true if the network has at least one routing cycle at the given layer. |
boolean |
isLayerCouplingValid(NetworkLayer lowerLayer,
NetworkLayer upperLayer)
Indicates whether or not a further coupling between two layers would be valid.
|
boolean |
isMulticastRoutingBifurcated(NetworkLayer... optionalLayerParameter)
Returns
true if in the given layer, the traffic of any multicast demand is carried by more than one multicast tree. |
boolean |
isMultilayer()
Returns
true if the network has more than one layer. |
boolean |
isSingleLayer()
Returns
true if the network has just one layer |
boolean |
isUnicastRoutingBifurcated(NetworkLayer... optionalLayerParameter)
Returns
true if in the given layer, the traffic of any demand is carried by more than one route (in SOURCE_ROUTING ),
or a node sends traffic of a demand to more than
one link (in HOP_BY_HOP_ROUTING ). |
boolean |
isUp(Collection<Link> linksAndOrProtectionSegments)
Indicates whether or not a path, multicast tree or arbitrary collection of links (and/or protection segments) is up.
|
static NetPlan |
loadFromFile(File file)
Static factory method to get a
NetPlan object from a .n2p file. |
void |
removeAllDemands(NetworkLayer... optionalLayerParameter)
Removes all the demands defined in the given layer.
|
void |
removeAllForwardingRules(NetworkLayer... optionalLayerParameter)
Removes all the forwarding rules in the given layer.
|
void |
removeAllLinks(NetworkLayer... optionalLayerParameter)
Removes all the links defined in the given layer.
|
void |
removeAllLinksUnused(double toleranceCapacityValueToConsiderUnusedLink,
NetworkLayer... optionalLayerParameter)
Removes all the unsused links (those whith lesser capacity than
toleranceCapacityValueToConsiderUnusedLink ) defined in the given layer. |
void |
removeAllMulticastDemands(NetworkLayer... optionalLayerParameter)
Removes all the multicast demands defined in the given layer.
|
void |
removeAllMulticastTrees(NetworkLayer... optionalLayerParameter)
Removes all the multicast trees defined in the given layer.
|
void |
removeAllMulticastTreesUnused(double toleranceTrafficAndCapacityValueToConsiderUnusedTree,
NetworkLayer... optionalLayerParameter)
Removes all the multicast trees carrying no traffic and occupying no link capacity defined in the given layer.
|
void |
removeAllNetworkLayers()
Removes all the network layers (evetything but the nodes and the SRGs).
|
void |
removeAllNodes()
Removes all the network nodes.
|
void |
removeAllProtectionSegments(NetworkLayer... optionalLayerParameter)
Removes all the protection segments defined in the given layer.
|
void |
removeAllRoutes(NetworkLayer... optionalLayerParameter)
Removes all the routes defined in the given layer.
|
void |
removeAllRoutesUnused(double toleranceTrafficAndCapacityValueToConsiderUnusedRoute,
NetworkLayer... optionalLayerParameter)
Removes all the routes defined in the given layer that do not carry traffic nor occupy link capacity in the given layer.
|
void |
removeAllSRGs()
Removes all the shared risk groups.
|
void |
removeAllUnicastRoutingInformation(NetworkLayer... optionalLayerParameter)
Removes all the routing information (unicast and multicast) for the given layer, irrespective of the routing type
setting.
|
void |
removeNetworkLayer(NetworkLayer... optionalLayerParameter)
Removes a layer, and any associated link, demand, route, protection segment or forwarding rule.
|
void |
reset()
Resets the state of the network to an empty
NetPlan . |
void |
saveToFile(File file)
Saves the current network plan to a given file.
|
void |
saveToOutputStream(OutputStream outputStream)
Saves the current network plan to a given output stream.
|
void |
setAllLinksFailureState(boolean setAsUp,
NetworkLayer... optionalLayerParameter)
Sets the failure state (up or down) for all the links in the given layer.
|
void |
setAllNodesFailureState(boolean setAsUp)
Sets the failure state (up or down) for all the nodes.
|
void |
setDemandTrafficUnitsName(String demandTrafficUnitsName,
NetworkLayer... optionalLayerParameter)
Sets the name of the units in which the offered traffic is measured (e.g.
|
void |
setDescription(String description,
NetworkLayer... optionalLayerParameter)
Sets the layer description.
|
double |
setForwardingRule(Demand demand,
Link link,
double splittingRatio)
Adds a new forwarding rule (or override an existing one), to the layer of the demand and link (must be in the same layer).
|
void |
setForwardingRules(Collection<Demand> demands,
Collection<Link> links,
Collection<Double> splittingFactors,
boolean includeUnusedRules)
Adds a set of forwarding rules (or override existing ones).
|
void |
setForwardingRules(DoubleMatrix2D f_de,
NetworkLayer... optionalLayerParameter)
Sets the forwarding rules for the given design.
|
void |
setLinkCapacityUnitsName(String name,
NetworkLayer... optionalLayerParameter)
Sets the name of the units in which the link capacity is measured (e.g.
|
void |
setLinksAndNodesFailureState(Collection<Link> linksToSetAsUp,
Collection<Link> linksToSetAsDown,
Collection<Node> nodesToSetAsUp,
Collection<Node> nodesToSetAsDown)
Changes the failure state of the links and updates the routes/trees/segments (they do not carry traffic nor occupy capacity), and hop-by-hop routing
(no traffic is forwarded in links down)
|
boolean |
setModifiableState(boolean isModifiable)
Sets the
NetPlan so it cannot be modified |
void |
setNetworkDescription(String description)
Sets the network description.
|
void |
setNetworkLayerDefault(NetworkLayer layer)
Sets the default network layer.
|
void |
setNetworkName(String name)
Sets the network name.
|
void |
setRoutingFromDemandLinkCarriedTraffic(DoubleMatrix2D x_de,
boolean xdeValueAsFractionsRespectToDemandOfferedTraffic,
boolean removeCycles,
NetworkLayer... optionalLayerParameter)
Adds traffic routes (or forwarding rules, depending on the routing type) from demand-link routing at the given layer.
|
void |
setRoutingFromDestinationLinkCarriedTraffic(DoubleMatrix2D x_te,
boolean removeCycles,
NetworkLayer... optionalLayerParameter)
Adds traffic routes (or forwarding rules, depending on the routing type) from destination-link routing at the given layer.
|
void |
setRoutingType(Constants.RoutingType newRoutingType,
NetworkLayer... optionalLayerParameter)
Sets the routing type at the given layer.
|
void |
setTrafficMatrix(DoubleMatrix2D trafficMatrix,
NetworkLayer... optionalLayerParameter)
Sets the traffic demands at the given layer from a given traffic matrix, removing any previous
demand.
|
void |
setVectorAttributeValues(Collection<? extends NetworkElement> collection,
String attributeKey,
DoubleMatrix1D values)
Sets the given attributes values to all the given network elements.
|
void |
setVectorDemandOfferedTraffic(DoubleMatrix1D offeredTrafficVector,
NetworkLayer... optionalLayerParameter)
Sets the vector of the offered traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
void |
setVectorLinkCapacity(DoubleMatrix1D linkCapacities,
NetworkLayer... optionalLayerParameter)
Sets the vector of the link capacities, at the given layer. i-th vector corresponds to i-th index of the element.
|
void |
setVectorMulticastDemandOfferedTraffic(DoubleMatrix1D offeredTrafficVector,
NetworkLayer... optionalLayerParameter)
Sets the vector of the offered traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element.
|
void |
setVectorMulticastTreeCarriedTrafficAndOccupiedLinkCapacities(DoubleMatrix1D carriedTraffic,
DoubleMatrix1D occupiedLinkCapacity,
NetworkLayer... optionalLayerParameter)
Sets the vector of the multicast trees carried traffics and occupied link capacities, at the given layer. i-th vector corresponds to i-th index of the element.
|
void |
setVectorProtectionSegmentReservedCapacity(DoubleMatrix1D segmentCapacities,
NetworkLayer... optionalLayerParameter)
Sets the vector of the reserved capacity for protection segments, at the given layer. i-th vector corresponds to i-th index of the element.
|
void |
setVectorRouteCarriedTrafficAndOccupiedLinkCapacities(DoubleMatrix1D carriedTraffic,
DoubleMatrix1D occupiedLinkCapacity,
NetworkLayer... optionalLayerParameter)
Sets the vector of the route carried traffics and occupied link capacities, at the given layer. i-th vector corresponds to i-th index of the element.
|
String |
toString()
Returns a
String representation of the network design. |
String |
toString(Collection<NetworkLayer> layers)
Returns a
String representation of the network design only for the
given layers. |
checkAttachedToNetPlanObject, checkAttachedToNetPlanObject, equals, getAttribute, getAttributes, getId, getIndex, getNetPlan, removeAllAttributes, removeAttribute, setAttribute, setAttributeMap, wasRemoved
public NetPlan()
Default constructor. Creates an empty design
public NetPlan(File file)
Generates a new network design from a given .n2p
file.
file
- .n2p
filepublic NetPlan(InputStream inputStream)
Generates a new network design from an input stream.
inputStream
- Input streampublic Demand addDemand(Node ingressNode, Node egressNode, double offeredTraffic, Map<String,String> attributes, NetworkLayer... optionalLayerParameter)
Adds a new traffic demand.
Important: Self-demands are not allowed.
optionalLayerParameter
- Network layer to which add the demand (optional)ingressNode
- Ingress nodeegressNode
- Egress nodeofferedTraffic
- Offered traffic by this demand. It must be greater or equal than zeroattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueDemand
public Pair<Demand,Demand> addDemandBidirectional(Node ingressNode, Node egressNode, double offeredTraffic, Map<String,String> attributes, NetworkLayer... optionalLayerParameter)
Adds two demands, one in each direction,.
Important: Self-demands are not allowed.
ingressNode
- Identifier of the ingress nodeegressNode
- Identifier of the egress nodeofferedTraffic
- Offered traffic by this demand. It must be greater or equal than zeroattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueoptionalLayerParameter
- Network layer to which add the demand (optional)Demand
,
Pair
public List<Demand> addDemandsFromTrafficMatrix(DoubleMatrix2D trafficMatrix, NetworkLayer... optionalLayerParameter)
Adds new traffic demands froma traffic matrix given as a DoubleMatrix2D
object.
Important: Previous demands will be removed.
Important: Self-demands are not allowed.
trafficMatrix
- Traffix matrix where i-th row is the ingress node, the j-th column the egress node and each entry the offered trafficoptionalLayerParameter
- Network layer to which to add the demands (optional)Demand
public NetworkLayer addLayer(String name, String description, String linkCapacityUnitsName, String demandTrafficUnitsName, Map<String,String> attributes)
Adds a new layer.
name
- Layer name (null
means empty)description
- Layer description (null
means empty)linkCapacityUnitsName
- Textual description of link capacity units (null
means empty)demandTrafficUnitsName
- Textual description of demand traffic units (null
means empty)attributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueNetworkLayer
public NetworkLayer addLayerFrom(NetworkLayer origin)
Creates a new layer and adds the links, routes etc. from the input layer. The number of nodes in the two designs must be the same (the unique ids may differ). Any coupling information in the origin layer is omitted. Links, demands, multicast demands, routes, multicast trees and protecion segments will have the same index within the layer in the origin and in the copied layers, but may have different unique ids.
origin
- Layer to be copiedNetworkLayer
,
Node
public Link addLink(Node originNode, Node destinationNode, double capacity, double lengthInKm, double propagationSpeedInKmPerSecond, Map<String,String> attributes, NetworkLayer... optionalLayerParameter)
Adds a new link.
Important: Self-links are not allowed.
originNode
- Link origin nodedestinationNode
- Link destination nodecapacity
- Link capacity. It must be greather or equal to zerolengthInKm
- Link length. It must be greater or equal than zero. Physical distance between node pais can be otainer through the getNodePairEuclideanDistance
(for Euclidean distance) or getNodePairHaversineDistanceInKm
(for airlinea distance) methods.propagationSpeedInKmPerSecond
- Link propagation speed in km/s. It must be greater than zero (Double.MAX_VALUE
means no propagation delay, a non-positive value is changed into
200000 km/seg, a typical speed of light in the wires)attributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueoptionalLayerParameter
- Network layer to which add the link (optional)Link
,
Node
public Pair<Link,Link> addLinkBidirectional(Node originNode, Node destinationNode, double capacity, double lengthInKm, double propagationSpeedInKmPerSecond, Map<String,String> attributes, NetworkLayer... optionalLayerParameter)
Adds two links, one in each direction.
Important: Self-links are not allowed.
originNode
- Link origin nodedestinationNode
- Link destination nodecapacity
- Link capacity. It must be greather or equal to zerolengthInKm
- Link length. It must be greater or equal than zero. Physical distance between node pais can be otainer through the getNodePairEuclideanDistance
(for Euclidean distance) or getNodePairHaversineDistanceInKm
(for airlinea distance) methods.propagationSpeedInKmPerSecond
- Link propagation speed in km/s. It must be greater than zero (Double.MAX_VALUE
means no propagation delay, a non-positive value is changed into
200000 km/seg, a typical speed of light in the wires)attributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueoptionalLayerParameter
- Network layer to which add the links (optional)Pair
object with the two newly created linksLink
,
Pair
,
Node
public MulticastDemand addMulticastDemand(Node ingressNode, Set<Node> egressNodes, double offeredTraffic, Map<String,String> attributes, NetworkLayer... optionalLayerParameter)
Adds a new multicast traffic demand.
Important: Ingress node cannot be also an egress node.
ingressNode
- Ingress nodeegressNodes
- Egress nodeofferedTraffic
- Offered traffic of the demand. It must be greater or equal than zeroattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueoptionalLayerParameter
- Network layer to which add the demand (optional)MulticastDemand
,
Node
public MulticastTree addMulticastTree(MulticastDemand demand, double carriedTraffic, double occupiedLinkCapacity, Set<Link> linkSet, Map<String,String> attributes)
Adds a new traffic multicast tree.
Important: Routing type must be SOURCE_ROUTING
.
demand
- Multi cast demand to be associated with the treecarriedTraffic
- Carried traffic. It must be greater or equal than zerooccupiedLinkCapacity
- Occupied link capacity. If -1, it will be assumed to be equal to the carried traffic. Otherwise, it must be greater or equal than zerolinkSet
- Set
of links of the multicast treeattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueMulticastTree
,
MulticastDemand
,
Link
public void addMulticastTreesFromCandidateTreeList(Map<MulticastDemand,List<Set<Link>>> cpl)
Adds multiple multicast trees from a Candidate Tree list.
cpl
- Map
where the keys are multicast demands and the values lists of link setsMulticastDemand
,
Link
public Node addNode(double xCoord, double yCoord, String name, Map<String,String> attributes)
Adds a new node to the network. Nodes are associated to all layers.
xCoord
- Node position in x-axisyCoord
- Node position in y-axisname
- Node name (null
will be converted to "Node " + node identifier)attributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueNode
public ProtectionSegment addProtectionSegment(List<Link> sequenceOfLinks, double reservedCapacity, Map<String,String> attributes)
Adds a new protection segment. All the links must belong to the same layer
Important: Routing type must be SOURCE_ROUTING
.
sequenceOfLinks
- Sequence of linksreservedCapacity
- Reserved capacity in each link from sequenceOfLinks
. It must be greater or equal than zeroattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueProtectionSegment
,
Link
public Route addRoute(Demand demand, double carriedTraffic, double occupiedLinkCapacity, List<Link> sequenceOfLinks, Map<String,String> attributes)
Adds a new traffic route
Important: Routing type must be SOURCE_ROUTING
.
demand
- Demand associated to the routecarriedTraffic
- Carried traffic. It must be greater or equal than zerooccupiedLinkCapacity
- Occupied link capacity, it must be greater or equal than zero.sequenceOfLinks
- Sequence of links traversed by the routeattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueRoute
,
Demand
,
Link
public void addRoutesAndProtectionSegmentFromCandidate11PathList(Map<Demand,List<Pair<List<Link>,List<Link>>>> cpl11)
public void addRoutesFromCandidatePathList(double[] costs, String... paramValuePairs)
Same as addRoutesFromCandidatePathList(computeUnicastCandidatePathList(costs , paramValuePairs);
costs
- Link weight vector for the shortest path algorithmparamValuePairs
- Parameters to be passed to the class to tune its operation. An even number of String
is to be passed. For each String
pair, first String
must be the name of the parameter, second a String
with its value. If no name-value pairs are set, default values are usedpublic void addRoutesFromCandidatePathList(Map<Demand,List<List<Link>>> cpl)
Adds multiples routes from a Candidate Path List.
cpl
- Map
where the keys are demands and the values a list of sequence of links (each sequence is a route)public void addRoutesFromCandidatePathList(NetworkLayer layer, double[] costs, String... paramValuePairs)
Same as addRoutesFromCandidatePathList(computeUnicastCandidatePathList(layer , costs , paramValuePairs);
layer
- Network layercosts
- Link weight vector for the shortest path algorithmparamValuePairs
- Parameters to be passed to the class to tune its operation. An even number of String
is to be passed. For each String
pair, first String
must be the name of the parameter, second a String
with its value. If no name-value pairs are set, default values are usedpublic SharedRiskGroup addSRG(double mttfInHours, double mttrInHours, Map<String,String> attributes)
Adds a new SRG.
mttfInHours
- Mean Time To Fail (in hours). Must be greater than zeromttrInHours
- Mean Time To Repair (in hours). Must be greater than zeroattributes
- Map for user-defined attributes (null
means 'no attribute'). Each key represents the attribute name, whereas value represents the attribute valueSharedRiskGroup
public void assignFrom(NetPlan netPlan)
Assigns the information from the input NetPlan
.
Important: A shadow copy is made, so changes in the input object will be reflected in this one. For deep copies use copyFrom()
netPlan
- Network plan to be copiedpublic void checkCachesConsistency()
For debug purposes: Checks the consistency of the internal cache (nodes, srgs, layers, links, demands, multicast demands, multicast trees, routes, protection segments). If any inconsistency is found an exception is thrown.
public NetworkLayer checkContiguousPath(List<Link> links, NetworkLayer layer, Node originNode, Node destinationNode)
Checks that the input sequence of links belong to the same layer and follow a contiguous path. Throws an exception if the path is not contiguous or the sequence of links is empty.
links
- Sequence of linkslayer
- Network layeroriginNode
- Origin nodedestinationNode
- Destination nodepublic NetworkLayer checkInThisNetPlanOptionalLayerParameter(NetworkLayer... optionalLayer)
Checks if the given layer is valid and belongs to this NetPlan
design. Throws and exception if the input is invalid.
optionalLayer
- Network layer (optional)public DoubleMatrix1D checkMatrixDemandLinkCarriedTrafficFlowConservationConstraints(DoubleMatrix2D x_de, boolean xdeValueAsFractionsRespectToDemandOfferedTraffic, NetworkLayer... optionalLayerParameter)
Checks the flow conservation constraints, and returns the traffic carried per demand.
x_de
- Amount of traffic from demand d
(i-th row) transmitted through link e (j-th column) in traffic unitsxdeValueAsFractionsRespectToDemandOfferedTraffic
- If true
, x_de
values are measured as fractions [0,1] instead of traffic unitsoptionalLayerParameter
- Network layer (optional)public DoubleMatrix2D checkMatrixDestinationLinkCarriedTrafficFlowConservationConstraints(DoubleMatrix2D x_te, NetworkLayer... optionalLayerParameter)
Checks the flow conservation constraints, and returns the traffic carried per input output node pair.
x_te
- Amount of traffic targeted to node t
(i-th row) transmitted through link e (j-th column) in traffi unitsoptionalLayerParameter
- Network layer (optional)public Map<MulticastDemand,List<Set<Link>>> computeMulticastCandidatePathList(DoubleMatrix1D costs, String solverName, String solverLibraryName, double maxSolverTimeInSecondsPerTree, String... candidateTreeListParamValuePairs)
computeMulticastCandidatePathList
for the default layercosts
- see computeMulticastCandidatePathList
solverName
- see computeMulticastCandidatePathList
solverLibraryName
- see computeMulticastCandidatePathList
maxSolverTimeInSecondsPerTree
- see computeMulticastCandidatePathList
candidateTreeListParamValuePairs
- see computeMulticastCandidatePathList
computeMulticastCandidatePathList
public Map<MulticastDemand,List<Set<Link>>> computeMulticastCandidatePathList(NetworkLayer layer, DoubleMatrix1D linkCosts, String solverName, String solverLibraryName, double maxSolverTimeInSecondsPerTree, String... candidateTreeListParamValuePairs)
Adds multicast trees specified by those trees that satisfy the options described below. Existing multicast trees will not be removed.
The candidate tree list elaborated contains a set of multicast trees (each one is a set of links) computed for each multicast demand in the network. To compute it, a ILP formulation is solved for each new multicast tree. In general, for every multicast demand k trees are computed ranked according to its cost (weight) according to some link weights.
The computation of paths can be configured via "parameter=value"
options. There are several options to
configure, which can be combined:
K
: Number of desired multicast trees per demand (default: 3). If K'<K
different trees are found for the multicast demand, then only K' are
included in the candidate listmaxCopyCapability
: the maximum number of copies of an input traffic a node can make. Then, a node can have at most this number of ouput links carrying traffic of a multicast tree (default: Double.MAX_VALUE)maxE2ELengthInKm
: Maximum path length measured in kilometers allowed for any tree, from the origin node, to any destination node (default: Double.MAX_VALUE)maxE2ENumHops
: Maximum number of hops allowed for any tree, from the origin node, to any destination node (default: Integer.MAX_VALUE)maxE2EPropDelayInMs
: Maximum propagation delay in miliseconds allowed in a path, for any tree, from the origin node, to any destination node (default: Double.MAX_VALUE)maxTreeCost
: Maximum tree weight allowed, summing the weights of the links (default: Double.MAX_VALUE)maxTreeCostFactorRespectToMinimumCostTree
: Trees with higher weight (cost) than the cost of the minimum cost tree, multiplied by this factor, are not returned (default: Double.MAX_VALUE)maxTreeCostRespectToMinimumCostTree
: Trees with higher weight (cost) than the cost of the minimum cost tree, plus this factor, are not returned (default: Double.MAX_VALUE). While the previous one is a multiplicative factor, this one is an additive factorlayer
- the layer for which the candidate multicast tree list is computedlinkCosts
- Link weight vector for the shortest path algorithm. If null
, a vector of ones is assumedsolverName
- the name of the solver to call for the internal formulation of the algorithmsolverLibraryName
- the solver library namemaxSolverTimeInSecondsPerTree
- the maximum time the solver is allowed for each of the internal formulations (one for each new tree).
The best solution found so far is returned. If non-positive, no time limit is setcandidateTreeListParamValuePairs
- Parameters to be passed to the class to tune its operation. An even number of String
is to be passed. For each String
pair, first String
must be the name of the parameter, second a String
with its value. If no name-value pairs are set, default values are usedpublic DoubleMatrix1D computeMulticastTreeCostVector(double[] costs, NetworkLayer... optionalLayerParameter)
Returns an array with the cost of each multicast tree in the layer. The cost of a multicast tree is given by the sum
of the costs in its links, given by the provided cost vector. If the cost vector provided is null
,
all links have cost one.
costs
- Costs arrayoptionalLayerParameter
- Network layer (optional)MulticastTree
public DoubleMatrix1D computeRouteCostVector(double[] costs, NetworkLayer... optionalLayerParameter)
Returns an array with the cost of each route in the layer. The cost of a route is given by the sum
of the costs of its links, given by the provided cost vector. If the route traverses protection segments, the cost
of its links is included. If the cost vector provided is null
,
all links have cost one.
costs
- Costs arrayoptionalLayerParameter
- Network layer (optional)Route
public static Map<Demand,List<Pair<List<Link>,List<Link>>>> computeUnicastCandidate11PathList(Map<Demand,List<List<Link>>> cpl, DoubleMatrix1D costs, int disjointType)
Computes the list of disjoint path pairs for each demand.
cpl
- Candidate path list per demandcosts
- Link cost vectordisjointType
- Type of disjointness: 0 for SRG-disjoint, 1 for link and node disjoint, other value means link disjointpublic Map<Demand,List<List<Link>>> computeUnicastCandidatePathList(double[] costs, String... paramValuePairs)
Adds traffic routes specified by those paths that satisfy the candidate path list options described below. Existing routes will not be removed.
Important: Routing type must be SOURCE_ROUTING
.
The candidate path list elaborated contains a set of paths computed for each unicast demand in the network, based on the k-shortest path idea. In general, for every demand k paths are computed with the shortest weight according to some weights assigned to the links.
The computation of paths can be configured via "parameter=value"
options. There are several options to
configure, which can be combined:
K
: Number of desired loopless shortest paths (default: 3). If K'<K
different paths are found between the demand node pairs, then only K' paths are
included in the candidate path listmaxLengthInKm
: Maximum path length measured in kilometers allowed (default: Double.MAX_VALUE)maxNumHops
: Maximum number of hops allowed (default: Integer.MAX_VALUE)maxPropDelayInMs
: Maximum propagation delay in miliseconds allowed in a path (default: Double.MAX_VALUE)maxRouteCost
: Maximum path weight allowed (default: Double.MAX_VALUE)maxRouteCostFactorRespectToShortestPath
: Maximum path weight factor with respect to the shortest path weight (default: Double.MAX_VALUE)maxRouteCostRespectToShortestPath
: Maximum path weight with respect to the shortest path weight (default: Double.MAX_VALUE). While the previous one is a multiplicative factor, this one is an additive factorcosts
- Link weight vector for the shortest path algorithmparamValuePairs
- Parameters to be passed to the class to tune its operation. An even number of String
is to be passed. For each String
pair, first String
must be the name of the parameter, second a String
with its value. If no name-value pairs are set, default values are usedpublic Map<Demand,List<List<Link>>> computeUnicastCandidatePathList(NetworkLayer layer, double[] costs, String... paramValuePairs)
Adds traffic routes specified by those paths that satisfy the candidate path list options described below. Existing routes will not be removed.
Important: Routing type must be SOURCE_ROUTING
.
The candidate path list elaborated contains a set of paths computed for each unicast demand in the network, based on the k-shortest path idea. In general, for every demand k paths are computed with the shortest weight according to some weights assigned to the links.
The computation of paths can be configured via "parameter=value"
options. There are several options to
configure, which can be combined:
K
: Number of desired loopless shortest paths (default: 3). If K'<K
different paths are found between the demand node pairs, then only K' paths are
included in the candidate path listmaxLengthInKm
: Maximum path length measured in kilometers allowed (default: Double.MAX_VALUE)maxNumHops
: Maximum number of hops allowed (default: Integer.MAX_VALUE)maxPropDelayInMs
: Maximum propagation delay in miliseconds allowed in a path (default: Double.MAX_VALUE)maxRouteCost
: Maximum path weight allowed (default: Double.MAX_VALUE)maxRouteCostFactorRespectToShortestPath
: Maximum path weight factor with respect to the shortest path weight (default: Double.MAX_VALUE)maxRouteCostRespectToShortestPath
: Maximum path weight with respect to the shortest path weight (default: Double.MAX_VALUE). While the previous one is a multiplicative factor, this one is an additive factorlayer
- Network layercosts
- Link weight vector for the shortest path algorithmparamValuePairs
- Parameters to be passed to the class to tune its operation. An even number of String
is to be passed. For each String
pair, first String
must be the name of the parameter, second a String
with its value. If no name-value pairs are set, default values are usedpublic NetPlan copy()
Returns a deep copy of the current design.
public void copyFrom(NetPlan originNetPlan)
Removes all information from the current NetPlan
and copy the information from the input NetPlan
.
originNetPlan
- Network plan to be copied frompublic static Map<NetworkElement,String> getAttributes(Collection<? extends NetworkElement> collection, String attribute)
Returns the values of a given attribute for all the provided network elements.
collection
- Collection of network elementsattribute
- Attribute namenull
if not definedNetworkElement
public Demand getDemand(int index, NetworkLayer... optionalLayerParameter)
Returns the demand with the given index.
index
- Demand indexoptionalLayerParameter
- Network layer (optional)null
if nonexistent, index lower than 0 or greater than the number of elements minus one)Demand
public Demand getDemandFromId(long uid)
Returns the demand with the given unique identifier.
uid
- Demand unique idnull
if nonexistent)Demand
public ArrayList<Long> getDemandIds(NetworkLayer... optionalLayerParameter)
Returns the array of demand unique ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is used.
optionalLayerParameter
- Network layer (optional)Demand
public List<Demand> getDemands(NetworkLayer... optionalLayerParameter)
Returns the array of demands for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is used.
optionalLayerParameter
- Network layer (optional)Demand
public List<Demand> getDemandsBlocked(NetworkLayer... optionalLayerParameter)
Returns the demands that have blocked traffic in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Demand
public Set<Demand> getDemandsCoupled(NetworkLayer... optionalLayerParameter)
Returns the set of unicast demands that are coupled.
optionalLayerParameter
- Network layer (optional)Set
of unicast demands that have blocked traffic for the given layer (or the defaukt layer if no input was provided)public double getDemandTotalBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total blocked traffic, summing up all the unicast demands, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public double getDemandTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total carried traffic, summing up for all the unicast demands, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public double getDemandTotalOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total offered traffic, summing up for all the unicast demands, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public String getDemandTrafficUnitsName(NetworkLayer... optionalLayerParameter)
Returns the name of the traffic units of the demands of the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)String
with the traffic units name of the demandspublic double getForwardingRuleCarriedTraffic(Demand demand, Link link)
Returns the traffic that is carried using a forwarding rule, in the given layer. If no layer is provided, the default layer is assumed.
Important: Routing type must be HOP_BY_HOP_ROUTING
.
demand
- Outgoing demandlink
- Linkpublic Map<Pair<Demand,Link>,Double> getForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the forwarding rules for the given layer. If no layer is provided, the default layer is assumed.
Important: Routing type must be HOP_BY_HOP_ROUTING
.
optionalLayerParameter
- Network layer (optional)Pair
public double getForwardingRuleSplittingFactor(Demand demand, Link link, NetworkLayer... optionalLayerParameter)
Returns the splitting factor of the forwarding rule of the given demand and link. If no layer is provided, default layer is assumed.
demand
- Outgoing demandlink
- LinkoptionalLayerParameter
- Network layer (optional)public static Collection<Long> getIds(Collection<? extends NetworkElement> collection)
Returns the unique ids of the provided network elements.
collection
- Network elementsCollection
is a Set
, the returned collection is a HashSet
. If the input
Collection
is a List
, an ArrayList
is returned}.public static Collection<Integer> getIndexes(Collection<? extends NetworkElement> collection)
Returns the indexes of the provided network elements.
collection
- Network elementsCollection
is a Set
, the returned collection is a HashSet
. If the input
Collection
is a List
, an ArrayList
is returned}.public Link getLink(int index, NetworkLayer... optionalLayerParameter)
Returns the link with the given index in the given layer. If no layer is provided, default layer is assumed.
index
- Link indexoptionalLayerParameter
- Network layer (optional)null
if it does not exist, index islower than 0, or greater than the number of links minus onepublic String getLinkCapacityUnitsName(NetworkLayer... optionalLayerParameter)
Returns the name of the capacity units of the links of the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public Link getLinkFromId(long uid)
Returns the link with the given unique identifier.
uid
- Link unique idnull
if it does not existpublic ArrayList<Long> getLinkIds(NetworkLayer... optionalLayerParameter)
Returns the array of link ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optionalpublic List<Link> getLinks(NetworkLayer... optionalLayerParameter)
Return a list of all the links in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public Set<Link> getLinksAreBottleneck(NetworkLayer... optionalLayerParameter)
Returns the set of links that are a bottleneck, i.e the fraction of occupied capacity respect to the total (including the capacities in the protection segments) is highest. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of bottleneck linkspublic Set<Link> getLinksCoupledToMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the set of links that are coupled to a multicast demand in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of links coupled to a multicast demandMulticastDemand
public Set<Link> getLinksCoupledToUnicastDemands(NetworkLayer... optionalLayerParameter)
Returns the set of links that are couple to a unicast demand in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of links coupled to a unicast demandDemand
public Set<Link> getLinksDown(NetworkLayer... optionalLayerParameter)
Returns the set of links that are down in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of links that are downpublic Set<Link> getLinksDownAllLayers()
Returns the set of links that are down in all layers.
Set
of links downpublic Set<Link> getLinksOversubscribed(NetworkLayer... optionalLayerParameter)
Returns the set of links oversuscribed: the total occupied capacity (including the traffic in the protection segments) exceeds the link capacity (including the reserved capacity by the protection segments). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of oversubscribed linkspublic Set<Link> getLinksUp(NetworkLayer... optionalLayerParameter)
Returns the set of links that are up in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer )optional)Set
of links that are uppublic Set<Link> getLinksUpAllLayers()
Returns the set of links that are up in all layers.
Set
of links that are uppublic Set<Link> getLinksWithZeroCapacity(NetworkLayer... optionalLayerParameter)
Returns the set of links that have zero capacity in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Set
of links with zero capacitypublic DoubleMatrix2D getMatrixDemand2LinkAssignment(NetworkLayer... optionalLayerParameter)
Returns the demand-link incidence matrix (a DxE matrix in which an element δde is equal to the number of times which traffic routes carrying traffic from demand d traverse link e). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixDemand2LinkTrafficCarried(NetworkLayer... optionalLayerParameter)
Returns the demand-link incidence matrix (DxE in which an element δde is equal to the amount of traffic of each demand carried in each link). Rows and columns are in increasing order of demand and link identifiers, respectively. If no layer is provided, the default layer is assumed
Important: Routing type must be HOP_BY_HOP_ROUTING
.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixDemand2RouteAssignment(NetworkLayer... optionalLayerParameter)
Returns the demand-route incidence matrix (a DxR matrix in which an element δdr is equal to 1 if traffic route r is able to carry traffic from demand d). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixDemandBasedForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the splitting ratio matrix (fractions of traffic entering a node from demand 'd', leaving that node through link 'e'). Rows and columns are in increasing order of demand and link identifiers, respectively. If no layer is provided, the default layer is assumed
Important: Routing type must be HOP_BY_HOP_ROUTING
.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixDestination2LinkTrafficCarried(NetworkLayer... optionalLayerParameter)
public DoubleMatrix2D getMatrixDestinationBasedForwardingRules(NetworkLayer... optionalLayer)
A destination-based routing in the form of fractions fte (fraction of the traffic targeted to node t that arrives (or is generated in) node a(e) (the initial node of link e), that is forwarded through link e). If no layer is provided, the default layer is assumed.
optionalLayer
- Network layer (optional)public DoubleMatrix2D getMatrixLink2LinkBidirectionalityMatrix(NetworkLayer... optionalLayerParameter)
Returns the link-link bidirectionality matrix (a ExE matrix where the element δee' equals 1 when each position e and e' represent a bidirectional link at the given layer. If no layer is provided, default layer is assumed
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixLink2MulticastTreeAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-multicast incidence matrix (an ExT matrix in which an element δet is equal to the number of times a multicast tree t traverse link e. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixLink2ProtectionSegmentAssignment(NetworkLayer... optionalLayerParameter)
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixLink2RouteAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-route incidence matrix (an ExR matrix in which an element δep is equal to the number of times which traffic route r traverses link e). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixLink2SRGAssignment(NetworkLayer... optionalLayerParameter)
Returns the link-srg assignment matrix (an ExS matrix in which an element δes equals 1 if link e fails when SRG s is affected. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixMulticastDemand2LinkAssignment(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-link incidence matrix (a DxE matrix in which an element δde is equal to the number of times which multicast trees carrying traffic from demand d traverse link e). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixMulticastDemand2LinkTrafficCarried(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-link incidence matrix (DxE in which an element δde is equal to the amount of traffic of each multicast demand carried in each link). Rows and columns are in increasing order of demand and link identifiers, respectively. If no layer is provided, the default layer is assumed
Important: Routing type must be HOP_BY_HOP_ROUTING
.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixMulticastDemand2MulticastTreeAssignment(NetworkLayer... optionalLayerParameter)
Returns the multicast demand-multicast tree incidence matrix (a DxT matrix in which an element δdt is equal to 1 if multicast tree t is able to carry traffic from multicast demand d). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixMulticastTree2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the multicast tree-srg incidence matrix (an TxS matrix in which an element δts equals 1 when multicast tree t fails when SRG s is affected. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNode2NodeEuclideanDistance()
Returns the NxN Euclidean distance matrix (derived from node coordinates), where N is the number of nodes within the network.
public DoubleMatrix2D getMatrixNode2NodeHaversineDistanceInKm()
Returns the NxN Haversine distance matrix (derived from node coordinates, where 'xCoord' is equal to longitude and 'yCoord' is equal to latitude), where N is the number of nodes within the network.
public DoubleMatrix2D getMatrixNode2NodeOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the traffic matrix, where rows and columns represent the ingress node and the egress node, respectively, in increasing order of identifier. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeDemandAdjacency(NetworkLayer... optionalLayerParameter)
Returns a NxN matrix where each position accounts from the humber of demands that node i (row) as ingress node and j (column) as egress node. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeDemandIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand incidence matrix (a NxD in which an element δnd equals 1 if n is the ingress node of d, -1 if n is the egress node of d and 0 otherwise). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layerpublic DoubleMatrix2D getMatrixNodeDemandIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand incoming incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is terminated in node n and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeDemandOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-demand outgoing incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is initiated in node n and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeLinkAdjacency(NetworkLayer... optionalLayerParameter)
Returns the node-link adjacency matrix (a NxN matrix in which element δij is equals to the number of links from node i to node j. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeLinkIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link incidence matrix (a NxE matrix in which element δne equals 1 if link e is initiated in node n, -1 if link e ends in node n, and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeLinkIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link incoming incidence matrix (a NxE matrix in which element δne equals 1 if link e is terminated in node n, and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeLinkOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-link outgoing incidence matrix (a NxE matrix in which element δne equals 1 if link e is initiated in node n, and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeMulticastDemandAdjacency(NetworkLayer... optionalLayerParameter)
Returns a NxN matrix where each position accounts from the humber of multicast demands that node i (row) as ingress node and j (column) as an egress node. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeMulticastDemandIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand incidence matrix (a NxD in which an element δnd equals 1 if n is the ingress node of d, -1 if n is an egress node of d and 0 otherwise). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layerpublic DoubleMatrix2D getMatrixNodeMulticastDemandIncomingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand incoming incidence matrix (a NxD matrix in which element δnd equals 1 if multicast demand d is terminated in node n and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixNodeMulticastDemandOutgoingIncidence(NetworkLayer... optionalLayerParameter)
Returns the node-multicast demand outgoing incidence matrix (a NxD matrix in which element δnd equals 1 if demand d is initiated in node n and 0 otherwise. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixProtectionSegment2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the protection segment-srg incidence matrix (an PxS matrix in which an element δps equals 1 if protection segment p fails when SRG s is affected. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix2D getMatrixRoute2SRGAffecting(NetworkLayer... optionalLayerParameter)
Returns the route-srg incidence matrix (an RxS matrix in which an element δrs equals 1 if route r fails when SRG s is affected. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public MulticastDemand getMulticastDemand(int index, NetworkLayer... optionalLayerParameter)
Returns the multicast demand with the given index in the given layer. If no layer is provided, default layer is assumed.
index
- Multicast demand indexoptionalLayerParameter
- Network layer (optional)null
if it does not exist, or index is lower than 0, or greater the number of elements minus one).public MulticastDemand getMulticastDemandFromId(long uid)
Returns the multicast demand with the given unique identifier.
uid
- Multicast demand unique idnull
if it does not existpublic ArrayList<Long> getMulticastDemandIds(NetworkLayer... optionalLayerParameter)
Returns the array of multicast demand ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)ArrayList
of multicast demand unique idspublic List<MulticastDemand> getMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the list of multicast demands for the given layer (i-th position, corresponds to multicast demand with index i). If no layer is provided, the default layer is used
optionalLayerParameter
- Network layer (optional)public List<MulticastDemand> getMulticastDemandsBlocked(NetworkLayer... optionalLayerParameter)
Returns the multicast demands that have blocked traffic in the given layer. If no layer is provided, the default layer is assumed
optionalLayerParameter
- Network layer (optional)public Set<MulticastDemand> getMulticastDemandsCoupled(NetworkLayer... optionalLayerParameter)
Returns the set of multicas demands that are coupled.
optionalLayerParameter
- Network layer (optional)Set
of multicast demandspublic double getMulticastDemandTotalBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total blocked traffic, summing up for all the multicast demands, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public double getMulticastDemandTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total carried traffic, summing up for all the multicast demands, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public double getMulticastDemandTotalOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns the total offered traffic, summing up for all the multicast demands, in the given layer. If no layer is provided, the default layer is assumed
optionalLayerParameter
- Network layer (optional)public MulticastTree getMulticastTree(int index, NetworkLayer... optionalLayerParameter)
Returns the multicast tree with the given index in the given layer. if no layer is provided, default layer is assumed.
index
- Multicast tree indexoptionalLayerParameter
- Network layer (optional)null
if it does not exist, index islower than 0, or greater than the number of elements minus one)public MulticastTree getMulticastTreeFromId(long uid)
Returns the multicast tree with the given unique identifier.
uid
- Multicast tree unique idnull
if it does not existpublic ArrayList<Long> getMulticastTreeIds(NetworkLayer... optionalLayerParameter)
Returns the array of multicast tree ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)ArrayList
of multicast trees unique idspublic List<MulticastTree> getMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns the array of multicast trees for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)List
of multicast treespublic Set<MulticastTree> getMulticastTreesDown(NetworkLayer... optionalLayerParameter)
Returns the set of multicast trees that are down (i.e. that traverse a link or node that has failed).
optionalLayerParameter
- Network layer (optional)Set
of multicast trees that are downpublic String getNetworkDescription()
Returns the description associated to the NetPlan
object
String
public NetworkElement getNetworkElement(long id)
Return the network element with the given unique id.
id
- Unique idnull
if it does not exist)NetworkElement
public static NetworkElement getNetworkElementByAttribute(Collection<? extends NetworkElement> listOfElements, String attribute, String value)
Returns the first network element among the ones passed as input parameters, that has the given key-value as attribute.
listOfElements
- Lit of network elementsattribute
- Attribute namevalue
- Attribute valuenull
if no network element matches or the input null
or emptyNetworkElement
public long getNetworkElementNextId()
public static Collection<? extends NetworkElement> getNetworkElementsByAttribute(Collection<? extends NetworkElement> listOfElements, String attribute, String value)
Returns all the network elements among the ones passed as input parameters, that have the given key-value as attribute. Returns an empty list if no network element mathces this, the input list of elements is null or empty
listOfElements
- List of network elementsattribute
- Attribute namevalue
- Attribute valuepublic NetworkLayer getNetworkLayer(int index)
Returns the network layer with the given unique identifier.
index
- Network layer indexnull
if it does not exist)public NetworkLayer getNetworkLayer(String name)
Returns the network layer with the given name.
name
- Network layer namenull
if it does not exist)public NetworkLayer getNetworkLayerDefault()
Return the default network layer.
public NetworkLayer getNetworkLayerFromId(long uid)
Returns the network layer with the given unique identifier.
uid
- Network layer unique idnull
if it does not exist)public ArrayList<Long> getNetworkLayerIds()
Returns the array of layer ids (i-th position, corresponds to index i).
ArraList
of network layerspublic Set<NetworkLayer> getNetworkLayerInTopologicalOrder()
Returns network layers in bottom-up order, that is, starting from the lower layers to the upper layers following coupling relationships. For layers at the same hierarchical level, no order is guaranteed.
Set
of network layers in topological orderpublic List<NetworkLayer> getNetworkLayers()
Returns the array of network layers (i-th position, corresponds to index i).
List
of network layerspublic String getNetworkName()
Returns the name associated to the netPlan object
public Node getNode(int index)
Returns the node with the given index.
index
- Node indexnull
if it does not exist, index iss lesser than zero or greater than the number of elements minus one)public Node getNodeByName(String name)
Returns the first node with the given name.
name
- Node namenull
if it does not exist)public Node getNodeFromId(long uid)
Returns the node with the given unique identifier.
uid
- Node unique idnull
if it does not exist)public ArrayList<Long> getNodeIds()
Returns the array of node ids (i-th position, corresponds to index i)
ArrayList
of nodespublic Set<Demand> getNodePairDemands(Node originNode, Node destinationNode, boolean returnDemandsInBothDirections, NetworkLayer... optionalLayerParameter)
Gets the set of demands at the given layer from the input nodes (if returnDemandsInBothDirections
is true
, also the reversed links are included). If no layer is provided, the default layer is assumed.
originNode
- Origin nodedestinationNode
- Destination nodereturnDemandsInBothDirections
- Assume both directionsoptionalLayerParameter
- network layer (optional)Set
of demands that have the origin and destination for the given inputpublic double getNodePairEuclideanDistance(Node originNode, Node destinationNode)
Gets the Euclidean distance for a node pair.
originNode
- Origin nodedestinationNode
- Destination nodepublic double getNodePairHaversineDistanceInKm(Node originNode, Node destinationNode)
Gets the Haversine distance for a node pair.
originNode
- Origin nodedestinationNode
- Destination nodepublic Set<Link> getNodePairLinks(Node originNode, Node destinationNode, boolean returnLinksInBothDirections, NetworkLayer... optionalLayerParameter)
Gets the set of links at the given layer from the given nodes (if returnLinksInBothDirections
is true
, also the reversed links are included). If no layer is provided, the default layer is assumed.
originNode
- Origin nodedestinationNode
- Destination nodereturnLinksInBothDirections
- Include links in both directionoptionalLayerParameter
- Network layer (optional)Set
of links between a pair of nodespublic Set<ProtectionSegment> getNodePairProtectionSegments(Node originNode, Node destinationNode, boolean returnSegmentsInBothDirections, NetworkLayer... optionalLayerParameter)
Return the set of protection segments at the given layer for the given nodes (if returnSegmentsInBothDirections
is true
, also the reversed protection segments are included)
If no layer is provided, default layer is assumed.
originNode
- Origin nodedestinationNode
- Destination nodereturnSegmentsInBothDirections
- Include protection segments in both directionsoptionalLayerParameter
- Network layer (optional)Set
of protection segments between a pair of nodespublic Set<Route> getNodePairRoutes(Node originNode, Node destinationNode, boolean returnRoutesInBothDirections, NetworkLayer... optionalLayerParameter)
Gets the set of routes at the given layer from the given nodes (if returnRoutesInBothDirections
is true
, also the reversed routes are included).
If no layer is provided, the default layer is assumed.
originNode
- Origin nodedestinationNode
- Destination nodereturnRoutesInBothDirections
- Include routes in both directionsoptionalLayerParameter
- Network layer (optional)Set
of routes between a pair of nodespublic List<Node> getNodes()
Returns the array of nodes (i-th position, corresponds to index i).
List
of nodespublic Set<Node> getNodesDown()
Returns the set of nodes that are down (iteration order corresponds to ascending order of indexes).
Set
of nodes that are downpublic Set<Node> getNodesUp()
Returns the set of nodes that are up (iteration order correspond to ascending order of indexes).
Set
of nodes that are uppublic int getNumberOfDemands(NetworkLayer... optionalLayerParameter)
Returns the number of demands at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)public int getNumberOfForwardingRules(NetworkLayer... optionalLayerParameter)
Returns the number of non-zero forwarding rules at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)public int getNumberOfLayers()
Returns the number of layers defined.
public int getNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns the number of links at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layerpublic int getNumberOfMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns the number of multicast demands at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public int getNumberOfMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns the number of multicast trees at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public int getNumberOfNodePairs()
Returns the number of node pairs.
public int getNumberOfNodes()
Returns the number of network nodes,
public int getNumberOfProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns the number of protection segments at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)public int getNumberOfRoutes(NetworkLayer... optionalLayerParameter)
Returns the number of routes at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)public int getNumberOfSRGs()
Returns the number of shared risk groups (SRGs) defined
public ProtectionSegment getProtectionSegment(int index, NetworkLayer... optionalLayerParameter)
Returns the protection segment with the given index in the given layer. if no layer is provided, default layer is assumed.
index
- Protection segment indexoptionalLayerParameter
- network layer (optional)null
if it does not exist, index is lesser thatn zero or greater that the number of elements minus one)public ProtectionSegment getProtectionSegmentFromId(long uid)
Returns the protection segment with the given unique identifier.
uid
- Protection segment unique idnull
if it does not exist)public ArrayList<Long> getProtectionSegmentIds(NetworkLayer... optionalLayerParameter)
Returns the array of protection segment ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed
optionalLayerParameter
- Network layer (optional)ArrayList
of protection segments unique idspublic List<ProtectionSegment> getProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns the array of protection segmets for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)List
of protection segmentspublic Set<ProtectionSegment> getProtectionSegmentsDown(NetworkLayer... optionalLayerParameter)
Returns the set of protection segments that are down (traverse a link or node that is failed). If no layer is provided, default layer is assumed.
optionalLayerParameter
- network layer (optional)Set
of protection segments that are downpublic Route getRoute(int index, NetworkLayer... optionalLayerParameter)
Returns the route with the given index in the given layer. if no layer is provided, default layer is assumed
index
- Route indexoptionalLayerParameter
- network layer (optional)null
if it does not exist, index is lesser than zero or greater than the number of elements minus one)public Route getRouteFromId(long uid)
Returns the route with the given unique identifier.
uid
- Rute unique idnull
if it does not exist)public ArrayList<Long> getRouteIds(NetworkLayer... optionalLayerParameter)
Returns the array of route ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed
optionalLayerParameter
- Network layer (optional)ArrayList
of route idespublic List<Route> getRoutes(NetworkLayer... optionalLayerParameter)
Returns the array of route ids for the given layer (i-th position, corresponds to index i). If no layer is provided, the default layer is assumed
optionalLayerParameter
- network layer (optional)List
of routespublic Set<Route> getRoutesDown(NetworkLayer... optionalLayerParameter)
Returns the set of routes that are down (traverse a link or node that is failed). If no layer is provided, default layer is assumed
optionalLayerParameter
- network layer (optional)Set
of routes that are downpublic Constants.RoutingType getRoutingType(NetworkLayer... optionalLayerParameter)
Returns the routing type of the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)Constants.RoutingType
public SharedRiskGroup getSRG(int index)
Returns the shared risk group with the given index
index
- SRG indexnull
if it does not exist, index is lesser than zero or greater than the number of elements minus one)public SharedRiskGroup getSRGFromId(long uid)
Returns the shared risk group with the given unique identifier.
uid
- SRG unique idpublic ArrayList<Long> getSRGIds()
Returns the array of shared risk group ids (i-th position, corresponds to index i)
ArrayList
of Shared Risk Groups unique idspublic List<SharedRiskGroup> getSRGs()
Returns the array of shared risk groups (i-th position, corresponds to index i).
List
of Shared Risk Groupspublic DoubleMatrix1D getVectorAttributeValues(Collection<? extends NetworkElement> collection, String attributeKey)
Retuns a vector with the values of all given network elements for the given attribute key.
Important: Each element must have the attribute set and value must be of type double
collection
- Network elementsattributeKey
- Attribute namepublic DoubleMatrix1D getVectorDemandBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the blocked traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorDemandCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorDemandOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorDemandTraversesOversubscribedLink(NetworkLayer... optionalLayerParameter)
Returns a vector where each index equals the demand index and the value is 1 if said demand traverses oversubscrined links, 0 otherwise. If no layer is provided, default layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorDemandWorseCasePropagationTimeInMs(NetworkLayer... optionalLayerParameter)
Returns the vector with the worst propagation time (in ms) per demand at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorLinkCapacityReservedForProtection(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link reserved for protection, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km in the links, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkOversubscribedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the oversubscibed traffic (oversubscribed traffic being the sum of all carried traffic, including protection segments minus the capacity, or 0 if such substraction is negative) in each link at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, default layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorLinkPropagationDelayInMiliseconds(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation delay in milliseconds in the links, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkPropagationSpeedInKmPerSecond(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation speed in km/s in the links, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorLinkSpareCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the capacity per link, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkTotalCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the total carried traffic per link (counting the traffic in the traversed protection segments), at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkTotalOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the total occupied capacity in the links (counting the capacity occupied by the traffic in the traversed protection segments), at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkUpState(NetworkLayer... optionalLayerParameter)
Returns a vector with the up/down state in the links (1 up, 0 down), at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkUtilizationIncludingProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns a vector with the utilization per link, at the given layer. Utilization is measured as the total link occupied capacity by the link traffic including the one in the protection segments, divided by the total link capacity (accounting the reserved capacity by the protection segments). i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorLinkUtilizationNotIncludingProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns a vector with the utilization per link, at the given layer. Utilization is measured as the total link occupied capacity by the link traffic not including the one in the protection segments, divided by the total link capacity, not including that reserved by the protection segments. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorMulticastDemandBlockedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the blocked traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastDemandCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastDemandOfferedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastDemandTraversesOversubscribedLink(NetworkLayer... optionalLayerParameter)
Returns the vector indicating wheter a multicast demnd traverses (1) or not (0) oversubscribes links at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastDemandWorseCasePropagationTimeInMs(NetworkLayer... optionalLayerParameter)
Returns the vector with the worst propagation time (in ms) per multicast demand at the given layer. i-th vector corresponds to i-th index of the element.. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorMulticastTreeAverageNumberOfHops(NetworkLayer... optionalLayerParameter)
Returns a vector with the avergage number of hops per multicast tree at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastTreeCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastTreeNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorMulticastTreeOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per multicast tree, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorMulticastTreeOfferedTrafficOfAssociatedMulticastDemand(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic per multicast tree from its associated multicast demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorNodeEgressUnicastTraffic(NetworkLayer... optionalLayerParameter)
Returns the vector with the total incoming offered traffic per node at the given layer. i-th vector corresponds to i-th index of the element. if no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorNodeIngressUnicastTraffic(NetworkLayer... optionalLayerParameter)
Returns the vector with the total outgoing offered traffic per node at the given layer. i-th vector corresponds to i-th index of the element. if no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorNodeUpState()
Returns a vector with the up/down state of the nodes (1 up, 0 down). i-th vector corresponds to i-th index of the element
public DoubleMatrix1D getVectorProtectionSegmentCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per protection segment, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorProtectionSegmentLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km per protection segment, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorProtectionSegmentNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per protection segment, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorProtectionSegmentOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per protection segment, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorRouteCarriedTraffic(NetworkLayer... optionalLayerParameter)
Returns a vector with the carried traffic per route, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorRouteLengthInKm(NetworkLayer... optionalLayerParameter)
Returns a vector with the length in km per route, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorRouteNumberOfLinks(NetworkLayer... optionalLayerParameter)
Returns a vector with the number of links per route (including the links in the traversed protection segments if any), at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorRouteOccupiedCapacity(NetworkLayer... optionalLayerParameter)
Returns a vector with the occupied capacity traffic per route, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorRouteOfferedTrafficOfAssociatedDemand(NetworkLayer... optionalLayerParameter)
Returns a vector with the offered traffic (from its associated demand) per route at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- Network layer (optional)public DoubleMatrix1D getVectorRoutePropagationDelayInMiliseconds(NetworkLayer... optionalLayerParameter)
Returns a vector with the propagation delay in seconds per route, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
optionalLayerParameter
- network layer (optional)public DoubleMatrix1D getVectorSRGAvailability()
Returns a vector with the availability per Shared Risk Group (SRG).
public boolean hasDemands(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or more demands at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)True
if the network has demands at the given layer, false
otherwisepublic boolean hasForwardingRules(NetworkLayer... optionalLayerParameter)
Returns true
if the network has at least one non-zero forwarding rule splitting ratio in any demand-link pair, in the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- network layer (optional)True
if the network has at least one forwarding rule, false
otherwisepublic boolean hasLinks(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or more links at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if the network has one or more links, false
otherwisepublic boolean hasMulticastDemands(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or more multicast demands at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if the network has one or more multicast demand, false
otherwisepublic boolean hasMulticastTrees(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or more multicast trees at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if the network has one or more multicast trees, false
otherwisepublic boolean hasNodes()
Returns true
if the network has nodes.
True
if the network has nodes, false
otherwisepublic boolean hasProtectionSegments(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or more protection segments at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if the network has one or more protection segments, false
otherwisepublic boolean hasRoutes(NetworkLayer... optionalLayerParameter)
Returns true
if the network has one or moreroutes at the given layer. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if the network has one or more routes, false
otherwisepublic boolean hasSRGs()
Returns true
if the network has one or more shared risk groups (SRGs) defined.
True
if the network has SRGs defined, false
otherwisepublic boolean hasUnicastRoutingLoops(NetworkLayer... optionalLayerParameter)
Returns true
if the network has at least one routing cycle at the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if there is at least one routing cycle, false
otherwisepublic boolean isLayerCouplingValid(NetworkLayer lowerLayer, NetworkLayer upperLayer)
Indicates whether or not a further coupling between two layers would be valid. This can be used to check if a new coupling would create cycles in the topology of layers, that is, if layer hierarchy is not broken.
lowerLayer
- Network lower layerupperLayer
- Network upper layerTrue
if coupling between both input layers is valid, false
otherwisepublic boolean isMulticastRoutingBifurcated(NetworkLayer... optionalLayerParameter)
Returns true
if in the given layer, the traffic of any multicast demand is carried by more than one multicast tree. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)True
if traffic from at least one multicast demand is carried trhough two or more multicast trees, false
otherwisepublic boolean isMultilayer()
Returns true
if the network has more than one layer.
True
if the network has two or more layers, false
otherwisepublic boolean isSingleLayer()
Returns true
if the network has just one layer
True
if network has only one layer, false
otherwisepublic boolean isUnicastRoutingBifurcated(NetworkLayer... optionalLayerParameter)
Returns true
if in the given layer, the traffic of any demand is carried by more than one route (in SOURCE_ROUTING
),
or a node sends traffic of a demand to more than
one link (in HOP_BY_HOP_ROUTING
). If no layer is provided, the default layer is assumed
optionalLayerParameter
- Network layer (optional)True
if unicast traffic is bifurcated (see description), false
otherwisepublic boolean isUp(Collection<Link> linksAndOrProtectionSegments)
Indicates whether or not a path, multicast tree or arbitrary collection of links (and/or protection segments) is up. This means that all links are up, and all end nodes of the links are also up
linksAndOrProtectionSegments
- Sequence of linksTrue
if all links in the sequence are up, false
otherwisepublic static NetPlan loadFromFile(File file)
Static factory method to get a NetPlan
object from a .n2p
file.
file
- Input filepublic void removeAllDemands(NetworkLayer... optionalLayerParameter)
Removes all the demands defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllForwardingRules(NetworkLayer... optionalLayerParameter)
Removes all the forwarding rules in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllLinks(NetworkLayer... optionalLayerParameter)
Removes all the links defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllLinksUnused(double toleranceCapacityValueToConsiderUnusedLink, NetworkLayer... optionalLayerParameter)
Removes all the unsused links (those whith lesser capacity than toleranceCapacityValueToConsiderUnusedLink
) defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)toleranceCapacityValueToConsiderUnusedLink
- Tolerance capacity to consider a link unsusedpublic void removeAllMulticastDemands(NetworkLayer... optionalLayerParameter)
Removes all the multicast demands defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllMulticastTrees(NetworkLayer... optionalLayerParameter)
Removes all the multicast trees defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllMulticastTreesUnused(double toleranceTrafficAndCapacityValueToConsiderUnusedTree, NetworkLayer... optionalLayerParameter)
Removes all the multicast trees carrying no traffic and occupying no link capacity defined in the given layer. If no layer is provided, default layer is used.
toleranceTrafficAndCapacityValueToConsiderUnusedTree
- Tolerance capacity to consider a link unsusedoptionalLayerParameter
- Network layer (optional)public void removeAllNetworkLayers()
Removes all the network layers (evetything but the nodes and the SRGs).
public void removeAllNodes()
Removes all the network nodes.
public void removeAllProtectionSegments(NetworkLayer... optionalLayerParameter)
Removes all the protection segments defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllRoutes(NetworkLayer... optionalLayerParameter)
Removes all the routes defined in the given layer. If no layer is provided, default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeAllRoutesUnused(double toleranceTrafficAndCapacityValueToConsiderUnusedRoute, NetworkLayer... optionalLayerParameter)
Removes all the routes defined in the given layer that do not carry traffic nor occupy link capacity in the given layer. If no layer is provided, default layer is assumed.
toleranceTrafficAndCapacityValueToConsiderUnusedRoute
- Tolerance traffic to consider a route unusedoptionalLayerParameter
- Network layer (optional)public void removeAllSRGs()
Removes all the shared risk groups.
public void removeAllUnicastRoutingInformation(NetworkLayer... optionalLayerParameter)
Removes all the routing information (unicast and multicast) for the given layer, irrespective of the routing type setting. For source routing, all routes and protection segments are removed. For hop-by-hop routing, all forwarding rules are removed. If no layer is provided, the default layer is assumed.
optionalLayerParameter
- Network layer (optional)public void removeNetworkLayer(NetworkLayer... optionalLayerParameter)
Removes a layer, and any associated link, demand, route, protection segment or forwarding rule. If this layer is the default, the new default layer is the one with index 0 (the smallest identifier)
optionalLayerParameter
- Network layer (optional)public void reset()
Resets the state of the network to an empty NetPlan
.
public void saveToFile(File file)
Saves the current network plan to a given file. If extension .n2p
is not in the file name, it will be added automatically.
file
- Output filepublic void saveToOutputStream(OutputStream outputStream)
Saves the current network plan to a given output stream.
outputStream
- Output streampublic void setAllLinksFailureState(boolean setAsUp, NetworkLayer... optionalLayerParameter)
Sets the failure state (up or down) for all the links in the given layer. If no layer is provided, the default layer is assumed.
setAsUp
- true
up, false
downoptionalLayerParameter
- Network layer (optional)public void setAllNodesFailureState(boolean setAsUp)
Sets the failure state (up or down) for all the nodes.
setAsUp
- true
up, false
downpublic void setDemandTrafficUnitsName(String demandTrafficUnitsName, NetworkLayer... optionalLayerParameter)
Sets the name of the units in which the offered traffic is measured (e.g. "Gbps") at the given layer. If no layer is provided, default layer is assumed.
demandTrafficUnitsName
- Traffic units nameoptionalLayerParameter
- Network layer (optional)public void setDescription(String description, NetworkLayer... optionalLayerParameter)
Sets the layer description. If no layer is provided, default layer is used.
description
- Layer descriptionoptionalLayerParameter
- Network layer (optional)public double setForwardingRule(Demand demand, Link link, double splittingRatio)
Adds a new forwarding rule (or override an existing one), to the layer of the demand and link (must be in the same layer).
Important: Routing type must be HOP_BY_HOP_ROUTING
.
demand
- Demandlink
- LinksplittingRatio
- Splitting ratio (fraction of traffic from demand 'd' entering to the origin node of link 'e', going through link 'e').
Must be equal or greater than 0 and equal or lesser than 1.public void setForwardingRules(Collection<Demand> demands, Collection<Link> links, Collection<Double> splittingFactors, boolean includeUnusedRules)
Adds a set of forwarding rules (or override existing ones). Demands, links and ratio are processed sequentially. All the elements must be in the same layer.
Important: Routing type must be HOP_BY_HOP_ROUTING
.
demands
- Demandslinks
- LinkssplittingFactors
- Splitting ratios (fraction of traffic from demand 'd' entering to the origin node of link 'e', going through link 'e').
Each value must be equal or greater than 0 and equal or lesser than 1.includeUnusedRules
- Inclue true
or not false
unused rulespublic void setForwardingRules(DoubleMatrix2D f_de, NetworkLayer... optionalLayerParameter)
Sets the forwarding rules for the given design. Any previous routing information (either source routing or hop-by-hop routing) will be removed.
f_de
- For each demand d (d = 0 refers to the first demand in demandIds
, d = 1
refers to the second one, and so on), and each link e (e = 0 refers to the first link in NetPlan
object, e = 1
refers to the second one, and so on), f_de[d][e]
sets the fraction of the traffic from demand d that arrives (or is generated in) node a(e) (the origin node of link e), that is forwarded through link e. It must hold that for every node n different of b(d), the sum of the fractions fte along its outgoing links must be lower or equal than 1optionalLayerParameter
- Network layer (optional)public void setLinkCapacityUnitsName(String name, NetworkLayer... optionalLayerParameter)
Sets the name of the units in which the link capacity is measured (e.g. "Gbps") at the given layer. If no ayer is provided, the default layer is assumed.
name
- Capacity units nameoptionalLayerParameter
- Network layer (optional)public void setLinksAndNodesFailureState(Collection<Link> linksToSetAsUp, Collection<Link> linksToSetAsDown, Collection<Node> nodesToSetAsUp, Collection<Node> nodesToSetAsDown)
Changes the failure state of the links and updates the routes/trees/segments (they do not carry traffic nor occupy capacity), and hop-by-hop routing (no traffic is forwarded in links down)
linksToSetAsUp
- Links to set as uplinksToSetAsDown
- Links to set as downnodesToSetAsUp
- Nodes to set as upnodesToSetAsDown
- Nodes to set as downpublic boolean setModifiableState(boolean isModifiable)
Sets the NetPlan
so it cannot be modified
isModifiable
- }If true
, the object can be modified, false
otherwisepublic void setNetworkDescription(String description)
Sets the network description.
description
- Description (when null
, it will be set to empty)public void setNetworkLayerDefault(NetworkLayer layer)
Sets the default network layer.
layer
- The default network layerpublic void setNetworkName(String name)
Sets the network name.
name
- Namepublic void setRoutingFromDemandLinkCarriedTraffic(DoubleMatrix2D x_de, boolean xdeValueAsFractionsRespectToDemandOfferedTraffic, boolean removeCycles, NetworkLayer... optionalLayerParameter)
Adds traffic routes (or forwarding rules, depending on the routing type) from demand-link routing at the given layer.
If no layer is provided, default layer is assumed. If the routing is SOURCE-ROUTING, the new routing will have no closed nor open loops. If the routing is
HOP-BY-HOP routing, the new routing can have open loops. However, if the routing has closed loops (which were not removed), a ClosedCycleRoutingException
will be thrown.
x_de
- Matrix containing the amount of traffic from demand d (rows) which traverses link e (columns)xdeValueAsFractionsRespectToDemandOfferedTraffic
- If true
, {code x_de} contains the fraction of the carried traffic (between 0 and 1)removeCycles
- If true, the open and closed loops are eliminated from the routing before any processing is done. The form in which this is done guarantees that the resulting
routing uses the same or less traffic in the links for each destination than the original routing. For removing the cycles,
the method calls to removeCyclesFrom_xte
using the default ILP solver defined in Net2Plan, and no limit in the maximum solver running time.optionalLayerParameter
- Network layer (optional)public void setRoutingFromDestinationLinkCarriedTraffic(DoubleMatrix2D x_te, boolean removeCycles, NetworkLayer... optionalLayerParameter)
Adds traffic routes (or forwarding rules, depending on the routing type) from destination-link routing at the given layer.
If no layer is provided, default layer is assumed. If the routing is SOURCE-ROUTING, the new routing will have no closed nor open loops. If the routing is
HOP-BY-HOP routing, the new routing can have open loops. However, if the routing has closed loops (which were not removed), a ClosedCycleRoutingException
will be thrown
x_te
- For each destination node t (rows), and each link e (columns), f_te[t][e]
represents the traffic targeted to node t that arrives (or is generated
in) node a(e) (the origin node of link e), that is forwarded through link eremoveCycles
- If true, the open and closed loops are eliminated from the routing before any processing is done. The form in which this is done guarantees that the resulting
routing uses the same or less traffic in the links for each destination than the original routing. For removing the cycles,
the method calls to removeCyclesFrom_xte
using the default ILP solver defined in Net2Plan, and no limit in the maximum solver running time.optionalLayerParameter
- Network layer (optional)public void setRoutingType(Constants.RoutingType newRoutingType, NetworkLayer... optionalLayerParameter)
Sets the routing type at the given layer. If there is some previous routing information, it will be converted to the new type. If no layer is provided, default layer is assumed. In the conversion from HOP-BY-HOP to SOURCE-ROUTING: (i) the demands with open loops are routed so these loops are removed, and the resulting routing consumes the same or less bandwidth in the demand traversed links, (ii) the demands with closed loops are routed so that the traffic that enters the closed loops is not carried. These modifications are done since open or close loops would require routes with an infinite number of links to be fairly represented.
optionalLayerParameter
- Network layer (optional)newRoutingType
- RoutingType
public void setTrafficMatrix(DoubleMatrix2D trafficMatrix, NetworkLayer... optionalLayerParameter)
Sets the traffic demands at the given layer from a given traffic matrix, removing any previous demand. If no layer is provided, default layer is assumed.
Important: Matrix values must be strictly non-negative and matrix size have to be NxN (where N is the number of nodes)
optionalLayerParameter
- Network layer (optionaltrafficMatrix
- Traffic matrixpublic void setVectorAttributeValues(Collection<? extends NetworkElement> collection, String attributeKey, DoubleMatrix1D values)
Sets the given attributes values to all the given network elements.
collection
- Network elementsattributeKey
- Attribute namevalues
- Attribute values (must have the same size as collection
public void setVectorDemandOfferedTraffic(DoubleMatrix1D offeredTrafficVector, NetworkLayer... optionalLayerParameter)
Sets the vector of the offered traffic per demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
offeredTrafficVector
- Offered traffic vectoroptionalLayerParameter
- Network layer (optional)public void setVectorLinkCapacity(DoubleMatrix1D linkCapacities, NetworkLayer... optionalLayerParameter)
Sets the vector of the link capacities, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
linkCapacities
- Link capacitiesoptionalLayerParameter
- Network layer (optional)public void setVectorMulticastDemandOfferedTraffic(DoubleMatrix1D offeredTrafficVector, NetworkLayer... optionalLayerParameter)
Sets the vector of the offered traffic per multicast demand, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
offeredTrafficVector
- Offered traffic vectoroptionalLayerParameter
- Network layer (optional)public void setVectorMulticastTreeCarriedTrafficAndOccupiedLinkCapacities(DoubleMatrix1D carriedTraffic, DoubleMatrix1D occupiedLinkCapacity, NetworkLayer... optionalLayerParameter)
Sets the vector of the multicast trees carried traffics and occupied link capacities, at the given layer. i-th vector corresponds to i-th index of the element.
If occupied link capacities are null
, the same amount as the carried traffic is assumed. If no layer is provided, the defaulf layer is assumed.
carriedTraffic
- Carried traffic vectoroccupiedLinkCapacity
- Occupied link capacity vectoroptionalLayerParameter
- Network layer (optional)public void setVectorProtectionSegmentReservedCapacity(DoubleMatrix1D segmentCapacities, NetworkLayer... optionalLayerParameter)
Sets the vector of the reserved capacity for protection segments, at the given layer. i-th vector corresponds to i-th index of the element. If no layer is provided, the defaulf layer is assumed.
segmentCapacities
- Protection segment reserved capacities vectoroptionalLayerParameter
- Network layer (optional)public void setVectorRouteCarriedTrafficAndOccupiedLinkCapacities(DoubleMatrix1D carriedTraffic, DoubleMatrix1D occupiedLinkCapacity, NetworkLayer... optionalLayerParameter)
Sets the vector of the route carried traffics and occupied link capacities, at the given layer. i-th vector corresponds to i-th index of the element.
If occupied link capacities are null
, the same amount as the carried traffic is assumed. If no layer is provided, the defaulf layer is assumed,
carriedTraffic
- Carried traffic vectoroccupiedLinkCapacity
- Occupied link capacity vectoroptionalLayerParameter
- Network layer (optional)public String toString()
String
representation of the network design.toString
in class NetworkElement
public String toString(Collection<NetworkLayer> layers)
String
representation of the network design only for the
given layers.layers
- Network layers