|
@@ -22,11 +22,12 @@ public class TopologieObjectiveFunction {
|
|
|
|
|
|
* Maximum Energie Difference(kappa)
|
|
|
*/
|
|
|
- static double k_eb = 400000.f;
|
|
|
+ static double k_eb = 20000.f;
|
|
|
|
|
|
* Maximum when all on Energie Difference(kappa)
|
|
|
*/
|
|
|
- static double k_max = 450000.f;
|
|
|
+ static double k_max = 10.f;
|
|
|
+ static double lambda_max = 10.;
|
|
|
|
|
|
|
|
|
|
|
@@ -107,24 +108,27 @@ public class TopologieObjectiveFunction {
|
|
|
|
|
|
double f_eb = 0;
|
|
|
for(DecoratedNetwork net : state.getNetworkList()) {
|
|
|
- double netEnergyDifference = 0;
|
|
|
- netEnergyDifference += net.getConsumerList().stream().map(con -> con.getEnergySelfSupplied() - con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
|
|
|
- netEnergyDifference += net.getConsumerSelfSuppliedList().stream().map(con -> con.getEnergySelfSupplied() - con.getEnergyFromConsumingElemnets()).reduce(0.f, Float::sum);
|
|
|
- netEnergyDifference += net.getSupplierList().stream().map(sup -> sup.getEnergyProducing() - sup.getEnergySelfConsuming()).reduce(0.f, Float::sum);
|
|
|
|
|
|
- f_eb += Math.abs(netEnergyDifference);
|
|
|
+ f_eb += Math.abs(net.getTotalConsumption() - net.getTotalProduction());
|
|
|
}
|
|
|
+
|
|
|
+ f_eb /= state.getNetworkList().size();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
double f_maximum = 0;
|
|
|
- final int timestep = state.getTimestepOfState();
|
|
|
for(DecoratedNetwork net : state.getNetworkList()) {
|
|
|
- double maximumEnergy = 0;
|
|
|
- maximumEnergy += net.getConsumerList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum);
|
|
|
- maximumEnergy += net.getConsumerSelfSuppliedList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum);
|
|
|
- maximumEnergy += net.getSupplierList().stream().map(con -> con.getModel().getMaximumConsumptionPossible(timestep) - con.getModel().getMaximumProductionPossible(timestep)).reduce(0.f, Float::sum);
|
|
|
- f_maximum += Math.abs(maximumEnergy);
|
|
|
+ double prod = net.getTotalProduction();
|
|
|
+ double con = net.getTotalConsumption();
|
|
|
+ if(prod == 0 || con == 0) {
|
|
|
+ f_maximum += lambda_max;
|
|
|
+ }else {
|
|
|
+ f_maximum += lambda_max * (Math.abs(prod - con)/Math.max(prod, con));
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ f_maximum /= state.getNetworkList().size();
|
|
|
|
|
|
|
|
|
double f_holon = 0;
|
|
@@ -169,7 +173,7 @@ public class TopologieObjectiveFunction {
|
|
|
|
|
|
|
|
|
f_selection += cost_of_cable_per_meter * addedCableMeters;
|
|
|
- if(moreInformation)System.out.println("CostForWildcards:" + cost + ", CostSwitches(#" + amountOfAddedSwitch +"):" + cost_switch * amountOfAddedSwitch + ", CostCables(" +addedCableMeters+ "m):" + cost_of_cable_per_meter * addedCableMeters);
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -193,8 +197,11 @@ public class TopologieObjectiveFunction {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ if(moreInformation) {
|
|
|
+ printWeightedValues(f_eb, f_maximum, f_holon, f_selection, f_grid);
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
return (float) (w_eb * squash(f_eb, k_eb)
|
|
|
+ w_max * squash(f_maximum, k_max)
|
|
|
+ w_holon * squash(f_holon, k_holon)
|
|
@@ -242,12 +249,30 @@ public class TopologieObjectiveFunction {
|
|
|
return (supplyPercentage < 100) ? -0.5 * supplyPercentage + 50: supplyPercentage - 100;
|
|
|
}
|
|
|
|
|
|
- static void printDistribution(double f_eb, double f_maximum, double f_holon, double f_selection, double f_grid){
|
|
|
- System.out.print(" f_eb(" + w_eb * squash(f_eb, k_eb) + ") ");
|
|
|
- System.out.print(" f_maximum(" + w_max * squash(f_maximum, k_max) + ") ");
|
|
|
- System.out.print(" f_holon(" + w_holon * squash(f_holon, k_holon) + ") ");
|
|
|
- System.out.print(" f_selection(" + w_selection * squash(f_selection, k_selection) + ") ");
|
|
|
- System.out.println(" f_grid(" + w_grid * f_grid + ") ");
|
|
|
+ static void printWeightedValues(double f_eb, double f_maximum, double f_holon, double f_selection, double f_grid){
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println(" f_eb: " + f_eb + ", k_eb: " + k_eb + ", w_eb: " + w_eb);
|
|
|
+ System.out.println(" squash(f_eb, k_eb): " + doubleToString(squash(f_eb, k_eb)));
|
|
|
+ System.out.println(" w_eb * squash(f_eb, k_eb): " + doubleToString(w_eb * squash(f_eb, k_eb)));
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println(" f_maximum: " + f_maximum + ", k_max: " + k_max + ", w_max: " + w_max);
|
|
|
+ System.out.println(" squash(f_maximum, k_max): " + doubleToString(squash(f_maximum, k_max)));
|
|
|
+ System.out.println(" w_max * squash(f_maximum, k_max): " + doubleToString(w_max * squash(f_maximum, k_max)));
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println(" f_selection: " + f_selection + ", k_selection: " + k_selection + ", w_selection: " + w_selection);
|
|
|
+ System.out.println(" squash(f_selection, k_selection): " + doubleToString(squash(f_selection, k_selection)));
|
|
|
+ System.out.println(" w_selection * squash(f_selection, k_selection): " + doubleToString(w_selection * squash(f_selection, k_selection)));
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println(" f_holon: " + f_holon + ", k_holon: " + k_holon + ", w_holon: " + w_holon);
|
|
|
+ System.out.println(" squash(f_holon, k_holon): " + doubleToString(squash(f_holon, k_holon)));
|
|
|
+ System.out.println(" w_holon * squash(f_holon, k_holon): " + doubleToString(w_holon * squash(f_holon, k_holon)));
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println(" f_grid: " + f_grid + ", k_grid: " + k_grid + ", w_grid: " + w_grid);
|
|
|
+ System.out.println(" squash(f_grid, k_grid): " + doubleToString(squash(f_grid, k_grid)));
|
|
|
+ System.out.println(" w_grid * squash(f_grid, k_grid): " + doubleToString(w_grid * squash(f_grid, k_grid)));
|
|
|
+ System.out.println("===================================================================");
|
|
|
+ System.out.println();
|
|
|
+ System.out.println();
|
|
|
}
|
|
|
static void printUnsquashedValues(double f_eb, double f_maximum, double f_holon, double f_selection, double f_grid){
|
|
|
System.out.print(" f_eb(" + f_eb + ") ");
|