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


Java Utils.getBandwidthDemand方法代码示例

本文整理汇总了Java中vnreal.algorithms.utils.SubgraphBasicVN.Utils.getBandwidthDemand方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getBandwidthDemand方法的具体用法?Java Utils.getBandwidthDemand怎么用?Java Utils.getBandwidthDemand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vnreal.algorithms.utils.SubgraphBasicVN.Utils的用法示例。


在下文中一共展示了Utils.getBandwidthDemand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sortVirtualLinks

import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
private Vector<VirtualLink> sortVirtualLinks(
		Vector<VirtualLink> linkVector) {
	for (int i = 0; i < linkVector.size(); i++) {
		for (int j = 0; j < linkVector.size(); j++) {
			if (Utils.getBandwidthDemand(linkVector.get(i)) > Utils
					.getBandwidthDemand(linkVector.get(j))) {
				VirtualLink tempLink = linkVector.get(i);
				linkVector.set(i, linkVector.get(j));
				linkVector.set(j, tempLink);
			}
		}
	}

	return linkVector;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:16,代码来源:DistributedNode.java

示例2: refreshInformation

import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
private boolean refreshInformation(VirtualNode hub,
		Vector<VirtualNode> spokes, Vector<DistanceEntry> pathList,
		Vector<SubstrateNode> subSpokes, Request request) {
	spokes = sortVirtualNodesAccordingToCapacity(spokes);

	// FIXME: changing the maximalBandwidth/CPUDemand to a more precise
	//value for each link/node could result in a better acceptRatio
	double maximalBandwidthDemand = Utils
			.getBandwidthDemand(findDirectPathInVirt(hub, spokes.get(0),
					request.getVirtualNetwork(), true));
	double maximalCPUDemand = Utils.getCpuDemand(spokes.get(0)).getDemandedCycles();

	// find the maximal needed bandwidth and cpu
	for (VirtualNode spoke : spokes) {
		if (maximalBandwidthDemand < Utils
				.getBandwidthDemand(findDirectPathInVirt(hub, spoke,
						request.getVirtualNetwork(), true))) {
			maximalBandwidthDemand = Utils
					.getBandwidthDemand(findDirectPathInVirt(hub, spoke,
							request.getVirtualNetwork(), true));
		}

		if (maximalCPUDemand < Utils.getCpuDemand(spoke).getDemandedCycles()) {
			maximalCPUDemand = Utils.getCpuDemand(spoke).getDemandedCycles();
		}
	}

	DistributedAlgorithm.bellmanFordAlgorithmus(maximalBandwidthDemand);

	for (SubstrateNode subNode : request
			.getSubNodesWithoutEmbeddedVirtNodes()) {
		if (Utils.getCpuAvailable(subNode) >= maximalCPUDemand
				&& shortestKnownPath.get(subNode.getId()) != null) {
			pathList.add(shortestKnownPath.get(subNode.getId()));
		}
	}

	// FIXME: a more intelligent selection of the hub could result
	//in a better acceptRatio
	if (pathList.size() < spokes.size()) {
		if (debug) {
			System.out
					.println("Hub-Knoten findet nicht genug Spokes-Knoten, "
							+ "die die Bandbreiten/CPU-Demands erfuellen! ("
							+ spokes.size()
							+ " Knoten mit Bandbreitenanbindung "
							+ maximalBandwidthDemand
							+ " und CPU "
							+ maximalCPUDemand + ")");
		}
		return false;
	}

	sortPathes(pathList);

	// get as many substrate nodes as we need for the virtual spoke nodes
	for (int x = 0; x < spokes.size(); x++) {
		if (pathList.get(x).getN2().getId() != this.getId()) {
			subSpokes.add(pathList.get(x).getN2());
		} else {
			subSpokes.add(pathList.get(x).getN1());
		}
	}

	sortSubNodesAccordingToCapacity(subSpokes);

	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:69,代码来源:DistributedNode.java


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