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


Java NodeLinkAssignation类代码示例

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


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

示例1: performNodeMapping

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This method performs the node mapping taking into account the solver
 * response in the variable x (containing the optimal node mapping)
 * 
 * @param vNet
 * @param x
 * @return boolean value indicating whether the node mapping has been
 *         successful
 */
private boolean performNodeMapping(SubstrateNetwork sNet, VirtualNetwork vNet,
		Map<List<String>, Double> x) {
	List<String> tmpValues;
	VirtualNode currVnode;
	SubstrateNode currSnode;
	for (Iterator<List<String>> cad = x.keySet().iterator(); cad.hasNext();) {
		tmpValues = cad.next();
		if (x.get(tmpValues) == 1) {
			currVnode = getVnodeById(vNet,
					Integer.parseInt(tmpValues.get(0)));
			currSnode = getSnodeById(sNet, Integer.parseInt(tmpValues.get(1)));
			if (NodeLinkAssignation.vnm(currVnode, currSnode)) {
				if (!nodeMapping.containsKey(currVnode))
					nodeMapping.put(currVnode, currSnode);
			} else {
				throw new AssertionError(
						"Implementation mistake MIP model checks");
			}
		}
	}
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:32,代码来源:OptimalEnergyMappingHiddenHop.java

示例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(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;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:32,代码来源:RoundingPathSplittingLinkMapping.java

示例3: mapMLS

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This Method tries to map the demand on the SubstrateNetwork
 * Tries to optimize for MLS Labels
 * @param d
 * @return true if mapping has worked
 */
private boolean mapMLS(MLSDemand d) {
	for (SubstrateNode s : getUnmappedsNodes()) {
		for (AbstractResource r : s.get() ){
			if (r instanceof MLSResource){
				if (r.accepts(d)&&r.fulfills(d)) {
					NodeLinkAssignation.occupy(d, r);
					nodeMapping.put((VirtualNode) d.getOwner(), s);
					//Remove the Substrate Node from Map, so that only one VNode from this Network is mapped to the SNode
					getUnmappedsNodes().remove(s);
					return true;
				}		
			}
		}
	}
	
	return false;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:24,代码来源:MlsNodeMapping_Unique.java

示例4: 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

示例5: mapNode

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This Method tries to map the given {@link VirtualNode} on given {@link SubstrateNode}
 * @param vn {@link VirtualNode}
 * @param sn {@link SubstrateNode}
 * @return true if mapping ok, false otherwise
 */
private boolean mapNode(VirtualNode vn,  SubstrateNode sn) {
	//Check if the Node is still available for mapping
	if(!isAvailable(sn))
		return false; //Mapping not possible
	
	//Try map it
	if(!NodeLinkAssignation.vnm(vn, sn))
		return false; //Mapping failed or not possible
	
	//If Mapping is successfull
	//System.out.println(vn+":"+MLSUtils.getMLSDemand(vn));
	//System.out.println(sn+":"+MLSUtils.getMLSResource(sn));
	nodeMapping.put(vn, sn); //Add it to the mappinglist
	incrementCounter(sn);
	
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:24,代码来源:MlsNodeMapping_BestFit.java

示例6: mapNode

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This Method tries to map the given {@link VirtualNode} on given {@link SubstrateNode}
 * @param vn {@link VirtualNode}
 * @param sn {@link SubstrateNode}
 * @return true if mapping ok, false otherwise
 */
private boolean mapNode(VirtualNode vn,  SubstrateNode sn) {
	//Check if the Node is still available for mapping
	if(!isAvailable(sn))
		return false; //Mapping not possible
	
	//Try map it
	if(!NodeLinkAssignation.vnm(vn, sn)) 
		return false; //Mapping failed or not possible
	
	if(flexNodes.contains(vn)) {
		count_flexibilty++;
		System.out.println("Mapped("+this.phase+") VNode "+vn+" on SNode "+sn+" with felexibility.");
	}
	//If Mapping is successfull
	//System.out.println(vn+":"+MLSUtils.getMLSDemand(vn));
	//System.out.println(sn+":"+MLSUtils.getMLSResource(sn));
	nodeMapping.put(vn, sn); //Add it to the mappinglist
	incrementCounter(sn);
	
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:28,代码来源:MlsNodeMapping_BestFit_Lower.java

示例7: mapMLS

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This Method tries to map the demand on the SubstrateNetwork
 * Tries to optimize for MLS Labels
 * @param d
 * @return true if mapping has worked
 */
private boolean mapMLS(MLSDemand d) {
	for (SubstrateNode s : getUnmappedsNodes()) {
		for (AbstractResource r : s.get() ){
			if (r instanceof MLSResource){
				if (r.accepts(d)&&r.fulfills(d)) {
					NodeLinkAssignation.occupy(d, r);
					nodeMapping.put((VirtualNode) d.getOwner(), s);
					return true;
				}		
			}
		}
	}
	
	return false;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:22,代码来源:MlsNodeMapping_FirstFit.java

示例8: performNodeMapping

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * This method performs the node mapping taking into account the solver
 * response in the variable x (containing the optimal node mapping)
 * 
 * @param vNet
 * @param x
 * @return boolean value indicating whether the node mapping has been
 *         successful
 */
private boolean performNodeMapping(VirtualNetwork vNet,
		Map<List<String>, Double> x) {
	List<String> tmpValues;
	VirtualNode currVnode;
	SubstrateNode currSnode;
	for (Iterator<List<String>> cad = x.keySet().iterator(); cad.hasNext();) {
		tmpValues = cad.next();
		if (x.get(tmpValues) == 1) {
			currVnode = getVnodeById(vNet,
					Integer.parseInt(tmpValues.get(0)));
			currSnode = getSnodeById(Integer.parseInt(tmpValues.get(1)));
			if (NodeLinkAssignation.vnm(currVnode, currSnode)) {
				if (!nodeMapping.containsKey(currVnode))
					nodeMapping.put(currVnode, currSnode);
			} else {
				throw new AssertionError(
						"Implementation mistake MIP model checks");
			}
		}
	}
	return true;
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:32,代码来源:OptimalEnergyMappingHiddenHop.java

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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: match

import vnreal.algorithms.utils.NodeLinkAssignation; //导入依赖的package包/类
/**
 * Match function (see Algorithm 5).
 * 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.
 * 
 * @param vNet
 * @param vNode
 * @param candidates
 * @return a boolean value indicating whether the virtual node could be mapped 
 * or not 
 */
private boolean match(SubstrateNetwork sNet, VirtualNetwork vNet, VirtualNode vNode,
		List<SubstrateNode> candidates) {
	Iterator<Node<?>> tempIt = SortedNodeNR_i_opt_virt.keySet().iterator();
	List<SubstrateNode> tempCandiNodes = null;

	if (((VirtualNode) tempIt.next()).equals(vNode)) {
		if (NodeLinkAssignation.vnm(vNode, candidates.iterator().next())) {
			nodeMapping.put(vNode, candidates.iterator().next());
			return true;
		} else {
			throw new AssertionError("But we checked before!");
		}
	}
	GenericTreeNode<Node<?>> tempNode = bfsTree.find(vNode);
	VirtualNode parentNode = (VirtualNode) tempNode.getParent().getData();

	for (int tmpK = 1; tmpK < k + 1; tmpK++) {
		DijkstraDistance<SubstrateNode, SubstrateLink> distanceGraph = new DijkstraDistance<SubstrateNode, SubstrateLink>(
				sNet, new SubstrateLinkSingleTransformer(), false);
		distanceGraph.setMaxDistance(tmpK);
		Map<SubstrateNode, Number> orderedMappedCandidates = distanceGraph
				.getDistanceMap(nodeMapping.get(parentNode));
		tempCandiNodes = new LinkedList<SubstrateNode>(
				orderedMappedCandidates.keySet());
		candidates = new LinkedList<SubstrateNode>();

		if (!orderedMappedCandidates.isEmpty()) {
			if (withDist) {
				if (!nodeOverload) {
					candidates = MiscelFunctions.findFulfillingNodes(vNode,
							tempCandiNodes, dist, nodeMapping);
				} else {
					candidates = MiscelFunctions.findFulfillingNodes(vNode,
							tempCandiNodes, dist);
				}

			} else {
				if (!nodeOverload) {
					candidates = MiscelFunctions.findFulfillingNodes(vNode,
							tempCandiNodes, nodeMapping);
				} else {
					candidates = MiscelFunctions.findFulfillingNodes(vNode,
							tempCandiNodes);
				}
			}
			for (SubstrateNode sCorrNode : candidates) {
				if (MapPathsWithMappedNodes(sNet, vNet, vNode, sCorrNode)) {
					if (!NodeLinkAssignation.vnm(vNode, sCorrNode)) {
						throw new AssertionError("But we checked before!");
					} else {
						nodeMapping.put(vNode, sCorrNode);
						return true;
					}
				} else {
					MiscelFunctions.clearVnodeMappings(vNet, vNode);
				}
			}
		}
	}
	return false;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:73,代码来源:BFSNRCoordinatedMapping.java


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