#12 -- Fix threads
This commit is contained in:
parent
dbcadcb4aa
commit
4e6c79f837
@ -33,7 +33,8 @@ class MethodParamBruteForce {
|
||||
private final int DEFAULT_THREAD_COUNT = 50;
|
||||
private final List<Method> methods;
|
||||
private final ScoreMethod scoreMethod = new Smape();
|
||||
private final ExecutorService executors = Executors.newFixedThreadPool(DEFAULT_THREAD_COUNT);
|
||||
private final ExecutorService executors = Executors.newCachedThreadPool();
|
||||
;
|
||||
|
||||
public MethodParamBruteForce(List<Method> methods) {
|
||||
this.methods = methods;
|
||||
@ -74,7 +75,7 @@ class MethodParamBruteForce {
|
||||
for (Future<ModelingResult> futureModelingResult : futureModelingResults) {
|
||||
modelingResults.add(futureModelingResult.get());
|
||||
}
|
||||
|
||||
System.gc();
|
||||
return getBestResultForecast(modelingResults, timeSeries, countPoints);
|
||||
}
|
||||
|
||||
@ -159,6 +160,7 @@ class MethodParamBruteForce {
|
||||
for (Future<ModelingResult> futureModelingResult : results) {
|
||||
results2.add(futureModelingResult.get());
|
||||
}
|
||||
System.gc();
|
||||
return results2.stream()
|
||||
.min(Comparator.comparing(modelingResult -> modelingResult.getScore().getDoubleValue()))
|
||||
.orElse(null);
|
||||
@ -189,6 +191,7 @@ class MethodParamBruteForce {
|
||||
for (Future<ModelingResult> futureModelingResult : results) {
|
||||
results2.add(futureModelingResult.get());
|
||||
}
|
||||
System.gc();
|
||||
return results2.stream()
|
||||
.min(Comparator.comparing(modelingResult -> modelingResult.getScore().getDoubleValue()))
|
||||
.orElse(null);
|
||||
|
Loading…
Reference in New Issue
Block a user