|
@@ -474,21 +474,38 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
|
|
|
|
|
|
runProgressbar.step();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
double sum = 0;
|
|
|
- double step = 0.1;
|
|
|
- int steppsDone = 0;
|
|
|
- for(double actual = 0; actual <= 1 ; actual += step) {
|
|
|
- for(HolonSwitch hSwitch: switchList) {
|
|
|
- hSwitch.setManualMode(true);
|
|
|
- hSwitch.setManualState(Random.nextDouble() < actual);
|
|
|
- }
|
|
|
- control.calculateStateOnlyForCurrentTimeStep();
|
|
|
- DecoratedState actualstate = control.getSimManager().getActualDecorState();
|
|
|
- sum += evaluateState(actualstate);
|
|
|
- steppsDone++;
|
|
|
+ for(HolonSwitch hSwitch: switchList) {
|
|
|
+ hSwitch.setManualMode(true);
|
|
|
+ hSwitch.setManualState(true);
|
|
|
}
|
|
|
-
|
|
|
- return sum /(double) steppsDone;
|
|
|
+ control.calculateStateOnlyForCurrentTimeStep();
|
|
|
+ DecoratedState actualstate = control.getSimManager().getActualDecorState();
|
|
|
+ sum += evaluateState(actualstate);
|
|
|
+ for(HolonSwitch hSwitch: switchList) {
|
|
|
+ hSwitch.setManualMode(true);
|
|
|
+ hSwitch.setManualState(false);
|
|
|
+ }
|
|
|
+ control.calculateStateOnlyForCurrentTimeStep();
|
|
|
+ actualstate = control.getSimManager().getActualDecorState();
|
|
|
+ sum += evaluateState(actualstate);
|
|
|
+ return sum / 2.0;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -576,7 +593,8 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
for(int r = 0; r < rounds; r++)
|
|
|
{
|
|
|
|
|
|
- startTimer();
|
|
|
+ resetState();
|
|
|
+ startTimer();
|
|
|
Individual roundBest = executeAlgo();
|
|
|
if(cancel)return;
|
|
|
long executionTime = printElapsedTime();
|
|
@@ -585,7 +603,7 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
runPrinter.println(stringStatFromActualState());
|
|
|
runPrinter.println("Result: " + roundBest.fitness + " ExecutionTime:" + executionTime);
|
|
|
runPrinter.closeStream();
|
|
|
-
|
|
|
+
|
|
|
if(roundBest.fitness < runBest.fitness) runBest = roundBest;
|
|
|
}
|
|
|
|
|
@@ -641,7 +659,24 @@ public abstract class TopologieAlgorithmFramework implements AddOn{
|
|
|
*/
|
|
|
private void resetState() {
|
|
|
control.getSimManager().resetFlexManagerForTimeStep(control.getModel().getCurIteration());
|
|
|
- setState(resetChain.getLast());
|
|
|
+ if(!resetChain.isEmpty()) {
|
|
|
+ setState(resetChain.removeLast());
|
|
|
+ }
|
|
|
+
|
|
|
+ accessWildcards.clear();
|
|
|
+ this.countForAccessMap = 0;
|
|
|
+ amountOfExistingCables = 0;
|
|
|
+ accessIntToObject.clear();
|
|
|
+ accessObjectToInt.clear();
|
|
|
+ cableSet.clear();
|
|
|
+ cableList.clear();
|
|
|
+ accessGroupNode.clear();
|
|
|
+ accessIntegerToWildcard.clear();
|
|
|
+ addedIndexCable.clear();
|
|
|
+ switchList.clear();
|
|
|
+ accessSwitchGroupNode.clear();
|
|
|
+ edgeList.clear();
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|