本文整理汇总了Java中vnreal.algorithms.utils.SubgraphBasicVN.Utils.freeResources方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.freeResources方法的具体用法?Java Utils.freeResources怎么用?Java Utils.freeResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vnreal.algorithms.utils.SubgraphBasicVN.Utils
的用法示例。
在下文中一共展示了Utils.freeResources方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapEdges(
VirtualNetwork g_V, SubstrateNetwork orig_g_P,
MappingCandidate<VirtualNode, SubstrateNode> candidate, NodeLinkMapping m,
int epsilon) {
Collection<ResourceDemandEntry> out = mapOutEdges(
g_V, orig_g_P, candidate, m, epsilon);
if (out == null) {
return null;
}
Collection<ResourceDemandEntry> in = mapInEdges(
g_V, orig_g_P, candidate, m, epsilon);
if (in == null) {
Utils.freeResources(out);
return null;
}
out.addAll(in);
return out;
}
示例2: mapOutEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapOutEdges(
VirtualNetwork g_V, SubstrateNetwork orig_g_P,
MappingCandidate<VirtualNode, SubstrateNode> candidate, NodeLinkMapping m,
int epsilon) {
Collection<ResourceDemandEntry> result = new LinkedList<ResourceDemandEntry>();
for (VirtualLink vl : g_V.getOutEdges(candidate.t)) {
VirtualNode opposite = g_V.getOpposite(candidate.t, vl);
SubstrateNode sOpposite = m.getSubstrateNode(opposite);
if (sOpposite != null && sOpposite.getId() != candidate.u.getId()) {
List<SubstrateLink> path = findShortestPath(orig_g_P,
candidate.u, sOpposite, vl.get(), epsilon);
if (path == null) {
Utils.freeResources(result);
return null;
}
result.addAll(Utils.occupyPathResources(vl, path, orig_g_P));
m.add(vl, path);
}
}
return result;
}
示例3: mapInEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapInEdges(
VirtualNetwork g_V, SubstrateNetwork orig_g_P,
MappingCandidate<VirtualNode, SubstrateNode> candidate, NodeLinkMapping m,
int epsilon) {
Collection<ResourceDemandEntry> result = new LinkedList<ResourceDemandEntry>();
for (VirtualLink vl : g_V.getInEdges(candidate.t)) {
VirtualNode opposite = g_V.getOpposite(candidate.t, vl);
SubstrateNode sOpposite = m.getSubstrateNode(opposite);
if (sOpposite != null && sOpposite.getId() != candidate.u.getId()) {
List<SubstrateLink> path = findShortestPath(orig_g_P,
sOpposite, candidate.u, vl.get(), epsilon);
if (path == null) {
Utils.freeResources(result);
return null;
}
result.addAll(Utils.occupyPathResources(vl, path, orig_g_P));
m.add(vl, path);
}
}
return result;
}
示例4: evaluate
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
@Override
protected void evaluate() {
// allDemandedResources = new LinkedList<ResourceDemandEntry<? extends
// AbstractResource, ? extends AbstractDemand>>();
SubstrateNetwork sNetwork = stack.getSubstrate();
NodeLinkMapping mapping = new NodeLinkMapping();
while (hasNext()) {
demandedResources = new LinkedList<ResourceDemandEntry>();
if (!mapNetwork(sNetwork, getNext(), mapping)) {
Utils.freeResources(demandedResources);
// Utils.freeResources(allDemandedResources);
// mapping = null;
// break;
}
// allDemandedResources.addAll(demandedResources);
}
if (mapping != null) {
mapping.setMappings(demandedResources);
}
demandedResources = null;
}
示例5: mapEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapEdges(
SubstrateNetwork sNetwork,
VirtualNetwork vNetwork,
MappingCandidate<VirtualNode, SubstrateNode> candidate,
NodeLinkMapping m,
Collection<ResourceDemandEntry> demandedNodeEnergyResource,
int epsilon) {
Collection<ResourceDemandEntry> out = mapOutEdges(
sNetwork, vNetwork, candidate, m, epsilon);
if (out == null) {
return null;
}
Collection<ResourceDemandEntry> in = mapInEdges(
sNetwork, vNetwork, candidate, m, epsilon);
if (in == null) {
Utils.freeResources(out);
return null;
}
out.addAll(in);
return out;
}
示例6: mapOutEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapOutEdges(
SubstrateNetwork sNetwork, VirtualNetwork vNetwork,
MappingCandidate<VirtualNode, SubstrateNode> candidate, NodeLinkMapping m,
int epsilon) {
Collection<ResourceDemandEntry> result = new LinkedList<ResourceDemandEntry>();
for (VirtualLink vl : vNetwork.getOutEdges(candidate.t)) {
VirtualNode opposite = vNetwork.getOpposite(candidate.t, vl);
SubstrateNode sOpposite = m.getSubstrateNode(opposite);
if (sOpposite != null && sOpposite.getId() != candidate.u.getId()) {
List<SubstrateLink> path = findShortestPath(sNetwork,
candidate.u, sOpposite, vl.get(), epsilon);
if (path == null) {
Utils.freeResources(result);
return null;
}
result.addAll(Utils.occupyPathResources(vl, path, sNetwork));
m.add(vl, path);
}
}
return result;
}
示例7: mapInEdges
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
Collection<ResourceDemandEntry> mapInEdges(
SubstrateNetwork sNetwork, VirtualNetwork vNetwork,
MappingCandidate<VirtualNode, SubstrateNode> candidate, NodeLinkMapping m,
int epsilon) {
Collection<ResourceDemandEntry> result = new LinkedList<ResourceDemandEntry>();
for (VirtualLink vl : vNetwork.getInEdges(candidate.t)) {
VirtualNode opposite = vNetwork.getOpposite(candidate.t, vl);
SubstrateNode sOpposite = m.getSubstrateNode(opposite);
if (sOpposite != null && sOpposite.getId() != candidate.u.getId()) {
List<SubstrateLink> path = findShortestPath(sNetwork,
sOpposite, candidate.u, vl.get(), epsilon);
if (path == null) {
Utils.freeResources(result);
return null;
}
result.addAll(Utils.occupyPathResources(vl, path, sNetwork));
m.add(vl, path);
}
}
return result;
}
示例8: evaluate
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
@Override
protected void evaluate() {
SubstrateNetwork sNetwork = stack.getSubstrate();
List<OptimalMappingAlgorithmMappingResult> results = new LinkedList<OptimalMappingAlgorithmMappingResult>();
results.add(new OptimalMappingAlgorithmMappingResult(
new NodeLinkMapping(), null));
while (hasNext()) {
VirtualNetwork vNetwork = getNext();
List<OptimalMappingAlgorithmMappingResult> netResults = new LinkedList<OptimalMappingAlgorithmMappingResult>();
for (OptimalMappingAlgorithmMappingResult m : results) {
Collection<ResourceDemandEntry> previousMappings = m.mapping
.occupyAllResources(sNetwork);
EnergyResourceChecker mappingChecker = new EnergyResourceChecker();
vnmFlib(m.mapping, sNetwork.getVertices(),
vNetwork.getVertices(), vNetwork, sNetwork,
mappingChecker, netResults);
Utils.freeResources(previousMappings);
}
results = netResults;
}
NodeLinkMapping computedMapping = null;
if (results.isEmpty()) {
computedMappingResults = null;
} else {
Collections.sort(results, new EnergyResourceChecker());
computedMappingResults = results;
computedMapping = computedMappingResults.get(0).mapping;
computedMapping.occupyAllResources(sNetwork);
}
}
示例9: vnmFlib
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
NodeLinkMapping vnmFlib(NodeLinkMapping m, VirtualNetwork g_V, SubstrateNetwork g_P,
SubstrateNetwork orig_g_P, int omega, int epsilon) {
if (debug) {
System.out.println("numberOfTries: " + numberOfTries);
}
if (isMappingComplete(m, g_V, orig_g_P)) {
return m;
}
if (debug) {
System.out.println();
System.out.println();
System.out.println("g_sub_V:");
for (VirtualNode n : m.getNodeEntries().keySet()) {
System.out.println(n);
}
System.out.println();
}
List<MappingCandidate<VirtualNode, SubstrateNode>> c = genneigh(
orig_g_P, g_P, g_V, m);
for (MappingCandidate<VirtualNode, SubstrateNode> candidate : c) {
++numberOfTries;
if (numberOfTries > omega) {
return null;
}
NodeLinkMapping m2 = new NodeLinkMapping(m);
m2.add(candidate.t, candidate.u);
Collection<ResourceDemandEntry> resourceMapping = Utils
.occupyResources(candidate.t.get(), candidate.u.get());
Collection<ResourceDemandEntry> edges = mapEdges(
g_V, orig_g_P, candidate, m2, epsilon);
if (edges != null) {
if (debug) {
System.out.println("Mapped nodes " + candidate.t + " <-> "
+ candidate.u);
}
SubstrateNetwork g_res = get_g_res(g_P, candidate.u);
NodeLinkMapping result = vnmFlib(m2, g_V, g_res, orig_g_P, omega,
epsilon);
if (result != null) {
if (debug) {
System.out.println("returning m3");
}
return result;
}
Utils.freeResources(edges);
}
Utils.freeResources(resourceMapping);
}
if (debug) {
System.out.println("returning null");
}
return null;
}
示例10: vnmFlib
import vnreal.algorithms.utils.SubgraphBasicVN.Utils; //导入方法依赖的package包/类
void vnmFlib(
NodeLinkMapping m,
Collection<SubstrateNode> unmappedSNodes,
Collection<VirtualNode> unmappedVNodes,
VirtualNetwork vNetwork,
SubstrateNetwork sNetwork,
int omega,
int epsilon,
int depthOfRecursion,
EnergyResourceChecker mappingChecker,
Collection<OptimalMappingAlgorithmMappingResult> results,
Collection<ResourceDemandEntry> demandedNodeEnergyResources) {
if (omega != -1 && depthOfRecursion > omega) {
return;
}
if (unmappedVNodes.isEmpty()) {
OptimalMappingAlgorithmMappingResult newResult = new OptimalMappingAlgorithmMappingResult(
m, demandedNodeEnergyResources);
results.add(newResult);
if (mappingChecker.check(demandedNodeEnergyResources)) {
mappingChecker.setBest(demandedNodeEnergyResources);
}
return;
}
if (!mappingChecker.check(demandedNodeEnergyResources)) {
return;
}
List<MappingCandidate<VirtualNode, SubstrateNode>> c = genneigh(
sNetwork.getVertices(), unmappedSNodes, unmappedVNodes);
for (MappingCandidate<VirtualNode, SubstrateNode> candidate : c) {
NodeLinkMapping m2 = new NodeLinkMapping(m);
m2.add(candidate.t, candidate.u);
Collection<ResourceDemandEntry> resourceMapping = Utils
.occupyResources(candidate.t.get(), candidate.u.get());
Collection<ResourceDemandEntry> newDemandedNodeEnergyResources = new LinkedList<ResourceDemandEntry>(
demandedNodeEnergyResources);
Collection<ResourceDemandEntry> edges = mapEdges(
sNetwork, vNetwork, candidate, m2,
newDemandedNodeEnergyResources, epsilon);
if (edges != null) {
Collection<SubstrateNode> newUnmappedSNodes = new LinkedList<SubstrateNode>(
unmappedSNodes);
Collection<VirtualNode> newUnmappedVNodes = new LinkedList<VirtualNode>(
unmappedVNodes);
newUnmappedSNodes.remove(candidate.u);
newUnmappedVNodes.remove(candidate.t);
boolean found = false;
for (ResourceDemandEntry demEntry : resourceMapping) {
if (demEntry.res instanceof PowerResource) {
found = true;
newDemandedNodeEnergyResources
.add(new ResourceDemandEntry(
(PowerResource) demEntry.res,
(PowerDemand) demEntry.dem));
}
}
assert (found);
vnmFlib(m2, newUnmappedSNodes, newUnmappedVNodes, vNetwork,
sNetwork, omega, epsilon, depthOfRecursion + 1,
mappingChecker, results, newDemandedNodeEnergyResources);
Utils.freeResources(edges);
}
Utils.freeResources(resourceMapping);
}
}