|
@@ -371,13 +371,60 @@ public abstract class AlgorithmFrameworkFlex implements AddOn{
|
|
|
}
|
|
|
printElapsedTime();
|
|
|
control.getSimManager().resetFlexManagerForTimeStep(control.getModel().getCurIteration());
|
|
|
+ this.extractPositionAndAccess();
|
|
|
setState(runBest.position);
|
|
|
updateVisual();
|
|
|
console.println("AlgoResult:" + runBest.fitness);
|
|
|
+ if(this.algoUseFlexes)calculateAndPrintFlexInfos(control.getSimManager().getActualDecorState());
|
|
|
runProgressbar.stop();
|
|
|
}
|
|
|
|
|
|
|
|
|
+ private void calculateAndPrintFlexInfos(DecoratedState state) {
|
|
|
+ int amountOfUsedFlex = 0;
|
|
|
+ int amountOfFlex = state.getFlexManager().getAllFlexWrapper().size();
|
|
|
+ float cost = 0;
|
|
|
+ int consumingFlex = 0;
|
|
|
+ float consumingFlexEnergy = 0.0f;
|
|
|
+ int producingFlex = 0;
|
|
|
+ float producingFlexEnergy = 0.0f;
|
|
|
+ int maxCooldown = 0;
|
|
|
+ for(FlexWrapper flexWrapper :state.getFlexManager().getAllFlexWrapperWithState(FlexState.IN_USE)) {
|
|
|
+ amountOfUsedFlex++;
|
|
|
+ cost += flexWrapper.getFlex().cost;
|
|
|
+ float energy = flexWrapper.getFlex().bringtmir();
|
|
|
+ if(energy < 0) {
|
|
|
+ consumingFlex++;
|
|
|
+ consumingFlexEnergy += -energy;
|
|
|
+ }else {
|
|
|
+ producingFlex++;
|
|
|
+ producingFlexEnergy += energy;
|
|
|
+ }
|
|
|
+ if(flexWrapper.getFlex().getCooldown() > maxCooldown) maxCooldown = flexWrapper.getFlex().getCooldown();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ console.println("Used Flex [" + amountOfUsedFlex + "/" + amountOfFlex + "]");
|
|
|
+
|
|
|
+
|
|
|
+ console.println(consumingFlex + " consuimg flexibilities that consumed " + consumingFlexEnergy + "Energy.");
|
|
|
+
|
|
|
+ console.println(producingFlex + " producing flexibilities that produce " + producingFlexEnergy + "Energy.");
|
|
|
+
|
|
|
+ console.println("Total Cost: "+ cost);
|
|
|
+
|
|
|
+ console.println("Max Cooldown: "+ maxCooldown);
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
protected abstract Individual executeAlgo();
|
|
|
|
|
|
|