Explorar el Código

Additional Log Information

Troppmann, Tom hace 4 años
padre
commit
d017600c39
Se han modificado 2 ficheros con 31 adiciones y 1 borrados
  1. 15 0
      src/api/AlgorithmFrameworkFlex.java
  2. 16 1
      src/api/TopologieAlgorithmFramework.java

+ 15 - 0
src/api/AlgorithmFrameworkFlex.java

@@ -14,6 +14,7 @@ import java.math.RoundingMode;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.DoubleSummaryStatistics;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
@@ -821,6 +822,14 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
 		int amountSwitch = state.getDecoratedSwitches().size();
 		int amountActiveSwitch = (int)state.getDecoratedSwitches().stream().filter(dswitch -> (dswitch.getState() == SwitchState.Closed)).count();
 		
+		DoubleSummaryStatistics overStat = state.getNetworkList().stream().flatMap(net -> {
+			return net.getConsumerList().stream().filter(con -> con.getState() == HolonObjectState.OVER_SUPPLIED);
+		}).mapToDouble(con -> con.getSupplyBarPercentage()).summaryStatistics();
+		
+		DoubleSummaryStatistics partiallyStat = state.getNetworkList().stream().flatMap(net -> {
+			return net.getConsumerList().stream().filter(con -> con.getState() == HolonObjectState.PARTIALLY_SUPPLIED);
+		}).mapToDouble(con -> con.getSupplyBarPercentage()).summaryStatistics();
+		
 		
 		return	"HolonObjects["
 			+	" Passiv: " + percentage(amountOfPassiv, amountOfObjects)
@@ -828,8 +837,14 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
 			+	" Consumer: " + percentage(amountOfConsumer, amountOfObjects)
 			+	" Unsupplied: " + percentage(unSuppliedConsumer, amountOfConsumer)
 			+	" PartiallySupplied: " + percentage(partiallySuppliedConsumer, amountOfObjects)
+			+ " with SupplyPercentage(Min: " + partiallyStat.getMin() 
+			+ " Max: "+ partiallyStat.getMax() 
+			+ " Average: " +partiallyStat.getAverage() +  ")"
 			+	" Supplied: " + percentage(suppliedConsumer, amountOfConsumer)
 			+	" Over: " + percentage(overSuppliedConsumer, amountOfConsumer)
+			+ " with SupplyPercentage(Min: " + overStat.getMin() 
+			+ " Max: "+ overStat.getMax() 
+			+ " Average: " + overStat.getAverage() +  ")"
 			+  "]" + "   HolonElemnts["
 			+	" Active: " + percentage(activeElements, amountOfelements)
 			+ "]" + "Flexibilities_active[" 

+ 16 - 1
src/api/TopologieAlgorithmFramework.java

@@ -12,6 +12,7 @@ import java.math.RoundingMode;
 import java.text.NumberFormat;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.DoubleSummaryStatistics;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedList;
@@ -999,14 +1000,28 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
 		double switchCost = TopologieObjectiveFunction.calculateWildcardCost(state);
 		double totalCost = wildcardCost + cableCost + switchCost;
 		
+		DoubleSummaryStatistics overStat = state.getNetworkList().stream().flatMap(net -> {
+			return net.getConsumerList().stream().filter(con -> con.getState() == HolonObjectState.OVER_SUPPLIED);
+		}).mapToDouble(con -> con.getSupplyBarPercentage()).summaryStatistics();
+		
+		DoubleSummaryStatistics partiallyStat = state.getNetworkList().stream().flatMap(net -> {
+			return net.getConsumerList().stream().filter(con -> con.getState() == HolonObjectState.PARTIALLY_SUPPLIED);
+		}).mapToDouble(con -> con.getSupplyBarPercentage()).summaryStatistics();
+		
 		return	"HolonObjects["
 			+ " Passiv: " + percentage(amountOfPassiv, amountOfObjects)
 			+ " Producer: " + percentage(amountOfSupplier, amountOfObjects)
 			+ " Consumer: " + percentage(amountOfConsumer, amountOfObjects)
 			+ " Unsupplied: " + percentage(unSuppliedConsumer, amountOfConsumer)
-			+ " PartiallySupplied: " + percentage(partiallySuppliedConsumer, amountOfObjects)
+			+ " PartiallySupplied: " + percentage(partiallySuppliedConsumer, amountOfObjects) 
+			+ " with SupplyPercentage(Min: " + partiallyStat.getMin() 
+			+ " Max: "+ partiallyStat.getMax() 
+			+ " Average: " +partiallyStat.getAverage() +  ")"
 			+ " Supplied: " + percentage(suppliedConsumer, amountOfConsumer)
 			+ " Over: " + percentage(overSuppliedConsumer, amountOfConsumer)
+			+ " with SupplyPercentage(Min: " + overStat.getMin() 
+			+ " Max: "+ overStat.getMax() 
+			+ " Average: " + overStat.getAverage() +  ")"
 			+ "]" + "   HolonElemnts["
 			+ " Active: " + percentage(activeElements, amountOfelements)
 			+ "]"