public class Demand extends NetworkElement
This class contains a representation of a unicast demand. Unicast demands are defined by its initial and end node, the network layer they belong to,
and their offered traffic. When the routing in the network layer is the type SOURCE_ROUTING
, demands are carried
throgh Route
objects associated to them. If the routing type is HOP_BY_HOP_ROUTING
, the demand
traffic is carried by defining the forwarding rules (for each demand and link, fraction of the demand traffic from the link initial node, that is carried through it).
In multilayer design, a demand in a lower layer can be coupled to a link in the upper layer. Then, the demand carried traffic is equal to the upper layer link capacity (thus, upper link capacity and lower layer demand traffic must be measured in the same units).
Modifier and Type | Method and Description |
---|---|
Quadruple<DoubleMatrix2D,Constants.RoutingCycleType,Double,DoubleMatrix1D> |
computeRoutingFundamentalMatrixDemand()
Computes the fundamental matrix of the absorbing Markov chain in the current hop-by-hop routing, for the
given demand.
|
Pair<Set<Route>,Double> |
computeShortestPathRoutes(double[] costs)
Returns the set of demand routes with shortest path (and its cost), using the cost per link array provided.
|
Link |
coupleToNewLinkCreated(NetworkLayer newLinkLayer)
Creates a new link in the given layer with same end nodes, and couples it to this demand.
|
void |
coupleToUpperLayerLink(Link link)
Couples this demand to a link in an upper layer.
|
void |
decouple()
Decouples this demand from an other layer link.
|
Demand |
getBidirectionalPair()
If this demand was added using the method
addDemandBidirectional() ,
returns the demand in the other direction (if it was not previously removed). |
double |
getBlockedTraffic()
Returns the blocked traffic of the demand (offered minus carried, or 0 if carried is above offered).
|
double |
getCarriedTraffic()
Returns the carried traffic of the demand.
|
Link |
getCoupledLink()
Returns the link this demand is coupled to.
|
Node |
getEgressNode()
Returns the demand egress node.
|
Map<Pair<Demand,Link>,Double> |
getForwardingRules()
Returns the non zero forwarding rules as a map of pairs demand-link, and its associated splitting factor (between 0 and 1).
|
Node |
getIngressNode()
Returns the demand ingress node.
|
NetworkLayer |
getLayer()
Returns the
NetworkLayer object this element is attached to. |
double |
getOfferedTraffic()
Returns the offered traffic of the demand
|
Set<Route> |
getRoutes()
Returns the routes associated to this demand.
|
Constants.RoutingCycleType |
getRoutingCycleType()
Returns the routing cycle type of the demand, indicating if the traffic is routed in a loopless form, with open loops or with closed
loops (the latter can only happen in
HOP_BY_HOP_ROUTING routing). |
double |
getWorseCasePropagationTimeInMs()
Returns the worse case end-to-end propagation time of the demand traffic.
|
boolean |
isBifurcated()
If routing is
SOURCE_ROUTING , return true if more than one route is associated to this demand (routes down or with zero carried traffic also count). |
boolean |
isBlocked()
Returns
true if the carried traffic is strictly less than the offered traffic, up to the Net2Plan-wide precision factor. |
boolean |
isCoupled()
Returns
true if the demand is coupled to a link of an upper layer. |
boolean |
isTraversingOversubscribedLinks()
Returns
true if the traffic of the demand is traversing an oversubscribed link, false otherwise. |
void |
remove()
Removes a demand, and any associated routes or forwarding rules.
|
void |
removeAllForwardingRules()
Removes all forwarding rules associated to the demand.
|
void |
setOfferedTraffic(double offeredTraffic)
Sets the offered traffic by a demand.
|
String |
toString()
Returns a
String representation of the demand. |
checkAttachedToNetPlanObject, checkAttachedToNetPlanObject, equals, getAttribute, getAttributes, getId, getIndex, getNetPlan, removeAllAttributes, removeAttribute, setAttribute, setAttributeMap, wasRemoved
public Quadruple<DoubleMatrix2D,Constants.RoutingCycleType,Double,DoubleMatrix1D> computeRoutingFundamentalMatrixDemand()
Computes the fundamental matrix of the absorbing Markov chain in the current hop-by-hop routing, for the given demand.
Returns a Quadruple
object where:
Important: If the routing type is not HOP_BY_HOP_ROUTING
, an exception is thrown.
public Pair<Set<Route>,Double> computeShortestPathRoutes(double[] costs)
Returns the set of demand routes with shortest path (and its cost), using the cost per link array provided. If more than one shortest route exists, all of them are provided. If the cost vector provided is null, all links have cost one. If the route traverses a protection segment, the cost of its links is summed.
costs
- Costs for each linkDouble.MAX_VALUE
if there is no shortest path)public Link coupleToNewLinkCreated(NetworkLayer newLinkLayer)
Creates a new link in the given layer with same end nodes, and couples it to this demand.
newLinkLayer
- Layer where the link will be created.public void coupleToUpperLayerLink(Link link)
Couples this demand to a link in an upper layer. After the link is coupled, its capacity will be always equal to the demand carried traffic.
Important: The link and the demand must belong to different layers, have same end nodes, not be already coupled, and the traffic units of the demand must be the same as the capacity units of the link. Also, the coupling of layers cannot create a loop.
link
- Link to be coupledpublic void decouple()
Decouples this demand from an other layer link. Throws an exception if the demand is not currently coupled.
public Demand getBidirectionalPair()
If this demand was added using the method addDemandBidirectional()
,
returns the demand in the other direction (if it was not previously removed). Returns null otherwise.
addDemandBidirectional()
, or null
otherwiseNetPlan.addDemandBidirectional(Node, Node, double, Map, NetworkLayer...)
public double getBlockedTraffic()
Returns the blocked traffic of the demand (offered minus carried, or 0 if carried is above offered).
public double getCarriedTraffic()
Returns the carried traffic of the demand.
public Link getCoupledLink()
Returns the link this demand is coupled to.
null
if the demand is not coupledpublic Node getEgressNode()
Returns the demand egress node.
public Map<Pair<Demand,Link>,Double> getForwardingRules()
Returns the non zero forwarding rules as a map of pairs demand-link, and its associated splitting factor (between 0 and 1).
Important: If routing type is set to HOP_BY_HOP_ROUTING
an exception will be thrown.
public Node getIngressNode()
Returns the demand ingress node.
public NetworkLayer getLayer()
Returns the NetworkLayer
object this element is attached to.
public double getOfferedTraffic()
public Set<Route> getRoutes()
Returns the routes associated to this demand.
Important: If network layer routing type is not SOURCE_ROUTING
, an exception is thrown.
public Constants.RoutingCycleType getRoutingCycleType()
Returns the routing cycle type of the demand, indicating if the traffic is routed in a loopless form, with open loops or with closed
loops (the latter can only happen in HOP_BY_HOP_ROUTING
routing).
Constants.RoutingCycleType
public double getWorseCasePropagationTimeInMs()
Returns the worse case end-to-end propagation time of the demand traffic. If the routing is source routing, this is the worse propagation time
(summing the link latencies) for all the routes carrying traffic. If the routing is hop-by-hop and loopless, the paths followed are computed and
the worse case propagation time is returned. If the hop-by-hop routing has loops, Double.MAX_VALUE
is returned. In multilayer design, when the
traffic of a demand traverses a link that is coupled to a lower layer demand, the link latency taken is the worse case propagation time
of the underlying demand.
public boolean isBifurcated()
If routing is SOURCE_ROUTING
, return true
if more than one route is associated to this demand (routes down or with zero carried traffic also count).
If routing is HOP_BY_HOP_ROUTING
, return true
if a node sends traffic of the demand through more than one output link.
true
if bifurcated, false otherwisepublic boolean isBlocked()
Returns true
if the carried traffic is strictly less than the offered traffic, up to the Net2Plan-wide precision factor.
true
if blocked, false otherwiseConfiguration
public boolean isCoupled()
Returns true
if the demand is coupled to a link of an upper layer.
true
is coupled, false otherwisepublic boolean isTraversingOversubscribedLinks()
Returns true
if the traffic of the demand is traversing an oversubscribed link, false
otherwise.
true
if the traffic is traversing an oversubscribed link, false
otherwisepublic void remove()
Removes a demand, and any associated routes or forwarding rules.
public void removeAllForwardingRules()
Removes all forwarding rules associated to the demand.
Important: If routing type is not HOP_BY_HOP_ROUTING
and exception is thrown.
public void setOfferedTraffic(double offeredTraffic)
Sets the offered traffic by a demand. If routing type is HOP_BY_HOP_ROUTING
, the carried traffic for each link is updated according to the forwarding rules.
In SOURCE_ROUTING
, the routes carried traffic is not updated.
offeredTraffic
- The new offered traffic (must be non-negative)public String toString()
Returns a String
representation of the demand.
toString
in class NetworkElement
String
representation of the demand