public final class NetPlan
extends Object
Class defining a complete network structure.
An unmodifiable version of NetPlan object can be obtained through the copy constructor. Instances work transparently as NetPlan object
unless you try to change it. Calling any method that can potentially change the network (e.g. add/set methods) throws an UnsupportedOperationException
.
Constructor and Description |
---|
NetPlan()
Default constructor.
|
NetPlan(File file)
Generates a new network structure from a given .n2p file
|
Modifier and Type | Method and Description |
---|---|
int |
addDemand(int ingressNodeId,
int egressNodeId,
double offeredTrafficInErlangs,
Map<String,String> attributes)
Adds a new traffic demand to the network.
|
void |
addDemandsFrom(NetPlan demands)
Adds to the current network plan the traffic demand set from other network plan.
|
int |
addLink(int originNodeId,
int destinationNodeId,
double linkCapacityInErlangs,
double linkLengthInKm,
Map<String,String> attributes)
Adds a new link to the network.
|
int |
addNode(double x,
double y,
String name,
Map<String,String> attributes)
Adds a new node to the network.
|
int |
addProtectionSegment(int[] sequenceOfLinks,
double reservedBandwidthInErlangs,
Map<String,String> attributes)
Adds a new protection segment to the network.
|
void |
addProtectionSegmentToRouteBackupSegmentList(int segmentId,
int routeId)
Adds a protection segment to the list of backup protection segments of a route.
|
int |
addRoute(int demandId,
double carriedTrafficInErlangs,
int[] sequenceOfLinks,
int[] backupSegmentIds,
Map<String,String> attributes)
Adds a new traffic route to the network.
|
void |
addRoutes(CandidatePathList cpl,
double[] x_p,
boolean includeUnusedRoutes)
Adds traffic routes from a candidate path list.
|
boolean |
checkProtectionSegmentMergeabilityToRoute(int routeId,
int segmentId)
Tests whether a given protection segment is applicable to a route.
|
void |
checkRouteValidityForDemand(int[] sequenceOfLinksAndSegments,
int demandId)
Checks if a sequence of links is valid for a given demand.
|
String[] |
checkValidity(boolean forceLinkCapacityConstraint)
Checks the validity of the current network plan.
|
int[] |
convertBackupRoute2SequenceOfLinks(int[] sequenceOfLinksAndSegments)
Converts a sequence of links and segments to a sequence of links
|
int[] |
convertSequenceOfLinks2SequenceOfNodes(int[] sequenceOfLinksAndSegments)
Converts a sequence of links and segments to a sequence of nodes
|
NetPlan |
copy()
Returns a deep copy of the network design.
|
String |
getDemandAttribute(int demandId,
String key)
Returns the value for an attribute of the given demand.
|
String[] |
getDemandAttributeVector(String key)
Returns the value of an attribute for each demand.
|
double |
getDemandCarriedTrafficInErlangs(int demandId)
Returns the carried traffic for a given demand.
|
double[] |
getDemandCarriedTrafficInErlangsVector()
Returns the carried traffic for each demand.
|
int |
getDemandEgressNode(int demandId)
Returns the identifier of the egress node of the demand.
|
int[] |
getDemandEgressNodeVector()
Returns the identifier of the egress node for every demand.
|
int |
getDemandIngressNode(int demandId)
Returns the identifier of the ingress node of the demand.
|
int[] |
getDemandIngressNodeVector()
Returns the identifier of the ingress node for every demand.
|
double |
getDemandOfferedTrafficInErlangs(int demandId)
Returns the offered traffic for a given demand.
|
double[] |
getDemandOfferedTrafficInErlangsVector()
Returns the offered traffic per demand vector.
|
int[] |
getDemandRoutes(int demandId)
Returns the routes which can carry traffic from a given demand.
|
Map<String,String> |
getDemandSpecificAttributes(int demandId)
Returns the attributes defined for a given demand.
|
int[][] |
getDemandTable()
Returns the Dx2 demand table, in which each row represent the ingress and egress node of that demand.
|
String |
getLinkAttribute(int linkId,
String key)
Returns the value of a given attribute for a link.
|
String[] |
getLinkAttributeVector(String key)
Returns the value of an attribute for each link.
|
double |
getLinkCapacityInErlangs(int linkId)
Returns the link capacity.
|
double[] |
getLinkCapacityInErlangsVector()
Returns the link capacity for each link.
|
double |
getLinkCapacityNotReservedForProtectionInErlangs(int linkId)
Returns the link capacity not reserved for protection.
|
double[] |
getLinkCapacityNotReservedForProtectionInErlangsVector()
Returns the link capacity not reserved for protection for each link.
|
double |
getLinkCapacityReservedForProtectionInErlangs(int linkId)
Returns the link capacity reserved for protection.
|
double[] |
getLinkCapacityReservedForProtectionInErlangsVector()
Returns the link capacity reserved for protection for each link.
|
double[] |
getLinkCarriedTrafficInErlangsVector()
Returns the carried traffic per link.
|
int |
getLinkDestinationNode(int linkId)
Returns the identifier of the destination node of the link.
|
double |
getLinkLengthInKm(int linkId)
Returns the length of the specified link.
|
double[] |
getLinkLengthInKmVector()
Returns the length for each link.
|
double |
getLinkMaximumUtilization()
Returns the maximum link utilization among all links.
|
double |
getLinkMaximumUtilizationWithoutConsiderReservedBandwidthForProtection()
Returns the maximum link utilization among all links, not including reserved bandwidth
for protection.
|
int |
getLinkOriginNode(int linkId)
Returns the identifier of the origin node of the link.
|
double |
getLinkPropagationDelayInSeconds(int linkId)
Returns the propagation delay in a given link.
|
double[] |
getLinkPropagationDelayInSecondsVector()
Returns the propagation delay for each link.
|
double[] |
getLinkSpareCapacityInErlangsVector()
Returns the capacity available for each link.
|
Map<String,String> |
getLinkSpecificAttributes(int linkId)
Returns the attributes of a given link.
|
int[][] |
getLinkTable()
Returns the Ex2 link table, in which each row represent the origin and destination node of that link.
|
int[] |
getLinkTraversingProtectionSegments(int linkId)
Returns the protection segments traversing a given link.
|
int[] |
getLinkTraversingRoutes(int linkId)
Returns the routes traversing a given link.
|
double |
getLinkUtilization(int linkId)
Returns the utilization of a given link, including the capacity reserved
for protection segments as a part of the carried traffic.
|
double[] |
getLinkUtilizationVector()
Returns the link utilization vector.
|
double |
getLinkUtilizationWithoutConsiderReservedBandwidthForProtection(int linkId)
Returns the utilization of a given link, not including the capacity reserved
for protection segments as a part of the carried traffic.
|
double[] |
getLinkUtilizationWithoutConsiderReservedBandwidthForProtectionVector()
Returns the link utilization vector, not including reserved bandwidth
for protection.
|
int[] |
getMergedBackupRoute(int[] currentPath,
int segmentId)
Returns the new route resulting from applying a protection segment.
|
int[] |
getMergedRoute(int[] originalRoute,
int[] partialRoute)
Returns a modified route resulting after applying a partial segment to
the original route.
|
String |
getNetworkAttribute(String key)
Returns the value of a network attribute.
|
Map<String,String> |
getNetworkAttributes()
Returns the network attributes.
|
String |
getNodeAttribute(int nodeId,
String key)
Returns the value of a given attribute for a node.
|
String[] |
getNodeAttributeVector(String key)
Returns the value of an attribute for each node.
|
double[] |
getNodeEgressTrafficInErlangsVector()
Returns the egress traffic per node.
|
int[] |
getNodeIncomingDemands(int nodeId)
Returns the demands ending in a given node.
|
int[] |
getNodeIncomingLinks(int nodeId)
Returns the links ending in a given node.
|
int[] |
getNodeIncomingRoutes(int nodeId)
Returns the routes ending in a given node.
|
double[] |
getNodeIngressTrafficInErlangsVector()
Returns the ingress traffic per node.
|
String |
getNodeName(int nodeId)
Returns the node name.
|
String[] |
getNodeNames(int[] nodeIds)
Returns the node name for a set of nodes.
|
String[] |
getNodeNameVector()
Returns the name for each node.
|
int[] |
getNodeOutgoingDemands(int nodeId)
Returns the demands starting from a given node.
|
int[] |
getNodeOutgoingLinks(int nodeId)
Returns the links starting from a given node.
|
int[] |
getNodeOutgoingRoutes(int nodeId)
Returns the links starting from a given node.
|
int[] |
getNodePairBidirectionalLinks(int node1,
int node2)
Returns links between two nodes (in both senses).
|
int[] |
getNodePairDemands(int ingressNode,
int egressNode)
Gets all the demands from a given ingress node to a given egress node.
|
int[] |
getNodePairLinks(int node1,
int node2)
Returns the links from a node to other one.
|
double |
getNodePairPhysicalDistance(int nodeId1,
int nodeId2)
Gets the physical distance between a node pair.
|
int[] |
getNodePairRoutes(int node1,
int node2)
Returns the routes going from a node to other one.
|
Map<String,String> |
getNodeSpecificAttributes(int nodeId) |
int[] |
getNodeTraversingLinks(int nodeId)
Gets all the links which has a given node as origin or destination.
|
int[] |
getNodeTraversingProtectionSegments(int nodeId)
Returns the protection segments traversing a given node.
|
int[] |
getNodeTraversingRoutes(int nodeId)
Returns the routes traversing a given node.
|
double[] |
getNodeTraversingTrafficInErlangsVector()
Returns the traversing traffic (no ingress, no egress) per node.
|
double[] |
getNodeXYPosition(int nodeId)
Returns the node position in a XY-plane.
|
double[][] |
getNodeXYPositionTable()
Returns the Nx2 node position table, in which each row represent the node position in a 2D plane.
|
int |
getNumberOfDemands()
Returns the number of traffic demands defined within the network.
|
int |
getNumberOfLinks()
Returns the number of unidirectional links defined within the network.
|
int |
getNumberOfNodes()
Returns the number of nodes defined within the network.
|
int |
getNumberOfProtectionSegments()
Returns the number of protection segments defined within the network.
|
int |
getNumberOfRoutes()
Returns the number of routes for traffic demands defined within the network.
|
double[][] |
getPhysicalDistanceMatrix()
Returns the NxN physical Euclidean-distance matrix, where N is the number of nodes within the network.
|
List<int[]> |
getProtectionSegmentAllSequenceOfLinks()
Returns the list with the sequence of links for each protection segment.
|
String |
getProtectionSegmentAttribute(int segmentId,
String key)
Returns the value of a given attribute for a protection segment.
|
String[] |
getProtectionSegmentAttributeVector(String key)
Returns the value of an attribute for each protection segment.
|
int |
getProtectionSegmentDestinationNode(int segmentId)
Returns the identifier of the destination node of the protection segment.
|
boolean |
getProtectionSegmentIsDedicated(int segmentId)
Checks whether or not a protection segment is dedicated.
|
boolean[] |
getProtectionSegmentIsDedicatedVector()
Returns a vector indicating whether or not a protection segment is dedicated.
|
double |
getProtectionSegmentLengthInKm(int segmentId)
Returns the length in kilometers for a given protection segment.
|
double[] |
getProtectionSegmentLengthInKmVector()
Returns the length in kilometers for each protection segment.
|
int |
getProtectionSegmentNumberOfHops(int segmentId)
Returns the number of hops for a given protection segment.
|
int[] |
getProtectionSegmentNumberOfHopsVector()
Returns the number of hops for each protection segment.
|
int |
getProtectionSegmentOriginNode(int segmentId)
Returns the identifier of the origin node of the protection segment.
|
double |
getProtectionSegmentPropagationDelayInSeconds(int segmentId)
Returns the propagation delay in a given protection segment.
|
double[] |
getProtectionSegmentPropagationDelayInSecondsVector()
Returns the propagation delay for each segment.
|
double |
getProtectionSegmentReservedBandwithInErlangs(int segmentId)
Returns the reserved bandwidth for a given protection segment.
|
double[] |
getProtectionSegmentReservedBandwithInErlangsVector()
Returns the reserved bandwidth for each protection segment.
|
int[] |
getProtectionSegmentRoutes(int segmentId)
Returns the routes which share a given protection segment.
|
int[] |
getProtectionSegmentSequenceOfLinks(int segmentId)
Returns the sequence of links traversed by a protection segment.
|
int[] |
getProtectionSegmentSequenceOfNodes(int segmentId)
Returns the sequence of nodes traversed by a protection segment.
|
Map<String,String> |
getProtectionSegmentSpecificAttributes(int segmentId)
Returns the attributes for a given protection segment.
|
List<int[]> |
getRouteAllSequenceOfLinks()
Returns the list with the sequence of links for each route.
|
String |
getRouteAttribute(int routeId,
String key)
Returns the value of a given attribute for a route.
|
String[] |
getRouteAttributeVector(String key)
Returns the value of an attribute for each route.
|
int[] |
getRouteBackupSegmentList(int routeId)
Returns the protection segments defined for a given route.
|
double[] |
getRouteCarriedTrafficFractionVector()
Returns the fraction of traffic (from the carried traffic of the
associated demand) which is carried by each route.
|
double |
getRouteCarriedTrafficInErlangs(int routeId)
Returns the carried traffic for a given route.
|
double[] |
getRouteCarriedTrafficInErlangsVector()
Returns the carried traffic for each route.
|
int |
getRouteDemand(int routeId)
Returns the associated demand for a given route.
|
int[] |
getRouteDemandVector()
Returns for each route its associated demand.
|
int |
getRouteEgressNode(int routeId)
Returns the identifier of the egress node of the route.
|
int |
getRouteIngressNode(int routeId)
Returns the identifier of the ingress node of the route.
|
double |
getRouteLengthInKm(int routeId)
Returns the length in kilometers for each route.
|
double[] |
getRouteLengthInKmVector()
Returns the length in kilometers for each route.
|
int |
getRouteNumberOfHops(int routeId)
Returns the number of hops for a given route.
|
int[] |
getRouteNumberOfHopsVector()
Returns the number of hops for each route.
|
double |
getRoutePropagationDelayInSeconds(int routeId)
Returns the propagation delay in a given route.
|
double[] |
getRoutePropagationDelayInSecondsVector()
Returns the propagation delay for each route.
|
int[] |
getRouteSequenceOfLinks(int routeId)
Returns the sequence of links traversed by a route.
|
int[] |
getRouteSequenceOfNodes(int routeId)
Returns the sequence of nodes traversed by a route.
|
Map<String,String> |
getRouteSpecificAttributes(int routeId)
Returns the attributes for a given route.
|
double[][] |
getTrafficMatrix()
Returns the traffic matrix.
|
boolean |
hasDemands()
Returns
true if the network has at least one traffic demand. |
boolean |
hasLinks()
Returns
true if the network has at least one unidirectional link. |
boolean |
hasNodes()
Returns
true if the network has at least one node. |
boolean |
hasProtectionSegments()
Returns
true if the network has at least one protection segment. |
boolean |
hasRoutes()
Returns
true if the network has at least one traffic route. |
boolean |
isEmpty()
Returns
true if the network is empty (no nodes/links/demands...). |
void |
removeAllDemands()
Removes all the demands defined within the network.
|
void |
removeAllLinks()
Removes all the links defined within the network.
|
void |
removeAllNodes()
Removes all the nodes defined within the network.
|
void |
removeAllProtectionSegments()
Removes all the protection segments defined within the network.
|
void |
removeAllRoutes()
Removes all the traffic routes defined within the network.
|
void |
removeDemand(int demandId)
Removes the demand identified by the given parameter.
|
void |
removeDemandAttribute(int demandId,
String key)
Removes a given attribute from a demand.
|
void |
removeDemands(int[] demandIds)
Removes a set of demands.
|
void |
removeLink(int linkId)
Removes the link identified by the given parameter.
|
void |
removeLinkAttribute(int linkId,
String key)
Removes a given attribute from a link.
|
void |
removeLinks(int[] linkIds)
Removes a set of links.
|
void |
removeNetworkAttribute(String key)
Removes a given attribute from the network.
|
void |
removeNode(int nodeId)
Removes the node identified by the given parameter.
|
void |
removeNodeAttribute(int nodeId,
String key)
Removes a given attribute from a node.
|
void |
removeNodes(int[] nodeIds)
Removes a set of nodes.
|
void |
removeProtectionSegment(int segmentId)
Removes the specified protection segment from the network.
|
void |
removeProtectionSegmentAttribute(int segmentId,
String key)
Removes a given attribute from a segment.
|
void |
removeProtectionSegmentFromRouteBackupSegmentList(int segmentId,
int routeId)
Removes a protection segment from the list of backup protection segments of a route.
|
void |
removeProtectionSegments(int[] segmentIds)
Removes a set of protection segments.
|
void |
removeRoute(int routeId)
Removes the traffic route identified by the given parameter.
|
void |
removeRouteAttribute(int routeId,
String key)
Removes a given attribute from a route.
|
void |
removeRoutes(int[] routeIds)
Removes a set of routes.
|
void |
reset()
Resets the network.
|
void |
saveToFile(File file)
Saves the current network plan to a given file.
|
void |
setDemandAttribute(int demandId,
String key,
String value)
Sets an attribute for a given demand.
|
void |
setDemandAttributes(int demandId,
Map<String,String> attributes)
Sets the attributes for a given demand.
|
void |
setDemandOfferedTrafficInErlangs(int demandId,
double offeredTrafficInErlangs)
Sets the offered traffic for a given demand.
|
void |
setDemandOfferedTrafficInErlangsVector(double[] offeredTrafficInErlangs)
Sets the offered traffic for each demand.
|
void |
setLinkAttribute(int linkId,
String key,
String value)
Sets an attribute for a given link.
|
void |
setLinkAttributes(int linkId,
Map<String,String> attributes)
Sets the attributes for a given link.
|
void |
setLinkCapacityInErlangs(int linkId,
double linkCapacity)
Sets the capacity of a link.
|
void |
setLinkLengthInKm(int linkId,
double linkLengthInKm)
Sets the length of a link.
|
void |
setNetworkAttribute(String key,
String value)
Sets an attribute for the network.
|
void |
setNetworkAttributes(Map<String,String> attributes)
Sets the network attributes.
|
void |
setNodeAttribute(int nodeId,
String key,
String value)
Sets an attribute for a given node.
|
void |
setNodeAttributes(int nodeId,
Map<String,String> attributes)
Sets the attributes for a given node.
|
void |
setNodeName(int nodeId,
String name)
Sets the node name.
|
void |
setNodeXYPosition(int nodeId,
double x,
double y)
Sets the node position.
|
void |
setProtectionSegmentAttribute(int segmentId,
String key,
String value)
Sets an attribute for a given protection segment.
|
void |
setProtectionSegmentAttributes(int segmentId,
Map<String,String> attributes)
Sets the attributes for a given protection segment.
|
void |
setProtectionSegmentReservedBandwidthInErlangs(int segmentId,
double reservedBandwidthInErlangs)
Sets the reserved bandwidth for a given protection segment.
|
void |
setRouteAttribute(int routeId,
String key,
String value)
Sets an attribute for a given route.
|
void |
setRouteAttributes(int routeId,
Map<String,String> attributes)
Sets the attributes for a given route.
|
void |
setRouteCarriedTrafficInErlangs(int routeId,
double carriedTrafficInErlangs)
Sets the carried traffic by a route.
|
void |
setTrafficMatrix(double[][] trafficMatrix)
Sets the traffic demands from a given traffic matrix, removing any previous
demand.
|
String |
toString()
Returns a String representation of the network plan.
|
NetPlan |
unmodifiableView()
Returns an unmodifiable view of the network design.
|
public NetPlan()
public NetPlan(File file)
file
- .n2p filepublic int getRouteIngressNode(int routeId)
routeId
- Route identifierpublic int getRouteEgressNode(int routeId)
routeId
- Route identifierpublic boolean isEmpty()
true
if the network is empty (no nodes/links/demands...). It is equivalent to !hasNodes()
.true
if the network is empty, and false
otherwisepublic void removeNodes(int[] nodeIds)
nodeIds
- Node identifiersUnsupportedOperationException
- If network plan is not modifiablepublic void removeLinks(int[] linkIds)
linkIds
- Link identifiersUnsupportedOperationException
- If network plan is not modifiablepublic void removeDemands(int[] demandIds)
demandIds
- Demand identifiersUnsupportedOperationException
- If network plan is not modifiablepublic void removeRoutes(int[] routeIds)
routeIds
- Route identifiersUnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegments(int[] segmentIds)
segmentIds
- Protection segment identifiersUnsupportedOperationException
- If network plan is not modifiablepublic int[] getNodePairRoutes(int node1, int node2)
node1
- Ingress nodenode2
- Egress nodepublic int[] getNodePairBidirectionalLinks(int node1, int node2)
node1
- Node 1node2
- Node 2public int[] getNodePairLinks(int node1, int node2)
node1
- Origin nodenode2
- Destination nodepublic List<int[]> getRouteAllSequenceOfLinks()
public List<int[]> getProtectionSegmentAllSequenceOfLinks()
public void setTrafficMatrix(double[][] trafficMatrix)
Sets the traffic demands from a given traffic matrix, removing any previous demand.
Important: If there are less nodes than those in the traffic matrix as nodes as needed will be added in position (0,0).
trafficMatrix
- Traffic matrixpublic double[][] getTrafficMatrix()
public boolean[] getProtectionSegmentIsDedicatedVector()
public boolean getProtectionSegmentIsDedicated(int segmentId)
segmentId
- Protection segment identifiertrue
if the protection segment is dedicated. Otherwise, false
public double getLinkUtilization(int linkId)
linkId
- Link identifierpublic double getLinkUtilizationWithoutConsiderReservedBandwidthForProtection(int linkId)
linkId
- Link identifierpublic int[] getMergedRoute(int[] originalRoute, int[] partialRoute)
originalRoute
- Sequence of links of the original routepartialRoute
- Sequence of links of the partial segmentpublic double getLinkMaximumUtilization()
public double getLinkMaximumUtilizationWithoutConsiderReservedBandwidthForProtection()
public double[] getLinkUtilizationVector()
public double[] getLinkUtilizationWithoutConsiderReservedBandwidthForProtectionVector()
public NetPlan unmodifiableView()
public int[] getNodePairDemands(int ingressNode, int egressNode)
ingressNode
- Ingress nodeegressNode
- Egress nodepublic double[] getLinkSpareCapacityInErlangsVector()
public double[] getLinkCarriedTrafficInErlangsVector()
public double getDemandCarriedTrafficInErlangs(int demandId)
demandId
- Demand identifierpublic double[] getDemandCarriedTrafficInErlangsVector()
public double[] getNodeEgressTrafficInErlangsVector()
public double[] getNodeIngressTrafficInErlangsVector()
public double[] getNodeTraversingTrafficInErlangsVector()
public void reset()
UnsupportedOperationException
- If network design is not modifiablepublic void removeAllLinks()
Removes all the links defined within the network.
Important: All the traffic routes and protection segments will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllNodes()
Removes all the nodes defined within the network.
Important: All the links, traffic demands, traffic routes and protection segments will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllProtectionSegments()
Removes all the protection segments defined within the network.
Important: All the list of protection segments from traffic routes will be cleared.
UnsupportedOperationException
- If network plan is not modifiablepublic double getNodePairPhysicalDistance(int nodeId1, int nodeId2)
nodeId1
- First nodenodeId2
- Second nodepublic int[] getNodeTraversingLinks(int nodeId)
nodeId
- Node identifierpublic void addDemandsFrom(NetPlan demands)
Adds to the current network plan the traffic demand set from other network plan.
Important: Any previous route will be removed.
demands
- Network plan containing a set of demandspublic NetPlan copy()
public int addDemand(int ingressNodeId, int egressNodeId, double offeredTrafficInErlangs, Map<String,String> attributes)
Adds a new traffic demand to the network.
Important: Self-demands are not allowed.
ingressNodeId
- Node identifier of the ingress node. It must be in range [0, N-1], where N is the number of nodes defined in the networkegressNodeId
- Node identifier of the egress node. It must be in range [0, N-1], where N is the number of nodes defined in the networkofferedTrafficInErlangs
- Offered traffic by this demand measured in Erlangs. It must be greater or equal than zeroattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic int addLink(int originNodeId, int destinationNodeId, double linkCapacityInErlangs, double linkLengthInKm, Map<String,String> attributes) throws UnsupportedOperationException
Adds a new link to the network.
Important: Self-links are not allowed.
originNodeId
- Node identifier of the link origin. It must be in range [0, N-1], where N is the number of nodes defined in the networkdestinationNodeId
- Node identifier of the link destination. It must be in range [0, N-1], where N is the number of nodes defined in the networklinkCapacityInErlangs
- Link capacity measured in Erlangs. It must be greater or equal than zerolinkLengthInKm
- Link length measured in Erlangs. It must be greater or equal than zero. Physical distance between node pairs can be obtained through the getPhysicalDistanceBetweenNodePair()
methodattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMapUnsupportedOperationException
- If network plan is not modifiablepublic int addNode(double x, double y, String name, Map<String,String> attributes)
x
- Node position in x-axisy
- Node position in y-axisname
- Node name. If null
, it will be assume to be "Node " + node identifierattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic void addRoutes(CandidatePathList cpl, double[] x_p, boolean includeUnusedRoutes)
cpl
- Candidate path listx_p
- Carried traffic per route in Erlangs. It must be greater or equal than zeroincludeUnusedRoutes
- Indicate whether routes carrying no traffic will be includedpublic int addRoute(int demandId, double carriedTrafficInErlangs, int[] sequenceOfLinks, int[] backupSegmentIds, Map<String,String> attributes)
demandId
- Demand identifiercarriedTrafficInErlangs
- Carried traffic by this route measured in Erlangs. It must be greater or equal than zerosequenceOfLinks
- Sequence of linksbackupSegmentIds
- Protection segment identifiers for this route. If null
, it will be assumed to be an empty arrayattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic double getProtectionSegmentPropagationDelayInSeconds(int segmentId)
segmentId
- Segment identifierpublic double[] getProtectionSegmentPropagationDelayInSecondsVector()
public double getRoutePropagationDelayInSeconds(int routeId)
routeId
- Route identifierpublic double[] getRoutePropagationDelayInSecondsVector()
public double getLinkPropagationDelayInSeconds(int linkId)
linkId
- Link identifierpublic double[] getLinkPropagationDelayInSecondsVector()
public void addProtectionSegmentToRouteBackupSegmentList(int segmentId, int routeId)
segmentId
- Segment identifierrouteId
- Route identifierpublic void setRouteCarriedTrafficInErlangs(int routeId, double carriedTrafficInErlangs)
routeId
- Route identifiercarriedTrafficInErlangs
- Carried traffic in Erlangspublic int addProtectionSegment(int[] sequenceOfLinks, double reservedBandwidthInErlangs, Map<String,String> attributes)
assignProtectionSegmentToRoute()
method must be used.sequenceOfLinks
- Sequence of linksreservedBandwidthInErlangs
- Reserved bandwidth in Erlangsattributes
- Map for user-defined attributes. The key (String value) in the map will be the attribute name and the value (String value) will be whatever value is stored in that attribute. If null
, it will be assumed to be an empty HashMappublic int[] getMergedBackupRoute(int[] currentPath, int segmentId)
currentPath
- Current sequence of linkssegmentId
- Protection segment identifierpublic String[] checkValidity(boolean forceLinkCapacityConstraint)
forceLinkCapacityConstraint
- true
if link capacity can be violated. Otherwise, false
public void checkRouteValidityForDemand(int[] sequenceOfLinksAndSegments, int demandId)
demandId
- Demand identifiersequenceOfLinksAndSegments
- Sequence of links and segmentspublic String getDemandAttribute(int demandId, String key)
null
value will be returneddemandId
- Demand identifierkey
- Attribute namepublic String[] getDemandAttributeVector(String key)
key
- Attribute namepublic Map<String,String> getDemandSpecificAttributes(int demandId)
demandId
- Demand identifierpublic int getDemandEgressNode(int demandId)
demandId
- Demand identifierpublic int[] getDemandEgressNodeVector()
public int getDemandIngressNode(int demandId)
demandId
- Demand identifierpublic int[] getDemandIngressNodeVector()
public double getDemandOfferedTrafficInErlangs(int demandId)
demandId
- Demand identifierpublic double[] getDemandOfferedTrafficInErlangsVector()
public int[][] getDemandTable()
public double[][] getPhysicalDistanceMatrix()
public String getLinkAttribute(int linkId, String key)
linkId
- Link identifierkey
- Attribute namepublic String[] getLinkAttributeVector(String key)
key
- Attribute namepublic Map<String,String> getLinkSpecificAttributes(int linkId)
linkId
- Link identifierpublic double getLinkCapacityInErlangs(int linkId)
linkId
- Link identifierpublic double getLinkCapacityReservedForProtectionInErlangs(int linkId)
linkId
- Link identifierpublic double[] getLinkCapacityReservedForProtectionInErlangsVector()
public double getLinkCapacityNotReservedForProtectionInErlangs(int linkId)
linkId
- Link identifierpublic double[] getLinkCapacityNotReservedForProtectionInErlangsVector()
public double[] getLinkCapacityInErlangsVector()
public int getLinkDestinationNode(int linkId)
linkId
- Link identifierpublic double getLinkLengthInKm(int linkId)
linkId
- Link identifierpublic double[] getLinkLengthInKmVector()
public int getLinkOriginNode(int linkId)
linkId
- Link identifierpublic int[][] getLinkTable()
public String getNetworkAttribute(String key)
key
- Attribute namepublic Map<String,String> getNetworkAttributes()
public String getNodeAttribute(int nodeId, String key)
nodeId
- Node identifierkey
- Attribute namepublic String[] getNodeAttributeVector(String key)
key
- Attribute namepublic Map<String,String> getNodeSpecificAttributes(int nodeId)
nodeId
- public int[] getNodeOutgoingRoutes(int nodeId)
nodeId
- Node identifierspublic int[] getNodeIncomingRoutes(int nodeId)
nodeId
- Node identifierspublic int[] getNodeIncomingDemands(int nodeId)
nodeId
- Node identifierspublic int[] getNodeIncomingLinks(int nodeId)
nodeId
- Node identifierspublic int[] getNodeOutgoingDemands(int nodeId)
nodeId
- Node identifierspublic String getNodeName(int nodeId)
nodeId
- Node identifierpublic String[] getNodeNames(int[] nodeIds)
nodeIds
- Node identifierspublic String[] getNodeNameVector()
public int[] getNodeOutgoingLinks(int nodeId)
nodeId
- Node identifierspublic double[] getNodeXYPosition(int nodeId)
nodeId
- Node identifierpublic double[][] getNodeXYPositionTable()
public int getNumberOfDemands()
public int getNumberOfLinks()
public int getNumberOfNodes()
public int getNumberOfRoutes()
public int getNumberOfProtectionSegments()
public String getRouteAttribute(int routeId, String key)
routeId
- Route identifierkey
- Attribute namepublic String[] getRouteAttributeVector(String key)
key
- Attribute namepublic Map<String,String> getRouteSpecificAttributes(int routeId)
routeId
- Route identifierpublic int[] getRouteBackupSegmentList(int routeId)
routeId
- Route identifierpublic int getRouteDemand(int routeId)
routeId
- Route identifierpublic int[] getRouteDemandVector()
public int[] getDemandRoutes(int demandId)
demandId
- Demand identifierpublic double getRouteCarriedTrafficInErlangs(int routeId)
routeId
- Route identifierpublic double getProtectionSegmentLengthInKm(int segmentId)
segmentId
- Protection segment identifierpublic double[] getProtectionSegmentLengthInKmVector()
public int getProtectionSegmentNumberOfHops(int segmentId)
segmentId
- Protection segment identifierpublic int[] getProtectionSegmentNumberOfHopsVector()
public double getRouteLengthInKm(int routeId)
routeId
- Route identifierpublic double[] getRouteLengthInKmVector()
public int getRouteNumberOfHops(int routeId)
routeId
- Route identifierpublic int[] getRouteNumberOfHopsVector()
public double[] getRouteCarriedTrafficFractionVector()
public double[] getRouteCarriedTrafficInErlangsVector()
public int[] getRouteSequenceOfLinks(int routeId)
routeId
- Route identifierpublic int[] getRouteSequenceOfNodes(int routeId)
routeId
- Route identifierpublic int[] getLinkTraversingRoutes(int linkId)
linkId
- Link identifierpublic String getProtectionSegmentAttribute(int segmentId, String key)
segmentId
- Protection segment identifierkey
- Attribute namepublic String[] getProtectionSegmentAttributeVector(String key)
key
- Attribute namepublic Map<String,String> getProtectionSegmentSpecificAttributes(int segmentId)
segmentId
- Segment identifierpublic int getProtectionSegmentDestinationNode(int segmentId)
segmentId
- Segment identifierpublic int getProtectionSegmentOriginNode(int segmentId)
segmentId
- Segment identifierpublic double getProtectionSegmentReservedBandwithInErlangs(int segmentId)
segmentId
- Protection segment identifierpublic double[] getProtectionSegmentReservedBandwithInErlangsVector()
public int[] getProtectionSegmentRoutes(int segmentId)
segmentId
- Protection segment identifierpublic int[] getProtectionSegmentSequenceOfLinks(int segmentId)
segmentId
- Protection segment identifierpublic int[] getProtectionSegmentSequenceOfNodes(int segmentId)
segmentId
- Protection segment identifierpublic int[] getLinkTraversingProtectionSegments(int linkId)
linkId
- Link identifierpublic int[] getNodeTraversingRoutes(int nodeId)
nodeId
- Node identifierpublic int[] getNodeTraversingProtectionSegments(int nodeId)
nodeId
- Node identifierpublic boolean hasDemands()
true
if the network has at least one traffic demand. It is equivalent to getNumberOfDemands()
> 0
.true
if there are traffic demands defined for the network, and false
otherwisepublic boolean hasLinks()
true
if the network has at least one unidirectional link. It is equivalent to getNumberOfLinks()
> 0
.true
if there are links within the network, and false
otherwisepublic boolean hasNodes()
true
if the network has at least one node. It is equivalent to getNumberOfNodes()
> 0
.true
if there are nodes within the network, and false
otherwisepublic boolean hasRoutes()
true
if the network has at least one traffic route. It is equivalent to getNumberOfRoutes()
> 0
.true
if there are routes defined for any traffic demand in the network, and false
otherwisepublic boolean hasProtectionSegments()
true
if the network has at least one protection segment. It is equivalent to getNumberOfProtectionSegments()
> 0
.true
if there are protection segments defined within the network, and false
otherwisepublic boolean checkProtectionSegmentMergeabilityToRoute(int routeId, int segmentId)
segmentId
- Segment identifierrouteId
- Route identifiertrue
is segment is applicable to route, false
otherwisepublic void removeAllDemands()
Removes all the demands defined within the network.
Important: All the traffic routes will be also removed.
UnsupportedOperationException
- If network plan is not modifiablepublic void removeAllRoutes()
UnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegmentFromRouteBackupSegmentList(int segmentId, int routeId)
segmentId
- Segment identifierrouteId
- Route identifierpublic void removeDemand(int demandId)
Removes the demand identified by the given parameter.
Important: Any route carrying traffic from that demand will be also removed.
demandId
- Identifier of the demand to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeDemandAttribute(int demandId, String key)
demandId
- Route identifierkey
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void removeLink(int linkId)
Removes the link identified by the given parameter.
Important: Any route or protection segment traversing that link will be also removed.
linkId
- Identifier of the link to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeLinkAttribute(int linkId, String key)
linkId
- Link identifierkey
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void removeNetworkAttribute(String key)
key
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void removeNode(int nodeId)
Removes the node identified by the given parameter.
Important: Any link or demand referring to that node will be also removed.
nodeId
- Identifier of the node to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeNodeAttribute(int nodeId, String key)
nodeId
- Node identifierkey
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void removeRoute(int routeId)
routeId
- Identifier of the route to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeRouteAttribute(int routeId, String key)
routeId
- Route identifierkey
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegment(int segmentId)
Removes the specified protection segment from the network.
Important: That segment will be removed from the list of protection segments of any associated route.
segmentId
- Identifier of the protection segment to be removedUnsupportedOperationException
- If network plan is not modifiablepublic void removeProtectionSegmentAttribute(int segmentId, String key)
segmentId
- Segment identifierkey
- Attribute nameUnsupportedOperationException
- If network plan is not modifiablepublic void saveToFile(File file)
file
- .n2p filepublic int[] convertBackupRoute2SequenceOfLinks(int[] sequenceOfLinksAndSegments)
sequenceOfLinksAndSegments
- Sequence of links and segmentspublic int[] convertSequenceOfLinks2SequenceOfNodes(int[] sequenceOfLinksAndSegments)
sequenceOfLinksAndSegments
- Sequence of links and segmentspublic void setDemandAttribute(int demandId, String key, String value)
demandId
- Demand identifierkey
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setDemandAttributes(int demandId, Map<String,String> attributes)
demandId
- Demand identifierattributes
- Map of attributesUnsupportedOperationException
- If network plan is not modifiablepublic void setDemandOfferedTrafficInErlangs(int demandId, double offeredTrafficInErlangs)
demandId
- Demand identifierofferedTrafficInErlangs
- Offered traffic in ErlangsUnsupportedOperationException
- If network plan is not modifiablepublic void setDemandOfferedTrafficInErlangsVector(double[] offeredTrafficInErlangs)
offeredTrafficInErlangs
- Offered traffic in ErlangsUnsupportedOperationException
- If network plan is not modifiablepublic void setLinkAttribute(int linkId, String key, String value)
linkId
- Link identifierkey
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setLinkAttributes(int linkId, Map<String,String> attributes)
linkId
- Link identifierattributes
- Map of attributesUnsupportedOperationException
- If network plan is not modifiablepublic void setLinkCapacityInErlangs(int linkId, double linkCapacity)
linkId
- Link identifierlinkCapacity
- Link capacity in ErlangsUnsupportedOperationException
- If network plan is not modifiablepublic void setLinkLengthInKm(int linkId, double linkLengthInKm)
linkId
- Link identifierlinkLengthInKm
- Link length measured in Erlangs. It must be greater or equal than zero. Physical distance between node pairs can be obtained through the getPhysicalDistanceBetweenNodePair()
methodUnsupportedOperationException
- If network plan is not modifiablepublic void setNetworkAttribute(String key, String value)
key
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setNetworkAttributes(Map<String,String> attributes)
attributes
- Map of attributesUnsupportedOperationException
- If network plan is not modifiablepublic void setNodeAttribute(int nodeId, String key, String value)
nodeId
- Node identifierkey
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setNodeAttributes(int nodeId, Map<String,String> attributes)
nodeId
- Node identifierattributes
- Map of attributesUnsupportedOperationException
- If network plan is not modifiablepublic void setNodeName(int nodeId, String name)
nodeId
- Node identifiername
- New nameUnsupportedOperationException
- If network plan is not modifiablepublic void setNodeXYPosition(int nodeId, double x, double y)
nodeId
- Node identifierx
- Node position in x-axisy
- Node position in y-axisUnsupportedOperationException
- If network plan is not modifiablepublic void setRouteAttribute(int routeId, String key, String value)
routeId
- Route identifierkey
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setRouteAttributes(int routeId, Map<String,String> attributes)
routeId
- Route identifierattributes
- Map of attributesUnsupportedOperationException
- If network plan is not modifiablepublic void setProtectionSegmentAttribute(int segmentId, String key, String value)
segmentId
- Protection segment identifierkey
- Attribute namevalue
- Attribute valueUnsupportedOperationException
- If network plan is not modifiablepublic void setProtectionSegmentAttributes(int segmentId, Map<String,String> attributes)
segmentId
- Protection segment identifierattributes
- Map of attributespublic void setProtectionSegmentReservedBandwidthInErlangs(int segmentId, double reservedBandwidthInErlangs)
segmentId
- Protection segment idreservedBandwidthInErlangs
- Reserved bandwidth in ErlangsUnsupportedOperationException
- If network plan is not modifiablepublic String toString()
toString
in class Object