Closed HeuristicLab-Trac-Bot closed 13 years ago
Implemented that the
ExecutionStack
(and consequently also allExecutionContexts
) is cleared inEngine
, if the engine is stopped (see ticket #1333 and r5193).
Cleared global scope after an
EngineAlgorithm
is stopped in r5195.
Additionally, I think we should get rid of storing a clone of the algorithm in each run. This also requires a lot of memory which probably is not really worth it. I think that the feature to show the corresponding algorithm for a run is not really frequently used.
I agree that storing a clone of the algorithm in each run can become a huge memory-overhead. But maybe it would be enough to just make it an opt-in feature, rather than opt-out.
The following test shows that there may still be a problem with file sizes and memory consumption after the recent changes.
- Algorithm: Genetic Algorithm (
MaxGenerations
: 15,PopulationSize
: 2000)- Problem: Single Objective Testfunction (
ProblemSize
: 2000)StoreAlgorithmInEachRun
: falseThe following numbers show file-sizes when the algorihm is stored:
- Before algorithm started: 37KB
- After algorithm paused: 97MB
- After algorithm stopped: 73MB
- After algorithm prepared: 36MB
- After clearing runs: 38KB!
The recent changes help to release ~24MB of memory when the algorithm stops, yet ~37MB can still be released by calling "prepare".
Also interesting and maybe a different problem is that by clearing the
ResultCollection
(which contained only 1 run), almost ~36MB of memory were released. I further investigated this issue and found that one problem might be the aSingleObjectiveTestFunctionSolution
object contains a reference to the whole population. Therefore theBestSolution
in a run also contains a reference to the whole population which in this case leads to a large memory consumption.
Changed storing the algorithm in each run into an opt-in feature in r5203.
Replying to [comment:8 cneumuel]:
The following test shows that there may still be a problem with file sizes and memory consumption after the recent changes.
- Algorithm: Genetic Algorithm (
MaxGenerations
: 15,PopulationSize
: 2000)- Problem: Single Objective Testfunction (
ProblemSize
: 2000)StoreAlgorithmInEachRun
: falseThe following numbers show file-sizes when the algorihm is stored:
- Before algorithm started: 37KB
- After algorithm paused: 97MB
- After algorithm stopped: 73MB
- After algorithm prepared: 36MB
- After clearing runs: 38KB!
The recent changes help to release ~24MB of memory when the algorithm stops, yet ~37MB can still be released by calling "prepare".
Also interesting and maybe a different problem is that by clearing the
ResultCollection
(which contained only 1 run), almost ~36MB of memory were released. I further investigated this issue and found that one problem might be the aSingleObjectiveTestFunctionSolution
object contains a reference to the whole population. Therefore theBestSolution
in a run also contains a reference to the whole population which in this case leads to a large memory consumption.Yes, the large file sizes of case 3 and 4 result from storing the whole population in the
SingleObjectiveTestFunctionSolution
and consequently also in theBestSolution
result (which is contained in the results as well as in each run). We decided to store the whole population in order to be able to visualize the whole population graphically. However, this is only possible in the 2D case. If the problem dimension is larger than 2, the graphical solution visualization is not available. Therefore, we should only store the whole population in the 2D case. I created a separate ticket #1360 for this issue.
Tested the same algorithm with the recent changes:
- Before algorithm started: 37KB
- After algorithm paused: 105MB
- After algorithm stopped: 84KB
- After algorithm prepared: 64KB
- After clearing runs: 38KB
Issue migrated from trac ticket # 1355
milestone: HeuristicLab 3.3.3 | component: Optimization | priority: high | resolution: done
2010-12-30 01:32:54: @discostu105 created the issue