Browse Source

minor changes in fitness function

David Heck 4 years ago
parent
commit
fb539709cf
1 changed files with 7 additions and 4 deletions
  1. 7 4
      src/ui/controller/StorageProductionController.java

+ 7 - 4
src/ui/controller/StorageProductionController.java

@@ -38,7 +38,7 @@ public class StorageProductionController {
 
 	public void enableStorageDischarging(final float energyNeeded) {
 		Collections.sort(storages, Collections.reverseOrder());
-		System.out.println("energy needed from storage" + energyNeeded);
+//		System.out.println("energy needed from storage" + energyNeeded);
 		int storagesLeft = storages.size();
         float energyLeftToEnabled = energyNeeded;
         	for (StorageElement se: storages) {
@@ -83,7 +83,7 @@ public class StorageProductionController {
 		float fitness = 0f;
 
 		fitness = w1 * distanceFitness() + w2 * distributionFitness() + w3 * participationFitness();
-		System.out.println(fitness);
+		System.out.println("Fitness score: " + fitness);
 	}
 
 	private float distanceFitness(){
@@ -95,7 +95,7 @@ public class StorageProductionController {
 				activeStorage++;
 			}
 		}
-		return distance / activeStorage;
+		return distance / activeStorage /1000;
 	}
 
 	private float distributionFitness(){
@@ -116,7 +116,10 @@ public class StorageProductionController {
 		float participation = 0;
 		for (StorageElement ele : storages) {
 				participation = participation +
-						((storageEnergy(ele)/totalEnergy())*energyRequiredForPowerplantBlackstart-ele.getEnergyPerElement());
+						Math.abs(
+								(storageEnergy(ele)/totalEnergy())
+										-(ele.getEnergyPerElement()/ele.getPossibleProduction(energyRequiredForPowerplantBlackstart))
+						);
 		}
 		return participation;
 	}