本文整理汇总了Java中vnreal.network.substrate.SubstrateLink.add方法的典型用法代码示例。如果您正苦于以下问题:Java SubstrateLink.add方法的具体用法?Java SubstrateLink.add怎么用?Java SubstrateLink.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.network.substrate.SubstrateLink
的用法示例。
在下文中一共展示了SubstrateLink.add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateRandomBandwidthResources
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
public static void generateRandomBandwidthResources(
SubstrateNetwork sNetwork, int minResourceBandwidth,
int maxResourceBandwidth, Random random,
boolean useCommonConstraints) {
for (SubstrateLink l : sNetwork.getEdges()) {
int value = Utils.rnd(minResourceBandwidth, maxResourceBandwidth, random);
if (useCommonConstraints) {
CommonResource r = new CommonResource(value, l);
l.add(r);
} else {
BandwidthResource bw = new BandwidthResource(l);
bw.setBandwidth((double) value);
l.add(bw);
}
}
}
示例2: generate
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public List<CostResource> generate(ArrayList<Object> parameters) {
ArrayList<CostResource> resList = new ArrayList<CostResource>();
NetworkStack ns = (NetworkStack)parameters.get(0);
Integer minLC = ConversionHelper.paramObjectToInteger(parameters.get(1));
Integer maxLC = ConversionHelper.paramObjectToInteger(parameters.get(2));
Long seed = ConversionHelper.paramObjectToLong(parameters.get(3));
Random random = new Random();
random.setSeed(seed);
SubstrateNetwork sNet = ns.getSubstrate();
for (SubstrateLink l : sNet.getEdges()) {
CostResource bw = new CostResource(l);
int value = (int) (minLC + (maxLC
- minLC + 1)
* random.nextDouble());
bw.setCost((double) value);
l.add(bw);
resList.add(bw);
}
return resList;
}
示例3: generate
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public List<BandwidthResource> generate(ArrayList<Object> parameters) {
ArrayList<BandwidthResource> resList = new ArrayList<BandwidthResource>();
NetworkStack ns = (NetworkStack)parameters.get(0);
Integer minBW = ConversionHelper.paramObjectToInteger(parameters.get(1));
Integer maxBW = ConversionHelper.paramObjectToInteger(parameters.get(2));
Long seed = ConversionHelper.paramObjectToLong(parameters.get(3));
Random random = new Random();
random.setSeed(seed);
SubstrateNetwork sNet = ns.getSubstrate();
for (SubstrateLink l : sNet.getEdges()) {
BandwidthResource bw = new BandwidthResource(l);
int value = (int) (minBW + random.nextInt(maxBW - minBW + 1));
bw.setBandwidth((double) value);
l.add(bw);
resList.add(bw);
}
return resList;
}
示例4: generate
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public List<CostResource> generate(ArrayList<Object> parameters) {
ArrayList<CostResource> resList = new ArrayList<CostResource>();
NetworkStack ns = (NetworkStack)parameters.get(0);
Integer minLC = ConversionHelper.paramObjectToInteger(parameters.get(1));
Integer maxLC = ConversionHelper.paramObjectToInteger(parameters.get(2));
Random random = new Random();
SubstrateNetwork sNet = ns.getSubstrate();
for (SubstrateLink l : sNet.getEdges()) {
CostResource bw = new CostResource(l);
int value = (int) (minLC + (maxLC
- minLC + 1)
* random.nextDouble());
bw.setCost((double) value);
l.add(bw);
resList.add(bw);
}
return resList;
}
示例5: generate
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public List<BandwidthResource> generate(ArrayList<Object> parameters) {
ArrayList<BandwidthResource> resList = new ArrayList<BandwidthResource>();
Random random = new Random();
NetworkStack ns = (NetworkStack)parameters.get(0);
Integer minBW = ConversionHelper.paramObjectToInteger(parameters.get(1));
Integer maxBW = ConversionHelper.paramObjectToInteger(parameters.get(2));
SubstrateNetwork sNet = ns.getSubstrate();
for (SubstrateLink l : sNet.getEdges()) {
BandwidthResource bw = new BandwidthResource(l);
int value = (int) (minBW + (maxBW
- minBW + 1)
* random.nextDouble());
bw.setBandwidth((double) value);
l.add(bw);
resList.add(bw);
}
return resList;
}
示例6: generateRandomDelayResources
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
public static void generateRandomDelayResources(SubstrateNetwork sNetwork,
int minDelayResource, int maxDelayResource, Random random) {
for (SubstrateLink n : sNetwork.getEdges()) {
int value = (int) (minDelayResource + (maxDelayResource
- minDelayResource + 1)
* random.nextDouble());
StaticDelayResource res = new StaticDelayResource(n, value);
n.add(res);
}
}
示例7: generateRandomBandwidthResources
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
public static void generateRandomBandwidthResources(
SubstrateNetwork sNetwork,
Integer[] bandwidthResources,
Random random) {
for (SubstrateLink l : sNetwork.getEdges()) {
BandwidthResource bw = new BandwidthResource(l);
int pos = Utils.rnd(0, bandwidthResources.length - 1, random);
int value = bandwidthResources[pos];
bw.setBandwidth((double) value);
l.add(bw);
}
}
示例8: generateRandomDelayResources
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
public static void generateRandomDelayResources(SubstrateNetwork network,
Integer[] DelayResources, Random random) {
for (SubstrateLink l : network.getEdges()) {
int pos = Utils.rnd(0, DelayResources.length - 1, random);
int value = DelayResources[pos];
l.add(new StaticDelayResource(l, value));
}
}
示例9: process
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
@Override
public Scenario process(Scenario scen) {
SubstrateNetwork sNet = scen.getSubstrate();
for(SubstrateLink l : sNet.getEdges()) {
BandwidthResource bw = new BandwidthResource(l);
int value = min.intValue() + rng.nextInt(max.intValue() - min.intValue());
bw.setBandwidth((double) value);
l.add(bw);
}
return scen;
}
示例10: constructSubstrateNetwork
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
private static SubstrateNetwork constructSubstrateNetwork(Network network) {
// Build substrate network.
SubstrateNetwork substrate = new SubstrateNetwork(false);
// Convert vertices to substrate nodes.
Map<Vertex, SubstrateNode> vertToSubnode = new HashMap<Vertex, SubstrateNode>();
for (Vertex vert : network.vertices) {
SubstrateNode node = new SubstrateNode();
node.setCoordinateX(vert.lon);
node.setCoordinateY(-1*vert.lat);
String name = vert.asNumber+":"+vert.id;
if (vert.name != null) {
name += " (" + vert.name + ")";
}
node.setName(name);
substrate.addVertex(node);
vertToSubnode.put(vert, node);
}
// Convert edges to substrate links.
for (Edge edge : network.edges) {
SubstrateLink linkA = new SubstrateLink();
SubstrateLink linkB = new SubstrateLink();
if (edge.bandwidth != null) {
BandwidthResource bwA = new BandwidthResource(linkA);
bwA.setBandwidth((double) edge.bandwidth);
linkA.add(bwA);
BandwidthResource bwB = new BandwidthResource(linkB);
bwB.setBandwidth((double) edge.bandwidth);
linkB.add(bwB);
}
// TODO convert type, weight, delay and length to resources
SubstrateNode nodeA = vertToSubnode.get(edge.vertA);
SubstrateNode nodeB = vertToSubnode.get(edge.vertB);
substrate.addEdge(linkA, nodeA, nodeB);
substrate.addEdge(linkB, nodeB, nodeA);
}
return substrate;
}
示例11: createSubstLinks
import vnreal.network.substrate.SubstrateLink; //导入方法依赖的package包/类
/**
* Add new edge between sourceNode and destNode
*
* @param substNetwork
* @param sourceNode
* @param destNode
* @param bwResource
*
* @return substrateNetwork with nodes end new edge
*/
private static void createSubstLinks(SubstrateNetwork substNetwork, SubstrateNode sourceNode, SubstrateNode destNode, double bwResource){
BandwidthResource bwRes;
SubstrateLink subsLink = new SubstrateLink();
bwRes = new BandwidthResource(subsLink);
bwRes.setBandwidth(bwResource);
subsLink.add(bwRes);
substNetwork.addEdge(subsLink, sourceNode, destNode);
}