Skip to content
Snippets Groups Projects
Commit b2a525ce authored by René Schöne's avatar René Schöne
Browse files

Recent update for ACO solver.

- smaller default population and iteration size
- obey to timeout
parent 372223c3
Branches
Tags
No related merge requests found
......@@ -22,8 +22,8 @@ import java.util.concurrent.TimeUnit;
*/
public class ACOSolver implements BenchmarkableSolver {
int population_size = 100000;
int iteration_size = 20;
int population_size = 5;
int iteration_size = 1;
private static final Logger logger = LogManager.getLogger(ACOSolver.class);
......@@ -120,6 +120,11 @@ public class ACOSolver implements BenchmarkableSolver {
for (int pop = 0; pop < population_size; pop++) {
if (stopWatch.time(TimeUnit.MILLISECONDS) > maxSolvingTime) {
timedOut = true;
break;
}
logger.trace("pop: {}", pop);
Solution currentSolution = new Solution();
currentSolution.setModel(model);
......@@ -197,6 +202,11 @@ public class ACOSolver implements BenchmarkableSolver {
}
for (int iteration = 0; iteration < iteration_size; iteration++) {
if (stopWatch.time(TimeUnit.MILLISECONDS) > maxSolvingTime) {
timedOut = true;
break;
}
List<Ant> population = new ArrayList<>();
for (int i = 0; i < currentSolutions.size(); i++) {
Ant ant = new Ant(i, currentSolutions.get(i), currentPossibleResources.get(i), currentEta.get(i), currentSort.get(i), numAssignments);
......@@ -227,11 +237,8 @@ public class ACOSolver implements BenchmarkableSolver {
antSolution.computeObjective());
}
}
ant = null;
}
});
population = null;
System.gc();
}
logger.info("Number of total software solutions: {}", numTotalSoftwareSolutions);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment