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


Java SubstrateNetwork.getVertices方法代码示例

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


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

示例1: getMinPiNode

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public SubstrateNode getMinPiNode(SubstrateNetwork sNetwork,
		List<AbstractDemand> demands, Collection<SubstrateNode> v_a,
		Collection<SubstrateNode> ignoreNodes) {
	SubstrateNode result = null;
	double resultValue = 0.0, tmp = 0.0;
	for (SubstrateNode n : sNetwork.getVertices()) {
		if ((ignoreNodes == null || !ignoreNodes.contains(n))
				&& !v_a.contains(n)) {
			if (Utils.fulfills(demands, n.get())
					&& (result == null | (resultValue > (tmp = nodePotential(
							sNetwork, n, v_a))))) {

				result = n;
				resultValue = tmp;
			}
		}
	}

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

示例2: findClusterhead

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * Returns the SubstrateNode with most CPU Ressources
 * @param cluster SubstrateNetwork
 * @return Node with most CPUResources
 */
public static SubstrateNode findClusterhead(SubstrateNetwork cluster) {
	SubstrateNode result = null;
	double cpuMax = 0.0d;
	
	for (SubstrateNode sn : cluster.getVertices()) {
		if (result == null) {
			result = sn;
		} else {
			for (AbstractResource r : sn) {
				if (r instanceof CpuResource) {
					CpuResource c = (CpuResource) r;
					double cpu = c.getAvailableCycles();
					if (cpu > cpuMax) {
						cpuMax = cpu;
						result = sn;
					}
				}
			}
		}
	}
	
	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:29,代码来源:Utils.java

示例3: generate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public List<CpuResource> generate(ArrayList<Object> parameters) {
	ArrayList<CpuResource> resList = new ArrayList<CpuResource>();
	
	NetworkStack ns = (NetworkStack)parameters.get(0);
	Integer minCPU = ConversionHelper.paramObjectToInteger(parameters.get(1));
	Integer maxCPU = ConversionHelper.paramObjectToInteger(parameters.get(2));
	Long seed = ConversionHelper.paramObjectToLong(parameters.get(3));
	
	Random random = new Random();
	random.setSeed(seed);
	
	
	SubstrateNetwork sn = ns.getSubstrate();
	
	for(SubstrateNode n : sn.getVertices()) {
		CpuResource cpu = new CpuResource(n);
                       int value = (int) (minCPU + random.nextInt(maxCPU - minCPU + 1));
		cpu.setCycles((double) value);
		n.add(cpu);
		resList.add(cpu);
	}
	
	return resList;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:26,代码来源:FixedCpuResourceGenerator.java

示例4: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	double sum = 0.0;
	int i = 0;
	SubstrateNetwork sNetwork = stack.getSubstrate();

	for (SubstrateNode sn : sNetwork.getVertices()) {
		for (AbstractResource res : sn.get()) {
			for (Mapping m : res.getMappings()) {
				AbstractDemand dem = m.getDemand();

				if (dem instanceof CpuDemand) {
					sum += ((CpuDemand) dem).getDemandedCycles();
					i++;
				}
			}
		}
	}

	return (i == 0 ? 0.0 : (sum / (double) i));
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:21,代码来源:NodeUtilization.java

示例5: checkMLSResource

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * Checks that every SubstrateNode have an MLSResource
 * @param sNet
 * @return true if ok
 */
private boolean checkMLSResource(SubstrateNetwork sNet) {
	boolean hasMLS;
	for(SubstrateNode n : sNet.getVertices()) {
		hasMLS = false;
		for(AbstractResource r : n.get()){
			if (r instanceof MLSResource)
				hasMLS = true;
		}
		if(!hasMLS)
			return false;
	}
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:MlsNodeMapping_FirstFit.java

示例6: generateFreeSlotsResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateFreeSlotsResources(SubstrateNetwork network, HashMap<String, LinkedList<String>> labelsAndVNFTypes, int minFreeSlotsResources, int maxFreeSlotsResources, Random random) {
	for (SubstrateNode n : network.getVertices()) {
		int slots = Utils.rnd(minFreeSlotsResources, maxFreeSlotsResources, random);
		
		LinkedList<String> keys = new LinkedList<String>(labelsAndVNFTypes.keySet());
		String label = keys.get(Utils.rnd(0, keys.size() - 1, random));
		n.add(new FreeSlotsResource(label, slots, n));
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:10,代码来源:RandomResourceGenerator.java

示例7: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public double calculate(NetworkStack stack) {
	SubstrateNetwork sNetwork = stack.getSubstrate();

	int max = 0;
	for (SubstrateNode sn : sNetwork.getVertices()) {
		int stress = VnrUtils.getStressLevel(sn);
		if (stress > max) {
			max = stress;
		}
	}

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

示例8: printResourceMappings

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void printResourceMappings(SubstrateNetwork sNetwork) {
	for (SubstrateNode n : sNetwork.getVertices()) {
		for (AbstractResource r : n.get()) {
			if (!r.getMappings().isEmpty()) {
				System.out.println(r.getMappings().size()
						+ " mappings for node " + n);
				for (vnreal.mapping.Mapping as : r.getMappings())
					System.out.println("  " + as.getDemand() + "  "
							+ as.getResource());
			}
		}
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:14,代码来源:Utils.java

示例9: generatePowerResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generatePowerResources(
		SubstrateNetwork sNetwork) {
	for (SubstrateNode n : sNetwork.getVertices()) {
		PowerResource r = new PowerResource(n);

		n.add(r);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:9,代码来源:ConstraintsUtils.java

示例10: generateFixedStaticEnergyConsumptionResources

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
public static void generateFixedStaticEnergyConsumptionResources(
		SubstrateNetwork sNetwork, int consumption) {
	for (SubstrateNode n : sNetwork.getVertices()) {
		StaticEnergyResource r = new StaticEnergyResource(n, consumption);

		n.add(r);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:9,代码来源:ConstraintsUtils.java

示例11: DistributedNode

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
DistributedNode(SubstrateNode node, SubstrateNetwork subNetwork) {
	this.node = node;
	this.subNetwork = subNetwork;
	for (SubstrateNode sn : subNetwork.getVertices()) {
		allSubstrateNodes.add(sn);
	}
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:8,代码来源:DistributedNode.java

示例12: calculate

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
@Override
public double calculate(NetworkStack stack) {
	
	SubstrateNetwork sn = stack.getSubstrate();
	
	int max = 0;
	
	//Work through all SNodes
	for (SubstrateNode n : sn.getVertices()) {
		//Get the MLSResource
		for(AbstractResource ar : n.get()) {
			if(ar instanceof MLSResource) {
				int plevel = ((MLSResource)ar).getProvide();
				//Get the Mapping on this Resource
				for(Mapping m : ar.getMappings()) {
					//Check that the Mapping is from a Node (Links are handled in another Metric)
					if(m.getDemand().getOwner() instanceof VirtualNode) {
						//Calculate the difference from vNode demand minus snode provide
						int diff =  plevel - ((MLSDemand)m.getDemand()).getDemand(); 
						if (diff > max)
							max = diff;
					}
				}
			}
		}
	}
	
	return (max);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:30,代码来源:MaxMLSSecDiffProvDem.java

示例13: checkMLSResource

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * Checks that every SubstrateNode have an MLSResource
 * @param sNet
 * @return true if ok
 */
public static boolean checkMLSResource(SubstrateNetwork sNet) {
	boolean hasMLS;
	for(SubstrateNode n : sNet.getVertices()) {
		hasMLS = false;
		for(AbstractResource r : n.get()){
			if (r instanceof MLSResource)
				hasMLS = true;
		}
		if(!hasMLS)
			return false;
	}
	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:19,代码来源:MLSUtils.java

示例14: getSnodeById

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
/**
 * 
 * @param id
 * @return the substrate node corresponding to id
 */
private SubstrateNode getSnodeById(SubstrateNetwork sNet, int id) { // TODO: Find all instances of this and move to SubstrateNetwork
	for (SubstrateNode tempSubsNode : sNet.getVertices()) {
		if (tempSubsNode.getId() == id)
			return tempSubsNode;
	}
	return null;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:13,代码来源:OptimalEnergyMappingHiddenHop.java

示例15: maxNodeResource

import vnreal.network.substrate.SubstrateNetwork; //导入方法依赖的package包/类
private Double maxNodeResource(SubstrateNetwork sNet) {
	double max = 0;
	for (SubstrateNode n : sNet.getVertices()) {
		for (AbstractResource res : n) {
			// Change it, and instance of abstract resource
			if (res instanceof CpuResource) {
				if ((((CpuResource) res).getAvailableCycles()) >= max)
					max = (((CpuResource) res).getAvailableCycles());

			}
		}
	}
	return (max * 100);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:15,代码来源:CoordinatedVirtualNodeMapping.java


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