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


Java NodeLinkAssignation.isMappable方法代码示例

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


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

示例1: analyze

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
 * This method creates the candidates list
 * 
 * @return true if everything is ok, false if there is one node without a candidate
 */
private boolean analyze(VirtualNetwork vNet) {
	//Walk through any vNode and check the substrate for fitting nodes
	for(VirtualNode vn : vNet.getVertices()) {
		ArrayList<SubstrateNode> tmpCandidates = new ArrayList<SubstrateNode>();
		for(SubstrateNode sn : sNet.getVertices()) {
			if(NodeLinkAssignation.isMappable(vn, sn)) {
				tmpCandidates.add(sn);
			}
		}
		
		//Check if the list is empty
		if(tmpCandidates.isEmpty()) {
			System.out.println("Fail(Analyze): "+vn.getName()+":"+MLSUtils.getMLSDemand(vn).toString());
			count_abort_analyze++;
			return false; //then  no candiates for this node
		}
		
		//Add the list to our global list
		candidates.put(vn, tmpCandidates);
	}
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:28,代码来源:MlsNodeMapping_BestFit.java

示例2: analyze

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
 * This method creates the candidates list
 * 
 * @return true if everything is ok, false if there is one node without a candidate
 */
private boolean analyze(VirtualNetwork vNet) {
	//Walk through any vNode and check the substrate for fitting nodes
	for(VirtualNode vn : vNet.getVertices()) {
		ArrayList<SubstrateNode> tmpCandidates = new ArrayList<SubstrateNode>();
		for(SubstrateNode sn : super.sNet.getVertices()) {
			if(NodeLinkAssignation.isMappable(vn, sn)) {
				tmpCandidates.add(sn);
			}
		}
		
		//Check if the list is empty
		if(tmpCandidates.isEmpty()) {
			System.out.println("Fail(Analyze): "+vn.getName()+":"+MLSUtils.getMLSDemand(vn).toString());
			count_abort_analyze++;
			return false; //then  no candiates for this node
		}
		
		//Add the list to our global list
		candidates.put(vn, tmpCandidates);
	}
	return true;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:28,代码来源:MlsNodeMapping_BestFit.java

示例3: findCandidates

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
 * Returns a list of possible Candidates for this Node
 * @param vn {@link VirtualNode}
 * @param flexibility if Levelflexibility should be used
 * @return {@link ArrayList} of {@link SubstrateNode}
 */
private ArrayList<SubstrateNode> findCandidates(SubstrateNetwork sNet, VirtualNode vn, boolean flexibility) {
	ArrayList<SubstrateNode> tmpCandidates = new ArrayList<SubstrateNode>();
	//If flexibility is wanted decrement the level, only allow one decrement per node
	if(flexibility && !flexNodes.contains(vn)) {
		//decrement the demanded Security
		MLSDemand dem = MLSUtils.getMLSDemand(vn);
		int demLevel = dem.getDemand();
		
		//If the level is 0, stop, we can't decrement it
		if(demLevel != 0) {
			demLevel--;
			//set the new Level to the MLSDemand
			dem.setDemand(demLevel);
			//System.out.println("Set: "+demLevel);
			flexNodes.add(vn);	//mark the node as flexible
		}
	}
	
	for(SubstrateNode sn : sNet.getVertices()) {
		if(NodeLinkAssignation.isMappable(vn, sn) && isAvailable(sn)) {
			tmpCandidates.add(sn);
		}
	}
	
	
	return tmpCandidates;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:34,代码来源:MlsNodeMapping_BestFit_Lower.java

示例4: findCandidates

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
/**
 * Returns a list of possible Candidates for this Node
 * @param vn {@link VirtualNode}
 * @param flexibility if Levelflexibility should be used
 * @return {@link ArrayList} of {@link SubstrateNode}
 */
private ArrayList<SubstrateNode> findCandidates(VirtualNode vn, boolean flexibility) {
	ArrayList<SubstrateNode> tmpCandidates = new ArrayList<SubstrateNode>();
	//If flexibility is wanted decrement the level, only allow one decrement per node
	if(flexibility && !flexNodes.contains(vn)) {
		//decrement the demanded Security
		MLSDemand dem = MLSUtils.getMLSDemand(vn);
		int demLevel = dem.getDemand();
		
		//If the level is 0, stop, we can't decrement it
		if(demLevel != 0) {
			demLevel--;
			//set the new Level to the MLSDemand
			dem.setDemand(demLevel);
			//System.out.println("Set: "+demLevel);
			flexNodes.add(vn);	//mark the node as flexible
		}
	}
	
	for(SubstrateNode sn : super.sNet.getVertices()) {
		if(NodeLinkAssignation.isMappable(vn, sn) && isAvailable(sn)) {
			tmpCandidates.add(sn);
		}
	}
	
	
	return tmpCandidates;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:34,代码来源:MlsNodeMapping_BestFit_Lower.java

示例5: nodeMapping

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
@Override
protected boolean nodeMapping(SubstrateNetwork sNet, VirtualNetwork vNet) {
	/*
	 * Node ranking calculation for virtual and substrate network
	 * see (Algorithm 1 and 2)
	 * 
	 * X. Cheng, S. Su, Z. Zhang, H. Wang, F. Yang, Y. Luo, J. Wang, Virtual network embedding 
	 * through topology-aware node ranking, SIGCOMM Comput. Commun. Rev. 41 (2011) 38--47.
	 * 
	 */
	Map<Node<?>, Double> SortedNodeNR_i_opt_subs = MiscelFunctions
			.sortByValue(MiscelFunctions.create_NR(sNet, epsilon));
	Map<Node<?>, Double> SortedNodeNR_i_opt_virt = MiscelFunctions
			.sortByValue(MiscelFunctions.create_NR(vNet, epsilon));
	boolean mappingPerformed;

	for (Iterator<Node<?>> vNode = SortedNodeNR_i_opt_virt.keySet()
			.iterator(); vNode.hasNext();) {
		VirtualNode toMapvNode = (VirtualNode) vNode.next();
		mappingPerformed = false;
		if (!nodeMapping.containsKey(toMapvNode)) {
			for (Iterator<Node<?>> sNode = SortedNodeNR_i_opt_subs.keySet()
					.iterator(); sNode.hasNext();) {
				SubstrateNode candidateSnode = (SubstrateNode) sNode.next();
				if (!nodeMapping.containsValue(candidateSnode)) {
					if (dist >= 0) {
						if (NodeLinkAssignation.isMappable(toMapvNode,
								candidateSnode)
								&& MiscelFunctions.nodeDistance(toMapvNode,
										candidateSnode, dist)) {
							if (NodeLinkAssignation.vnm(toMapvNode,
									candidateSnode)) {
								nodeMapping.put(toMapvNode, candidateSnode);
								mappingPerformed = true;
							} else {
								throw new AssertionError(
										"But we checked before!");
							}
						}
					} else {
						if (NodeLinkAssignation.isMappable(toMapvNode,
								candidateSnode)) {
							if (NodeLinkAssignation.vnm(toMapvNode,
									candidateSnode)) {
								nodeMapping.put(toMapvNode, candidateSnode);
								mappingPerformed = true;
								break;
							} else {
								throw new AssertionError(
										"But we checked before!");
							}
						}

					}
				}

			}
		} else {
			mappingPerformed = true;
		}

		if (!mappingPerformed)
			return false;

	}

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

示例6: nodeMapping

import vnreal.algorithms.utils.NodeLinkAssignation; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected boolean nodeMapping(VirtualNetwork vNet) {
	/*
	 * Node ranking calculation for virtual and substrate network
	 * see (Algorithm 1 and 2)
	 * 
	 * X. Cheng, S. Su, Z. Zhang, H. Wang, F. Yang, Y. Luo, J. Wang, Virtual network embedding 
	 * through topology-aware node ranking, SIGCOMM Comput. Commun. Rev. 41 (2011) 38�47.
	 * 
	 */
	Map<Node<?>, Double> SortedNodeNR_i_opt_subs = MiscelFunctions
			.sortByValue(MiscelFunctions.create_NR(sNet, epsilon));
	Map<Node<?>, Double> SortedNodeNR_i_opt_virt = MiscelFunctions
			.sortByValue(MiscelFunctions.create_NR(vNet, epsilon));
	boolean mappingPerformed;

	for (Iterator<Node<?>> vNode = SortedNodeNR_i_opt_virt.keySet()
			.iterator(); vNode.hasNext();) {
		VirtualNode toMapvNode = (VirtualNode) vNode.next();
		mappingPerformed = false;
		if (!nodeMapping.containsKey(toMapvNode)) {
			for (Iterator<Node<?>> sNode = SortedNodeNR_i_opt_subs.keySet()
					.iterator(); sNode.hasNext();) {
				SubstrateNode candidateSnode = (SubstrateNode) sNode.next();
				if (!nodeMapping.containsValue(candidateSnode)) {
					if (withDist) {
						if (NodeLinkAssignation.isMappable(toMapvNode,
								candidateSnode)
								&& MiscelFunctions.nodeDistance(toMapvNode,
										candidateSnode, dist)) {
							if (NodeLinkAssignation.vnm(toMapvNode,
									candidateSnode)) {
								nodeMapping.put(toMapvNode, candidateSnode);
								mappingPerformed = true;
							} else {
								throw new AssertionError(
										"But we checked before!");
							}
						}
					} else {
						if (NodeLinkAssignation.isMappable(toMapvNode,
								candidateSnode)) {
							if (NodeLinkAssignation.vnm(toMapvNode,
									candidateSnode)) {
								nodeMapping.put(toMapvNode, candidateSnode);
								mappingPerformed = true;
								break;
							} else {
								throw new AssertionError(
										"But we checked before!");
							}
						}

					}
				}

			}
		} else {
			mappingPerformed = true;
		}

		if (!mappingPerformed)
			return false;

	}

	return true;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:70,代码来源:NodeRankingBasedAlgorithm.java


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