Skip to content

Commit 6fe4a38

Browse files
ChristophBodensteinChristophBodenstein
authored andcommitted
bugfixes for cache handling
1 parent e7f9cf4 commit 6fe4a38

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

TimeNETOptimizationEnvironment/src/toe/simulation/SimulationCache.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ public void addListOfSimulationsToCache(ArrayList<SimulationType> SimulationList
574574
*/
575575
public void addSimulationToCache(SimulationType SimulationToAdd) {
576576
SimulationToAdd.updateHashString();
577-
//this.getSimulationList().add(SimulationToAdd);
577+
this.getSimulationList().add(SimulationToAdd);
578578
simulationHashmap.put(SimulationToAdd.getHashValue(), SimulationToAdd);
579579
}
580580

@@ -608,6 +608,6 @@ public ArrayList<SimulationType> getSimulationList() {
608608
* @return Size of SimulationList
609609
*/
610610
public int getCacheSize() {
611-
return simulationList.size();
611+
return simulationHashmap.size();
612612
}
613613
}

TimeNETOptimizationEnvironment/src/toe/simulation/SimulatorCachedLocal.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public void initSimulator(ArrayList< ArrayList<parameter>> listOfParameterSetsTM
6262
*/
6363
@Override
6464
public void run() {
65-
if (mySimulationCache != null) {
65+
if ((mySimulationCache != null) && (mySimulationCache.getCacheSize() >= 1)) {
6666
support.log("Will load available results from simulation cache.", typeOfLogLevel.INFO);
6767
this.myListOfCompletedSimulations = mySimulationCache.getListOfCompletedSimulations(listOfParameterSetsTMP, support.getGlobalSimulationCounter(), remainingParametersets);
6868
} else {
@@ -73,6 +73,7 @@ public void run() {
7373
if (this.myListOfCompletedSimulations == null) {
7474
support.log("No Simulation found in local Cache. Starting simulation.", typeOfLogLevel.INFO);
7575
this.myListOfCompletedSimulations = new ArrayList<>();
76+
remainingParametersets = listOfParameterSetsTMP;
7677
}
7778

7879
status = myListOfCompletedSimulations.size() * 100 / listOfParameterSetsTMP.size();

0 commit comments

Comments
 (0)