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;
|
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())) {
|
while (isOptimizationRunning() && (runCounter < statistics.getStatisticsParameter().getMultiRuns())) {
|
||||||
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameter().getMultiRuns()));
|
LOGGER.info(String.format("Starting Optimization %d/%d", runCounter + 1, statistics.getStatisticsParameter().getMultiRuns()));
|
||||||
statistics.startOptimizationPerformed(getInfoString(), runCounter, optimizationParameters, getInformerList());
|
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);
|
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);
|
maybeUpdateParamCtrl(optimizationParameters);
|
||||||
|
|
||||||
this.optimizationParameters.getOptimizer().optimize();
|
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++;
|
runCounter++;
|
||||||
maybeFinishParamCtrl(optimizationParameters);
|
maybeFinishParamCtrl(optimizationParameters);
|
||||||
|
@ -696,8 +696,7 @@ public class DifferentialEvolution extends AbstractOptimizer implements java.io.
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InterfaceSolutionSet getAllSolutions() {
|
public InterfaceSolutionSet getAllSolutions() {
|
||||||
Population pop = getPopulation();
|
return new SolutionSet(this.population);
|
||||||
return new SolutionSet(pop, pop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This method evaluates a given population and set the fitness values
|
* 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.
|
* @param population The population that is to be evaluated.
|
||||||
*/
|
*/
|
||||||
@ -120,7 +120,6 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
|||||||
evaluatePopulationStart(population);
|
evaluatePopulationStart(population);
|
||||||
|
|
||||||
if (this.parallelThreads > 1) {
|
if (this.parallelThreads > 1) {
|
||||||
Vector<AbstractEAIndividual> queue = new Vector<>(population.size());
|
|
||||||
Semaphore sema = new Semaphore(0);
|
Semaphore sema = new Semaphore(0);
|
||||||
ExecutorService pool = Executors.newFixedThreadPool(parallelThreads);
|
ExecutorService pool = Executors.newFixedThreadPool(parallelThreads);
|
||||||
int cntIndies = 0;
|
int cntIndies = 0;
|
||||||
|
@ -39,8 +39,8 @@ public interface InterfaceOptimizationProblem extends InterfaceAdditionalPopulat
|
|||||||
public void initializePopulation(Population population);
|
public void initializePopulation(Population population);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method evaluates a given population and set the fitness values
|
* This method evaluates a given population and sets the fitness values
|
||||||
* accordingly
|
* accordingly. It also keeps track of the function call count.
|
||||||
*
|
*
|
||||||
* @param population The population that is to be evaluated.
|
* @param population The population that is to be evaluated.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user