|
@@ -49,6 +49,16 @@ public class TopologieObjectiveFunction {
|
|
|
*/
|
|
|
static double k_avg_shortest_path = 400;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ static double seperate_X_Value = 3.0;
|
|
|
+
|
|
|
+ static double seperate_Y_Value = 10;
|
|
|
+
|
|
|
+ static double lowPenaltyGrowth = 3.0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -108,9 +118,9 @@ public class TopologieObjectiveFunction {
|
|
|
double f_maximum = 0;
|
|
|
for(DecoratedNetwork net : state.getNetworkList()) {
|
|
|
final int timestep = state.getTimestepOfState();
|
|
|
- f_maximum += Math.abs(net.getConsumerList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
- f_maximum += Math.abs(net.getConsumerSelfSuppliedList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
- f_maximum += Math.abs(net.getSupplierList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
+ f_maximum += Math.abs(net.getConsumerList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
+ f_maximum += Math.abs(net.getConsumerSelfSuppliedList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
+ f_maximum += Math.abs(net.getSupplierList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum));
|
|
|
}
|
|
|
|
|
|
|
|
@@ -167,6 +177,7 @@ public class TopologieObjectiveFunction {
|
|
|
for(DecoratedNetwork net: state.getNetworkList()) {
|
|
|
Graph G = GraphMetrics.convertDecoratedNetworkToGraph(net);
|
|
|
|
|
|
+
|
|
|
if(G.V.length <= 1) {
|
|
|
f_grid += 100;
|
|
|
continue;
|
|
@@ -174,25 +185,20 @@ public class TopologieObjectiveFunction {
|
|
|
|
|
|
|
|
|
double avgShortestPath = GraphMetrics.averageShortestDistance(G.V, G.E);
|
|
|
- double squached = squash(avgShortestPath, k_avg_shortest_path);
|
|
|
-
|
|
|
-
|
|
|
|
|
|
- int maximumK = G.V.length - 1;
|
|
|
- if(maximumK != 0) {
|
|
|
- int k = GraphMetrics.minimumCut(G.V, G.E);
|
|
|
- double proportion = k/(double)maximumK;
|
|
|
-
|
|
|
- squached = 0.5 * squash(1.0-proportion, 1) + 0.5 *squached;
|
|
|
- }
|
|
|
- f_grid += squached;
|
|
|
+
|
|
|
+ int k = GraphMetrics.minimumCut(G.V, G.E);
|
|
|
+ double penalty = disjoinPathPenalty(k);
|
|
|
+
|
|
|
+ f_grid += 0.5 * squash(penalty, 100) + 0.5 *squash(avgShortestPath, k_avg_shortest_path);
|
|
|
}
|
|
|
+
|
|
|
if(!state.getNetworkList().isEmpty()) {
|
|
|
f_grid /= state.getNetworkList().size();
|
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -213,7 +219,17 @@ public class TopologieObjectiveFunction {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
+ private static double disjoinPathPenalty(double value) {
|
|
|
+
|
|
|
+
|
|
|
+ if( value < seperate_X_Value) {
|
|
|
+ return 100 - ((100 - seperate_Y_Value) / seperate_X_Value) * value;
|
|
|
+ }
|
|
|
+
|
|
|
+ else {
|
|
|
+ return seperate_Y_Value * Math.exp(lowPenaltyGrowth * (-value + seperate_X_Value));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
@@ -233,7 +249,6 @@ public class TopologieObjectiveFunction {
|
|
|
*/
|
|
|
static public double supplyPenalty(double supply) {
|
|
|
double supplyPercentage = 100 * supply;
|
|
|
-
|
|
|
return (supplyPercentage < 100) ? -0.5 * supplyPercentage + 50: supplyPercentage - 100;
|
|
|
}
|
|
|
|