public class CandidatePathList
extends Object
A candidate path list is an object containing a set of paths computed for each demand in the network. This object is commonly used for solving flow-path formulations. Each path is characterized by a demand and a sequence of traversed links (route). If more than one demand exists between two nodes, the same route appears in different paths, each for one demand. There are several forms of initializing a candidate path list, 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 in the constructor. There are several options to
configure, which can be combined:
computePaths
: Indicates whether or not paths should be computed (default: true)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)maxWeight
: Maximum path weight allowed (default: Double.MAX_VALUE)maxWeightFactorRespectToShortestPath
: Maximum path weight factor with respect to the shortest path weight (default: Double.MAX_VALUE)maxWeightRespectToShortestPath
: 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 factoruseRoutesWithinNetPlan
: Indicates whether or not existing routes are added to the candidate path list (default: false)weights
: Link weight vector (default: vector of 1s, which corresponds to a shortest path algorithm using number of hops as metric)Constructor and Description |
---|
CandidatePathList(File f)
Initializes the candidate path list, previously stored in a system file.
|
CandidatePathList(NetPlan netPlan,
long layerId,
Map<Long,Double> linkWeightMap,
String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each
demand.
|
CandidatePathList(NetPlan netPlan,
long layerId,
String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each
demand.
|
CandidatePathList(NetPlan netPlan,
Map<Long,Double> linkWeightMap,
String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each
demand.
|
CandidatePathList(NetPlan netPlan,
String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each
demand.
|
Modifier and Type | Method and Description |
---|---|
long |
addPath(long demandId,
List<Long> seqLinks)
Adds a new path to the path list.
|
Map<Long,Double> |
computeDemandCarriedTraffic(double[] x_p)
Computes the amount of traffic carried for each demand, if each path
carries the traffic given in x_p vector
|
Map<Long,Double> |
computeDemandShortestPathWeight(Map<Long,Double> linkWeightMap)
Returns the shortest path cost for every demand.
|
Map<Long,Double> |
computeLinkCarriedTrafficMap(double[] y_p)
Computes the amount of traffic in each link, if each path carries the
traffic given in x_p vector.
|
Map<Long,Double> |
computeLinkCarriedTrafficMap(Map<Long,Double> y_p)
Computes the amount of traffic in each link, if each path carries the
traffic given in x_p vector.
|
double[] |
computeLinkCarriedTrafficVector(double[] y_p)
Computes the amount of traffic in each link, if each path carries the
traffic given in x_p vector.
|
double[] |
computeLinkCarriedTrafficVector(Map<Long,Double> y_p)
Computes the amount of traffic in each link, if each path carries the
traffic given in y_p map.
|
Map<Long,Double> |
computePathMaximumCarriedTrafficMap(double[] h_d)
Computes for each path the maximum amount of traffic that is expected to
carry in case of non-bifurcated routing, that is, the offered traffic of
its corresponding demand.
|
Map<Long,Double> |
computePathMaximumCarriedTrafficMap(Map<Long,Double> h_d)
Computes for each path the maximum amount of traffic that is expected to
carry in case of non-bifurcated routing, that is, the offered traffic of
its corresponding demand.
|
double[] |
computePathMaximumCarriedTrafficVector(double[] h_d)
Computes for each path the maximum amount of traffic that is expected to
carry in case of non-bifurcated routing, that is, the offered traffic of
its corresponding demand.
|
double[] |
computePathMaximumCarriedTrafficVector(Map<Long,Double> h_d)
Computes for each path the maximum amount of traffic that is expected to
carry in case of non-bifurcated routing, that is, the offered traffic of
its corresponding demand.
|
cern.colt.matrix.tdouble.DoubleMatrix2D |
getDemand2LinkAssignmentMatrix()
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).
|
cern.colt.matrix.tdouble.DoubleMatrix2D |
getDemand2PathAssignmentMatrix()
Returns the demand-path incidence matrix (a DxP matrix in
which an element δdp is equal to 1 if traffic
route p is able to carry traffic from demand d).
|
Set<Long> |
getDemandPaths(long demandId)
Returns the set of identifiers of the paths that are associated to the
demand.
|
long[] |
getDemandPathsVector(long demandId)
Returns the array of identifiers of the paths that are associated to the
demand.
|
cern.colt.matrix.tdouble.DoubleMatrix2D |
getLink2PathAssignmentMatrix()
Returns the link-path incidence matrix (an ExP matrix in
which an element δep is equal to the number of
times which traffic route p traverses link e).
|
Set<Long> |
getLinkAssociatedPaths(long linkId)
Returns the set of identifiers of the paths that traverse a link.
|
long[] |
getLinkAssociatedPathsVector(long linkId)
Returns the array of identifiers of the paths that traverse a link.
|
Set<Long> |
getNodePairPaths(long ingressNodeId,
long egressNodeId)
Returns the set of identifiers of the paths that are associated to the
first demand of a node pair.
|
long[] |
getNodePairPathsVector(long ingressNodeId,
long egressNodeId)
Returns the array of identifiers of the paths that are associated to the
first demand of a node pair.
|
int |
getNumberOfPaths()
Returns the number of paths in the list.
|
List<List<Long>> |
getPathAllSequencesOfLinksList()
Returns the sequence of links for each path in ascending order of
path identifier.
|
Map<Long,List<Long>> |
getPathAllSequencesOfLinksMap()
Returns the sequence of links for each path.
|
double |
getPathCost(long pathId)
Returns the cost of a path, given a set of link weights.
|
double |
getPathCost(long pathId,
Map<Long,Double> linkWeightMap)
Returns the cost of a path, given a set of link weights.
|
Map<Long,Double> |
getPathCostMap()
Computes the weight of each path in the list, for the given weight of the
links.
|
Map<Long,Double> |
getPathCostMap(Map<Long,Double> linkWeightMap)
Computes the weight of each path in the list, for the given weight of the
links.
|
double[] |
getPathCostVector()
Computes the weight of each path in the list, for the given weight of the
links.
|
double[] |
getPathCostVector(Map<Long,Double> linkWeightMap)
Computes the weight of each path in the list, for the given weight of the
links.
|
long |
getPathDemand(long pathId)
Obtains the demand associated to the path.
|
List<Long> |
getPathDemandList()
Obtains the demand associated to each path in ascending order of path
identifiers.
|
Map<Long,Long> |
getPathDemandMap()
Obtains the demand associated to each path.
|
long[] |
getPathDemandVector()
Obtains a vector with the demand associated to each path.
|
Set<Long> |
getPathIds()
Returns the identifiers of the active paths.
|
long[] |
getPathIdsVector()
Returns the identifiers of the active paths.
|
long |
getPathNextId()
Returns the identifier of the next added path.
|
List<Long> |
getPathSequenceOfLinks(long pathId)
Returns the sequence of links associated to a path.
|
List<Long> |
getPathSequenceOfNodes(long pathId)
Obtains the sequence of nodes of the given path.
|
boolean |
isPathActive(long pathId)
Indicates whether a path is active.
|
boolean |
linkBelongsToPath(long linkId,
long pathId)
Checks whether a link belongs to a path.
|
void |
removePath(long pathId)
Removes a path from the candidate path list.
|
void |
removePaths(Set<Long> pathIds)
Removes a set of paths from the candidate path list.
|
void |
saveToFile(File f)
Saves the current candidate path list to a given file for further usage.
|
String |
toString()
A formatted
String describing the paths in the list, their
associated demands and sequence of links. |
public CandidatePathList(File f)
f
- File containing a previously computed CandidatePathList
public CandidatePathList(NetPlan netPlan, long layerId, Map<Long,Double> linkWeightMap, String... paramValuePairs)
netPlan
- The network plan, containing at least the nodes, links and demands in the network. Routes already defined will be ommittedlayerId
- Layer identifierlinkWeightMap
- Link weight for the shortest path algorithm (null means 'all-one' map)paramValuePairs
- 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 CandidatePathList(NetPlan netPlan, long layerId, String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each demand. A candidate path list is an object containing a set of paths computed for each demand in the network. This object is commonly used for solving flow-path formulations. Each path is characterized by a demand and a sequence of traversed links (route). If more than one demand exists between two nodes, one path per demand is created, even though they follow the same route.
There are several forms of initializing a candidate path list, 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.
Here, all link weights are initialized to 1, meaning that shortest path will be computed according to the number of hops.
netPlan
- The network plan, containing at least the nodes, links and demands in the network. Routes already defined will be ommittedlayerId
- Layer identifierparamValuePairs
- 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 CandidatePathList(NetPlan netPlan, Map<Long,Double> linkWeightMap, String... paramValuePairs)
netPlan
- The network plan, containing at least the nodes, links and demands in the network. Routes already defined will be ommittedlinkWeightMap
- Link weight for the shortest path algorithm (null means 'all-one' map)paramValuePairs
- 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 CandidatePathList(NetPlan netPlan, String... paramValuePairs)
Initializes the candidate path list, computing all the paths for each demand. A candidate path list is an object containing a set of paths computed for each demand in the network. This object is commonly used for solving flow-path formulations. Each path is characterized by a demand and a sequence of traversed links (route). If more than one demand exists between two nodes, one path per demand is created, even though they follow the same route.
There are several forms of initializing a candidate path list, 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.
Here, all link weights are initialized to 1, meaning that shortest path will be computed according to the number of hops.
netPlan
- The network plan, containing at least the nodes, links and demands in the network. Routes already defined will be ommittedparamValuePairs
- 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 long addPath(long demandId, List<Long> seqLinks)
demandId
- Demand identifierseqLinks
- Sequence of traversed linkspublic Map<Long,Double> computeDemandCarriedTraffic(double[] x_p)
x_p
- The traffic carried by each path in the listpublic Map<Long,Double> computeDemandShortestPathWeight(Map<Long,Double> linkWeightMap)
linkWeightMap
- Link weightspublic Map<Long,Double> computeLinkCarriedTrafficMap(double[] y_p)
y_p
- Capacity units occupied by each pathpublic Map<Long,Double> computeLinkCarriedTrafficMap(Map<Long,Double> y_p)
y_p
- Capacity units occupied by each pathpublic double[] computeLinkCarriedTrafficVector(double[] y_p)
y_p
- Capacity units occupied by each pathpublic double[] computeLinkCarriedTrafficVector(Map<Long,Double> y_p)
y_p
- Capacity units occupied by each pathpublic Map<Long,Double> computePathMaximumCarriedTrafficMap(double[] h_d)
h_d
- Offered traffic per demandpublic Map<Long,Double> computePathMaximumCarriedTrafficMap(Map<Long,Double> h_d)
h_d
- Offered traffic per demandpublic double[] computePathMaximumCarriedTrafficVector(double[] h_d)
h_d
- Offered traffic per demandpublic double[] computePathMaximumCarriedTrafficVector(Map<Long,Double> h_d)
h_d
- Offered traffic per demandpublic cern.colt.matrix.tdouble.DoubleMatrix2D getDemand2LinkAssignmentMatrix()
public cern.colt.matrix.tdouble.DoubleMatrix2D getDemand2PathAssignmentMatrix()
public Set<Long> getDemandPaths(long demandId)
demandId
- Demand identifierpublic long[] getDemandPathsVector(long demandId)
demandId
- Demand identifierpublic cern.colt.matrix.tdouble.DoubleMatrix2D getLink2PathAssignmentMatrix()
public Set<Long> getLinkAssociatedPaths(long linkId)
linkId
- Link identifierpublic long[] getLinkAssociatedPathsVector(long linkId)
linkId
- Link identifierpublic Set<Long> getNodePairPaths(long ingressNodeId, long egressNodeId)
ingressNodeId
- Ingress node identifieregressNodeId
- Ingress node identifierpublic long[] getNodePairPathsVector(long ingressNodeId, long egressNodeId)
ingressNodeId
- Ingress node identifieregressNodeId
- Ingress node identifierpublic int getNumberOfPaths()
public List<List<Long>> getPathAllSequencesOfLinksList()
public Map<Long,List<Long>> getPathAllSequencesOfLinksMap()
public double getPathCost(long pathId)
pathId
- Path identifierpublic double getPathCost(long pathId, Map<Long,Double> linkWeightMap)
pathId
- Path identifierlinkWeightMap
- Link weightspublic Map<Long,Double> getPathCostMap()
public Map<Long,Double> getPathCostMap(Map<Long,Double> linkWeightMap)
linkWeightMap
- The set of weight per linkpublic double[] getPathCostVector()
public double[] getPathCostVector(Map<Long,Double> linkWeightMap)
linkWeightMap
- The set of weight per linkpublic long getPathDemand(long pathId)
pathId
- Path identifierpublic List<Long> getPathDemandList()
public Map<Long,Long> getPathDemandMap()
public long[] getPathDemandVector()
public Set<Long> getPathIds()
public long[] getPathIdsVector()
public long getPathNextId()
public List<Long> getPathSequenceOfLinks(long pathId)
pathId
- Path identifierpublic List<Long> getPathSequenceOfNodes(long pathId)
pathId
- Path identifierpublic boolean isPathActive(long pathId)
pathId
- Path identifiertrue
in case the path is active. Otherwise, false
public boolean linkBelongsToPath(long linkId, long pathId)
linkId
- Link identifierpathId
- Path identifiertrue
if link e
belongs to path p
. Otherwise, false
.public void removePath(long pathId)
pathId
- Path identifierpublic void removePaths(Set<Long> pathIds)
pathIds
- Path identifierspublic void saveToFile(File f)
f
- Output filepublic String toString()
String
describing the paths in the list, their
associated demands and sequence of links.toString
in class Object