diff options
| author | Dante Niewenhuis <d.niewenhuis@hotmail.com> | 2025-10-03 13:53:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-03 13:53:18 +0200 |
| commit | cd696da4c50a150f1d01fec27eef5a043b57b95a (patch) | |
| tree | c6afad29b9e1649f98c8873c2bf54178007a069c | |
| parent | cb95cb2a5b24ae62c33962c988e89daf9a1a3e91 (diff) | |
Removed a bug in MaxMinFlowDistributor. (#376)
* Small update to the FLowDistributor
2 files changed, 8 insertions, 12 deletions
diff --git a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/VirtualMachine.java b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/VirtualMachine.java index a3ee4f97..5da8d3fe 100644 --- a/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/VirtualMachine.java +++ b/opendc-simulator/opendc-simulator-compute/src/main/java/org/opendc/simulator/compute/workload/VirtualMachine.java @@ -61,14 +61,6 @@ public final class VirtualMachine extends SimWorkload implements FlowSupplier { private final PerformanceCounters[] resourcePerformanceCounters = new PerformanceCounters[ResourceType.values().length]; - // private final Hashtable<ResourceType, Double> resourceDemands = new Hashtable<>(); - // private final Hashtable<ResourceType, Double> resourceSupplies = new Hashtable<>(); - // private final Hashtable<ResourceType, Double> resourceCapacities = new Hashtable<>(); - // private final Hashtable<ResourceType, Double> resourceTimeScalingFactor = new Hashtable<>(); // formerly known - // as d - // private final Hashtable<ResourceType, FlowEdge> distributorEdges = new Hashtable<>(); - // private final Hashtable<ResourceType, PerformanceCounters> resourcePerformanceCounters = new Hashtable<>(); - private final long checkpointInterval; private final long checkpointDuration; private final double checkpointIntervalScaling; @@ -326,7 +318,6 @@ public final class VirtualMachine extends SimWorkload implements FlowSupplier { */ @Override public void pushOutgoingDemand(FlowEdge supplierEdge, double newDemand) { - // FIXME: Needs to be assigned to specific resource if multiple exist -> add resource Id as parameter this.pushOutgoingDemand(supplierEdge, newDemand, supplierEdge.getSupplierResourceType()); } @@ -338,7 +329,6 @@ public final class VirtualMachine extends SimWorkload implements FlowSupplier { */ @Override public void pushOutgoingDemand(FlowEdge supplierEdge, double newDemand, ResourceType resourceType) { - // FIXME: Needs to be assigned to specific resource if multiple exist -> add resource Id as parameter this.resourceDemands[resourceType.ordinal()] = newDemand; this.distributorEdges[resourceType.ordinal()].pushDemand(newDemand, false, resourceType); } diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/MaxMinFairnessFlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/MaxMinFairnessFlowDistributor.java index 875412c6..e5e4eb59 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/MaxMinFairnessFlowDistributor.java +++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/MaxMinFairnessFlowDistributor.java @@ -43,13 +43,19 @@ public class MaxMinFairnessFlowDistributor extends FlowDistributor { } protected void updateOutgoingDemand() { + if (this.totalIncomingDemand == this.previousTotalDemand) { + this.outgoingDemandUpdateNeeded = false; + this.updateOutgoingSupplies(); + return; + } + + this.previousTotalDemand = this.totalIncomingDemand; + for (FlowEdge supplierEdge : this.supplierEdges.values()) { this.pushOutgoingDemand(supplierEdge, this.totalIncomingDemand / this.supplierEdges.size()); } this.outgoingDemandUpdateNeeded = false; - - this.invalidate(); } // TODO: This should probably be moved to the distribution strategy |
