本文整理汇总了Java中vnreal.algorithms.utils.NodeLinkAssignation.verifyPath方法的典型用法代码示例。如果您正苦于以下问题:Java NodeLinkAssignation.verifyPath方法的具体用法?Java NodeLinkAssignation.verifyPath怎么用?Java NodeLinkAssignation.verifyPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.algorithms.utils.NodeLinkAssignation
的用法示例。
在下文中一共展示了NodeLinkAssignation.verifyPath方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: greatest
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
*
* @param srcSNode
* Source substrate node of the substrate path
* @param candidatePaths
* set of candidate paths
* @param demBW
* Bandwidth demanded by the virtual link being processed
* @param vl
* virtual link
* @return the position of the great value of a set of paths. The method
* returns null if no path accomplishes the demands.
*/
private List<SubstrateLink> greatest(SubstrateNetwork sNet, SubstrateNode srcSNode,
Map<List<SubstrateLink>, Double> candidatePaths, VirtualLink vl) {
double greater = 0;
List<SubstrateLink> tmpPath;
List<SubstrateLink> greaterPath = null;
for (Iterator<List<SubstrateLink>> it = candidatePaths.keySet()
.iterator(); it.hasNext();) {
tmpPath = it.next();
if (candidatePaths.get(tmpPath) > greater
&& NodeLinkAssignation.verifyPath(vl, tmpPath, srcSNode,
sNet)) {
greater = candidatePaths.get(tmpPath);
greaterPath = tmpPath;
}
}
return greaterPath;
}
示例2: greatest
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
*
* @param srcSNode
* Source substrate node of the substrate path
* @param candidatePaths
* set of candidate paths
* @param demBW
* Bandwidth demanded by the virtual link being processed
* @param vl
* virtual link
* @return the position of the great value of a set of paths. The method
* returns null if no path accomplishes the demands.
*/
private List<SubstrateLink> greatest(SubstrateNode srcSNode,
Map<List<SubstrateLink>, Double> candidatePaths, VirtualLink vl) {
double greater = 0;
List<SubstrateLink> tmpPath;
List<SubstrateLink> greaterPath = null;
for (Iterator<List<SubstrateLink>> it = candidatePaths.keySet()
.iterator(); it.hasNext();) {
tmpPath = it.next();
if (candidatePaths.get(tmpPath) > greater
&& NodeLinkAssignation.verifyPath(vl, tmpPath, srcSNode,
sNet)) {
greater = candidatePaths.get(tmpPath);
greaterPath = tmpPath;
}
}
return greaterPath;
}
示例3: performLinkMapping
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
private boolean performLinkMapping(SubstrateNetwork sNet, SubstrateNode srcSnode,
SubstrateNode dstSnode, VirtualLink vLink) {
// Search for path in filtered substrate using
// KShortestPaths
LinkWeight linkWeight = new LinkWeight();
Yen<SubstrateNode, SubstrateLink> kshortestPaths = new Yen<SubstrateNode, SubstrateLink>(sNet,
linkWeight);
// get the k shortest paths to the dstSnode in
// increasing order of weight
List<List<SubstrateLink>> paths = kshortestPaths.getShortestPaths(
srcSnode, dstSnode, 20);
List<SubstrateLink> mappedPath = null;
for (List<SubstrateLink> path : paths) {
// Verify if the path fulfills the demand
if (NodeLinkAssignation.verifyPath(vLink, path, srcSnode, sNet)) {
// If the path has been verified, the path is
// chosen if not,
// the following shortest path is verified
mappedPath = path;
break;
}
}
paths.clear();
// if a path fulfilling the demand has been chosen, link
// mapping is performed
if (mappedPath != null) {
// Perform virtual link mapping (VLM) for each link in
// the path.
if (!NodeLinkAssignation.vlm(vLink, mappedPath, sNet, srcSnode)) {
throw new AssertionError("But we checked before!");
}
} else {// Not path available, link mapping can not be
// performed
return false;
}
return true;
}
示例4: performLinkMapping
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
private boolean performLinkMapping(SubstrateNode srcSnode,
SubstrateNode dstSnode, VirtualLink vLink) {
// Search for path in filtered substrate using
// KShortestPaths
LinkWeight linkWeight = new LinkWeight();
EppsteinAlgorithm kshortestPaths = new EppsteinAlgorithm(sNet,
linkWeight);
// get the k shortest paths to the dstSnode in
// increasing order of weight
List<List<SubstrateLink>> paths = kshortestPaths.getShortestPaths(
srcSnode, dstSnode, 20);
List<SubstrateLink> mappedPath = null;
for (List<SubstrateLink> path : paths) {
// Verify if the path fulfills the demand
if (NodeLinkAssignation.verifyPath(vLink, path, srcSnode, sNet)) {
// If the path has been verified, the path is
// chosen if not,
// the following shortest path is verified
mappedPath = path;
break;
}
}
paths.clear();
// if a path fulfilling the demand has been chosen, link
// mapping is performed
if (mappedPath != null) {
// Perform virtual link mapping (VLM) for each link in
// the path.
if (!NodeLinkAssignation.vlm(vLink, mappedPath, sNet, srcSnode)) {
throw new AssertionError("But we checked before!");
}
} else {// Not path available, link mapping can not be
// performed
return false;
}
return true;
}
示例5: randomizedElection
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
*
* @param srcSNode
* Source substrate node of the substrate path
* @param candidatePaths
* set of candidate paths
* @param demBW
* Bandwidth demanded by the virtual link being processed
* @param vl
* virtual link
* @return a path with a probability equal to its weight (accumulated flow).
* The method returns null if no path accomplishes the demands
*/
private List<SubstrateLink> randomizedElection(SubstrateNetwork sNet, SubstrateNode srcSNode,
Map<List<SubstrateLink>, Double> candidatePaths, VirtualLink vl) {
double spareWeight = 0, newWeight;
boolean isCandidate = true;
List<SubstrateLink> greaterPath = null;
List<SubstrateLink> tmpPath;
List<SubstrateLink> tempCandiSPath;
tempCandiSPath = discrete(candidatePaths);
if (NodeLinkAssignation.verifyPath(vl, tempCandiSPath, srcSNode, sNet)) {
greaterPath = tempCandiSPath;
} else {
while (isCandidate) {
spareWeight = 0;
candidatePaths.put(tempCandiSPath, 0.0);
for (Iterator<List<SubstrateLink>> it = candidatePaths.keySet()
.iterator(); it.hasNext();) {
tmpPath = it.next();
spareWeight += candidatePaths.get(tmpPath);
}
if (spareWeight != 0) {
for (Iterator<List<SubstrateLink>> it = candidatePaths
.keySet().iterator(); it.hasNext();) {
tmpPath = it.next();
newWeight = candidatePaths.get(tmpPath) / spareWeight;
candidatePaths.put(tmpPath, newWeight);
}
}
tempCandiSPath = discrete(candidatePaths);
if (tempCandiSPath != null
&& NodeLinkAssignation.verifyPath(vl, tempCandiSPath,
srcSNode, sNet)) {
greaterPath = tempCandiSPath;
isCandidate = false;
}
if (isEmpty(candidatePaths)) {
isCandidate = false;
}
}
}
return greaterPath;
}
示例6: linkMapping
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
* Algorithm with the k-Shortest path implementation of virtual link mapping
* (hops is taken as the metric)
*/
@Override
protected boolean linkMapping(VirtualNetwork vNet,
Map<VirtualNode, SubstrateNode> nodeMapping) {
this.processedLinks = 0;
this.mappedLinks = 0;
// Search for path in filtered substrate using KShortestPaths
LinkWeight linkWeight = new LinkWeight();
EppsteinAlgorithm kshortestPaths = new EppsteinAlgorithm(sNet,
linkWeight);
// Iterate all VirtualLinks on the current VirtualNetwork
for (VirtualLink tVLink : vNet.getEdges()) {
processedLinks++; // increase number of processed.
// Find the source and destiny of the current VirtualLink (tmpl)
VirtualNode srcVnode = vNet.getSource(tVLink);
VirtualNode dstVnode = vNet.getDest(tVLink);
// Find their mapped SubstrateNodes
final SubstrateNode sNode = nodeMapping.get(srcVnode);
final SubstrateNode dNode = nodeMapping.get(dstVnode);
// Get current VirtualLink demand
for (AbstractDemand dem : tVLink) {
if (dem instanceof BandwidthDemand) {
// System.out.println(" DemandedBandwidth: "
// + bwDem.getDemandedBandwidth());
}
}
// get the k shortest paths to the dstSnode in increasing order of
// weight
List<List<SubstrateLink>> paths = kshortestPaths.getShortestPaths(
sNode, dNode, k);
int ind2 = 0;
/*
* If source and destination substrate node are different, in any
* other case, the virtual link demand will not be mapped because
* the link is created between the same node.
*/
if (!sNode.equals(dNode)) {
for (List<SubstrateLink> path : paths) {
// Verify if the path fulfills the demand
if (!NodeLinkAssignation.verifyPath(tVLink, path, sNode,
sNet)) {
// Current path cannot fulfill the VirtualLink or the
// Hidden Hop Demand... Lets check another
ind2 = 1;
} else {
// Perform virtual link mapping (VLM) for each link in
// the path.
if (!NodeLinkAssignation.vlm(tVLink, path, sNet, sNode))
throw new AssertionError("But we checked before!");
mappedLinks++;
ind2 = 0;
break;
}
}
// if there are no paths fulfilling the demand.
if (ind2 == 1) {
processedLinks = vNet.getEdges().size();
return false;
}
} else {
// FIXME Hidden hops demand will be applied?
}
}
return true;
}
示例7: linkMapping
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
* Algorithm with the k-Shortest path implementation of virtual link mapping
* (hops is taken as the metric)
*/
@Override
protected boolean linkMapping(VirtualNetwork vNet,
Map<VirtualNode, SubstrateNode> nodeMapping) {
this.processedLinks = 0;
this.mappedLinks = 0;
// Search for path in filtered substrate using KShortestPaths
LinkWeight linkWeight = new LinkWeight();
EppsteinAlgorithm kshortestPaths = new EppsteinAlgorithm(sNet,
linkWeight);
// Iterate all VirtualLinks on the current VirtualNetwork
for (VirtualLink tVLink : vNet.getEdges()) {
processedLinks++; // increase number of processed.
// Find the source and destiny of the current VirtualLink (tmpl)
VirtualNode srcVnode = vNet.getSource(tVLink);
VirtualNode dstVnode = vNet.getDest(tVLink);
// Find their mapped SubstrateNodes
final SubstrateNode sNode = nodeMapping.get(srcVnode);
final SubstrateNode dNode = nodeMapping.get(dstVnode);
// Get current VirtualLink demand
for (AbstractDemand dem : tVLink) {
if (dem instanceof BandwidthDemand) {
// System.out.println(" DemandedBandwidth: "
// + bwDem.getDemandedBandwidth());
}
}
// get the k shortest paths to the dstSnode in increasing order of
// weight
List<List<SubstrateLink>> paths = kshortestPaths.getShortestPaths(
sNode, dNode, k);
int ind2 = 0;
/*
* If source and destination substrate node are different, in any
* other case, the virtual link demand will not be mapped because
* the link is created between the same node.
*/
if (!sNode.equals(dNode)) {
for (List<SubstrateLink> path : paths) {
// Verify if the path fulfills the demand
if (!NodeLinkAssignation.verifyPath(tVLink, path, sNode,
sNet)) {
// Current path cannot fulfill the VirtualLink or the
// Hidden Hop Demand... Lets check another
ind2 = 1;
} else {
// Perform virtual link mapping (VLM) for each link in
// the path.
if (!NodeLinkAssignation.vlm(tVLink, path, sNet, sNode))
throw new AssertionError("But we checked before!");
mappedLinks++;
ind2 = 0;
break;
}
}
// if there are no paths fulfilling the demand.
if (ind2 == 1) {
processedLinks = vNet.getEdges().size();
return false;
}
} else {
// FIXME Hidden hops demand will be applied?
}
}
return true;
}
示例8: randomizedElection
import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
*
* @param srcSNode
* Source substrate node of the substrate path
* @param candidatePaths
* set of candidate paths
* @param demBW
* Bandwidth demanded by the virtual link being processed
* @param vl
* virtual link
* @return a path with a probability equal to its weight (accumulated flow).
* The method returns null if no path accomplishes the demands
*/
private List<SubstrateLink> randomizedElection(SubstrateNode srcSNode,
Map<List<SubstrateLink>, Double> candidatePaths, VirtualLink vl) {
double spareWeight = 0, newWeight;
boolean isCandidate = true;
List<SubstrateLink> greaterPath = null;
List<SubstrateLink> tmpPath;
List<SubstrateLink> tempCandiSPath;
tempCandiSPath = discrete(candidatePaths);
if (NodeLinkAssignation.verifyPath(vl, tempCandiSPath, srcSNode, sNet)) {
greaterPath = tempCandiSPath;
} else {
while (isCandidate) {
spareWeight = 0;
candidatePaths.put(tempCandiSPath, 0.0);
for (Iterator<List<SubstrateLink>> it = candidatePaths.keySet()
.iterator(); it.hasNext();) {
tmpPath = it.next();
spareWeight += candidatePaths.get(tmpPath);
}
if (spareWeight != 0) {
for (Iterator<List<SubstrateLink>> it = candidatePaths
.keySet().iterator(); it.hasNext();) {
tmpPath = it.next();
newWeight = candidatePaths.get(tmpPath) / spareWeight;
candidatePaths.put(tmpPath, newWeight);
}
}
tempCandiSPath = discrete(candidatePaths);
if (tempCandiSPath != null
&& NodeLinkAssignation.verifyPath(vl, tempCandiSPath,
srcSNode, sNet)) {
greaterPath = tempCandiSPath;
isCandidate = false;
}
if (isEmpty(candidatePaths)) {
isCandidate = false;
}
}
}
return greaterPath;
}