Changed InterfaceMutationGenerational to InterfaceAdaptOperatorGenerational

This commit is contained in:
Marcel Kronfeld 2011-03-14 13:58:49 +00:00
parent 215eeea57b
commit 767ada2371
8 changed files with 17 additions and 17 deletions

View File

@ -3,7 +3,7 @@ package eva2.server.go.individuals;
import java.util.BitSet; import java.util.BitSet;
/** This interface gives access to a binary phenotype and except /** This interface gives access to a binary 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.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche

View File

@ -3,7 +3,7 @@ package eva2.server.go.individuals;
import java.util.BitSet; import java.util.BitSet;
/** This interface gives access to a binary genotype and should /** This interface gives access to a binary genotype and should
* only be used by mutation and crossover operators. Onyl exception are * only be used by mutation and crossover operators. Exceptions are
* data type specific optimization strategies like CHC or PBIL. * data type specific optimization strategies like CHC or PBIL.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche

View File

@ -10,7 +10,7 @@ import eva2.server.go.populations.Population;
* @author mkron * @author mkron
* *
*/ */
public interface InterfaceMutationGenerational extends InterfaceMutation { public interface InterfaceAdaptOperatorGenerational {
/** /**
* Perform adaption of the operator based on the selection performed by an EA. * Perform adaption of the operator based on the selection performed by an EA.

View File

@ -7,8 +7,8 @@ import eva2.server.go.problems.InterfaceOptimizationProblem;
import eva2.tools.math.Jama.Matrix; import eva2.tools.math.Jama.Matrix;
public class MutateESCovarianceMatrixAdaptionPlus extends public class MutateESCovarianceMatrixAdaptionPlus extends
MutateESCovarianceMatrixAdaption implements MutateESCovarianceMatrixAdaption implements InterfaceMutation,
InterfaceMutationGenerational { InterfaceAdaptOperatorGenerational {
protected double m_psuccess; protected double m_psuccess;
protected double m_cp; protected double m_cp;
protected double m_psuccesstarget = 0.44; protected double m_psuccesstarget = 0.44;

View File

@ -243,7 +243,7 @@ class CMAParamSet implements InterfacePopulationChangedEventListener, Serializab
* @author mkron * @author mkron
* *
*/ */
public class MutateESRankMuCMA implements InterfaceMutationGenerational, Serializable { public class MutateESRankMuCMA implements InterfaceMutation, InterfaceAdaptOperatorGenerational, Serializable {
// int dim; // int dim;
private double c_c, expRandStepLen; private double c_c, expRandStepLen;

View File

@ -14,7 +14,7 @@ import eva2.tools.math.RNG;
* Time: 14:11:49 * Time: 14:11:49
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class MutateESSuccessRule extends MutateESFixedStepSize implements InterfaceMutationGenerational, java.io.Serializable { public class MutateESSuccessRule extends MutateESFixedStepSize implements InterfaceMutation, InterfaceAdaptOperatorGenerational, java.io.Serializable {
// it would be quite nice to make this variable static, but in that case // it would be quite nice to make this variable static, but in that case
// no one could runs n independent ES runs in parallel anymore *sigh* // no one could runs n independent ES runs in parallel anymore *sigh*
// protected static double m_MutationStepSize = 0.2; // protected static double m_MutationStepSize = 0.2;

View File

@ -4,7 +4,7 @@ import eva2.gui.BeanInspector;
import eva2.gui.GenericObjectEditor; import eva2.gui.GenericObjectEditor;
import eva2.server.go.InterfacePopulationChangedEventListener; import eva2.server.go.InterfacePopulationChangedEventListener;
import eva2.server.go.individuals.AbstractEAIndividual; import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.mutation.InterfaceMutationGenerational; import eva2.server.go.operators.mutation.InterfaceAdaptOperatorGenerational;
import eva2.server.go.operators.mutation.MutateESSuccessRule; import eva2.server.go.operators.mutation.MutateESSuccessRule;
import eva2.server.go.operators.selection.InterfaceSelection; import eva2.server.go.operators.selection.InterfaceSelection;
import eva2.server.go.operators.selection.SelectBestIndividuals; import eva2.server.go.operators.selection.SelectBestIndividuals;
@ -157,10 +157,10 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
this.evaluatePopulation(result); this.evaluatePopulation(result);
if (result.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) { if (result.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
// this seems to be the right moment for the 1/5-success rule // this seems to be the right moment for the 1/5-success rule
// parents and result have the same size and correspond per individual // parents and result have the same size and correspond per individual
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(fromPopulation, parents, result, m_UsePlusStrategy); ((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(fromPopulation, parents, result, m_UsePlusStrategy);
} }
return result; return result;
@ -214,8 +214,8 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
// System.out.println("-- selected avg fit " + BeanInspector.toString(parents.getMeanFitness()) + " from last gen " + BeanInspector.toString(m_Population.getMeanFitness())); // System.out.println("-- selected avg fit " + BeanInspector.toString(parents.getMeanFitness()) + " from last gen " + BeanInspector.toString(m_Population.getMeanFitness()));
// m_Population / parents are of sizes lambda / mu // m_Population / parents are of sizes lambda / mu
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) { if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(getPopulation(), parents); ((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(getPopulation(), parents);
} }
// now generate the lambda offsprings // now generate the lambda offsprings

View File

@ -2,7 +2,7 @@ package eva2.server.go.strategies;
import eva2.server.go.InterfacePopulationChangedEventListener; import eva2.server.go.InterfacePopulationChangedEventListener;
import eva2.server.go.individuals.AbstractEAIndividual; import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.mutation.InterfaceMutationGenerational; import eva2.server.go.operators.mutation.InterfaceAdaptOperatorGenerational;
import eva2.server.go.operators.selection.InterfaceSelection; import eva2.server.go.operators.selection.InterfaceSelection;
import eva2.server.go.operators.selection.SelectRandom; import eva2.server.go.operators.selection.SelectRandom;
import eva2.server.go.operators.selection.SelectXProbRouletteWheel; import eva2.server.go.operators.selection.SelectXProbRouletteWheel;
@ -115,8 +115,8 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
// System.out.println("Parents:"+parents.getStringRepresentation()); // System.out.println("Parents:"+parents.getStringRepresentation());
// double[] meas = parents.getPopulationMeasures(); // double[] meas = parents.getPopulationMeasures();
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) { if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(m_Population, parents); ((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(m_Population, parents);
} }
for (int i = 0; i < parents.size(); i++) { for (int i = 0; i < parents.size(); i++) {
@ -133,8 +133,8 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
} }
this.evaluatePopulation(result); this.evaluatePopulation(result);
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) { if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(m_Population, parents, result, true); ((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(m_Population, parents, result, true);
} }
return result; return result;
} }