Small cleanup and better documentation.
This commit is contained in:
parent
ca30e6c705
commit
5bd11e4624
@ -225,6 +225,10 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
|
||||
runCounter = 0;
|
||||
|
||||
/**
|
||||
* We keep the optimization running until it is aborted by the user or
|
||||
* the number of multiple runs has been reached.
|
||||
*/
|
||||
while (isOptimizationRunning() && (runCounter < statistics.getStatisticsParameter().getMultiRuns())) {
|
||||
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameter().getMultiRuns()));
|
||||
statistics.startOptimizationPerformed(getInfoString(), runCounter, optimizationParameters, getInformerList());
|
||||
@ -241,12 +245,16 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
optimizationStateListener.updateProgress(getStatusPercent(optimizationParameters.getOptimizer().getPopulation(), runCounter, statistics.getStatisticsParameter().getMultiRuns()), null);
|
||||
}
|
||||
|
||||
do { // main loop
|
||||
/**
|
||||
* This is the main optimization loop. We keep calling
|
||||
* optimize() until a termination criterion is met or
|
||||
* the user aborts the optimization manually.
|
||||
*/
|
||||
do {
|
||||
maybeUpdateParamCtrl(optimizationParameters);
|
||||
|
||||
this.optimizationParameters.getOptimizer().optimize();
|
||||
}
|
||||
while (isOptimizationRunning() && !this.optimizationParameters.getTerminator().isTerminated(this.optimizationParameters.getOptimizer().getAllSolutions()));
|
||||
} while (isOptimizationRunning() && !this.optimizationParameters.getTerminator().isTerminated(this.optimizationParameters.getOptimizer().getAllSolutions()));
|
||||
|
||||
runCounter++;
|
||||
maybeFinishParamCtrl(optimizationParameters);
|
||||
|
@ -696,8 +696,7 @@ public class DifferentialEvolution extends AbstractOptimizer implements java.io.
|
||||
|
||||
@Override
|
||||
public InterfaceSolutionSet getAllSolutions() {
|
||||
Population pop = getPopulation();
|
||||
return new SolutionSet(pop, pop);
|
||||
return new SolutionSet(this.population);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +110,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
|
||||
/**
|
||||
* This method evaluates a given population and set the fitness values
|
||||
* accordingly
|
||||
* accordingly. It also keeps track of the function call count.
|
||||
*
|
||||
* @param population The population that is to be evaluated.
|
||||
*/
|
||||
@ -120,7 +120,6 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
evaluatePopulationStart(population);
|
||||
|
||||
if (this.parallelThreads > 1) {
|
||||
Vector<AbstractEAIndividual> queue = new Vector<>(population.size());
|
||||
Semaphore sema = new Semaphore(0);
|
||||
ExecutorService pool = Executors.newFixedThreadPool(parallelThreads);
|
||||
int cntIndies = 0;
|
||||
|
@ -39,8 +39,8 @@ public interface InterfaceOptimizationProblem extends InterfaceAdditionalPopulat
|
||||
public void initializePopulation(Population population);
|
||||
|
||||
/**
|
||||
* This method evaluates a given population and set the fitness values
|
||||
* accordingly
|
||||
* This method evaluates a given population and sets the fitness values
|
||||
* accordingly. It also keeps track of the function call count.
|
||||
*
|
||||
* @param population The population that is to be evaluated.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user