Fix nelderMead

This commit is contained in:
Fabian Becker 2015-12-05 17:16:10 +01:00
parent c7fc9b9d67
commit 2626204579
3 changed files with 5 additions and 10 deletions

View File

@ -2,7 +2,7 @@ package eva2.optimization.individuals;
/** /**
* This interface gives access to a integer phenotype and except * This interface gives access to a integer phenotype and except
* for problemspecific operators should only be used by the * for problem specific operators should only be used by the
* optimization problem. * optimization problem.
*/ */
public interface InterfaceDataTypeInteger { public interface InterfaceDataTypeInteger {
@ -10,7 +10,7 @@ public interface InterfaceDataTypeInteger {
/** /**
* This method allows you to request a certain amount of int data * This method allows you to request a certain amount of int data
* *
* @param length The lenght of the int[] that is to be optimized * @param length The length of the int[] that is to be optimized
*/ */
void setIntegerDataLength(int length); void setIntegerDataLength(int length);

View File

@ -152,7 +152,7 @@ public class SolutionHistogram {
* This resets the arity. * This resets the arity.
* *
* @param pop * @param pop
* @param hist * @param crit
*/ */
public void updateFrom(Population pop, int crit) { public void updateFrom(Population pop, int crit) {
SolutionHistogram.createFitNormHistogram(pop, this, crit); SolutionHistogram.createFitNormHistogram(pop, this, crit);
@ -176,10 +176,6 @@ public class SolutionHistogram {
return res; return res;
} }
// public void updateFrom(Population pop, double accuracy) {
//
// }
public double getScore() { public double getScore() {
double sc = 0; double sc = 0;
if (sum() > 0) { if (sum() > 0) {

View File

@ -28,7 +28,6 @@ public class NelderMeadSimplex extends AbstractOptimizer implements Serializable
// simulating the generational cycle. Set rather small (eg 5) for use as local search, higher for global search (eg 50) // simulating the generational cycle. Set rather small (eg 5) for use as local search, higher for global search (eg 50)
private int generationCycle = 50; private int generationCycle = 50;
private int fitIndex = 0; // choose criterion for multi objective functions private int fitIndex = 0; // choose criterion for multi objective functions
private AbstractOptimizationProblem optimizationProblem;
private boolean checkConstraints = true; private boolean checkConstraints = true;
public NelderMeadSimplex() { public NelderMeadSimplex() {
@ -219,7 +218,7 @@ public class NelderMeadSimplex extends AbstractOptimizer implements Serializable
// this simulates the generational loop expected by some other modules // this simulates the generational loop expected by some other modules
int evalCntStart = population.getFunctionCalls(); int evalCntStart = population.getFunctionCalls();
int evalsDone = 0; int evalsDone = 0;
optimizationProblem.evaluatePopulationStart(population); ((AbstractOptimizationProblem)this.optimizationProblem).evaluatePopulationStart(population);
do { do {
AbstractEAIndividual ind = simplexStep(population); AbstractEAIndividual ind = simplexStep(population);
if (ind != null) { //Verbesserung gefunden if (ind != null) { //Verbesserung gefunden
@ -245,7 +244,7 @@ public class NelderMeadSimplex extends AbstractOptimizer implements Serializable
} }
evalsDone = population.getFunctionCalls() - evalCntStart; evalsDone = population.getFunctionCalls() - evalCntStart;
} while (evalsDone < generationCycle); } while (evalsDone < generationCycle);
optimizationProblem.evaluatePopulationEnd(population); ((AbstractOptimizationProblem)optimizationProblem).evaluatePopulationEnd(population);
this.population.incrGeneration(); this.population.incrGeneration();
} }