本文整理汇总了Java中vnreal.algorithms.utils.NodeLinkAssignation.vlm方法的典型用法代码示例。如果您正苦于以下问题:Java NodeLinkAssignation.vlm方法的具体用法?Java NodeLinkAssignation.vlm怎么用?Java NodeLinkAssignation.vlm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.algorithms.utils.NodeLinkAssignation
的用法示例。
在下文中一共展示了NodeLinkAssignation.vlm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}