summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-flow/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src/main/java')
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java6
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/distributionPolicies/MaxMinFairnessFlowDistributor.java4
2 files changed, 4 insertions, 6 deletions
diff --git a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
index c388293b..501bbf10 100644
--- a/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
+++ b/opendc-simulator/opendc-simulator-flow/src/main/java/org/opendc/simulator/engine/graph/FlowDistributor.java
@@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
* It also provides methods to update outgoing demands and supplies based on the incoming demands and supplies.
* This class is abstract and should be extended by specific implementations that define the distribution strategy.
* It uses a {@link FlowDistributorFactory.DistributionPolicy} to determine how to distribute the supply among the consumers.
- * The default distribution policy is {@link MaxMinFairnessPolicy}, which distributes the supply fairly among the consumers.
+ * The default distribution policy is MaxMinFairnessPolicy, which distributes the supply fairly among the consumers.
*/
public abstract class FlowDistributor extends FlowNode implements FlowSupplier, FlowConsumer {
protected static final Logger LOGGER = LoggerFactory.getLogger(FlowDistributor.class);
@@ -178,7 +178,9 @@ public abstract class FlowDistributor extends FlowNode implements FlowSupplier,
// supplierIndex not always set, so we use 0 as default to avoid index out of bounds
int idx = supplierEdge.getSupplierIndex() == -1 ? 0 : supplierEdge.getSupplierIndex();
// to keep index consistent, entries are neutralized instead of removed
- this.supplierEdges.put(idx, null);
+ // this.supplierEdges.put(idx, null);
+
+ this.supplierEdges.remove(idx);
this.capacity -= supplierEdge.getCapacity();
this.currentIncomingSupplies.put(idx, 0.0);
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 9b48f204..371015a4 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
@@ -44,12 +44,8 @@ public class MaxMinFairnessFlowDistributor extends FlowDistributor {
}
protected void updateOutgoingDemand() {
- // equally distribute the demand to all suppliers
for (FlowEdge supplierEdge : this.supplierEdges.values()) {
this.pushOutgoingDemand(supplierEdge, this.totalIncomingDemand / this.supplierEdges.size());
- // alternatively a relative share could be used, based on capacity minus current incoming supply
- // this.pushOutgoingDemand(supplierEdge, this.totalIncomingDemand * (supplierEdge.getCapacity() -
- // currentIncomingSupplies.get(idx) / supplierEdges.size()));
}
this.outgoingDemandUpdateNeeded = false;