当前位置: 首页>>代码示例>>Java>>正文


Java NodeLinkAssignation.vlm方法代码示例

本文整理汇总了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;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:41,代码来源:BFSNRCoordinatedMapping.java

示例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;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:41,代码来源:BFSNRCoordinatedMapping.java

示例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;
 }
 
开发者ID:liruixpc11,项目名称:crucian,代码行数:79,代码来源:kShortestPathLinkMapping.java

示例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;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:79,代码来源:kShortestPathLinkMapping.java


注:本文中的vnreal.algorithms.utils.NodeLinkAssignation.vlm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。