Changed InterfaceMutationGenerational to InterfaceAdaptOperatorGenerational
This commit is contained in:
parent
215eeea57b
commit
767ada2371
@ -3,7 +3,7 @@ package eva2.server.go.individuals;
|
||||
import java.util.BitSet;
|
||||
|
||||
/** 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.
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
|
@ -3,7 +3,7 @@ package eva2.server.go.individuals;
|
||||
import java.util.BitSet;
|
||||
|
||||
/** 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.
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
|
@ -10,7 +10,7 @@ import eva2.server.go.populations.Population;
|
||||
* @author mkron
|
||||
*
|
||||
*/
|
||||
public interface InterfaceMutationGenerational extends InterfaceMutation {
|
||||
public interface InterfaceAdaptOperatorGenerational {
|
||||
|
||||
/**
|
||||
* Perform adaption of the operator based on the selection performed by an EA.
|
@ -7,8 +7,8 @@ import eva2.server.go.problems.InterfaceOptimizationProblem;
|
||||
import eva2.tools.math.Jama.Matrix;
|
||||
|
||||
public class MutateESCovarianceMatrixAdaptionPlus extends
|
||||
MutateESCovarianceMatrixAdaption implements
|
||||
InterfaceMutationGenerational {
|
||||
MutateESCovarianceMatrixAdaption implements InterfaceMutation,
|
||||
InterfaceAdaptOperatorGenerational {
|
||||
protected double m_psuccess;
|
||||
protected double m_cp;
|
||||
protected double m_psuccesstarget = 0.44;
|
||||
|
@ -243,7 +243,7 @@ class CMAParamSet implements InterfacePopulationChangedEventListener, Serializab
|
||||
* @author mkron
|
||||
*
|
||||
*/
|
||||
public class MutateESRankMuCMA implements InterfaceMutationGenerational, Serializable {
|
||||
public class MutateESRankMuCMA implements InterfaceMutation, InterfaceAdaptOperatorGenerational, Serializable {
|
||||
// int dim;
|
||||
private double c_c, expRandStepLen;
|
||||
|
||||
|
@ -14,7 +14,7 @@ import eva2.tools.math.RNG;
|
||||
* Time: 14:11:49
|
||||
* 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
|
||||
// no one could runs n independent ES runs in parallel anymore *sigh*
|
||||
// protected static double m_MutationStepSize = 0.2;
|
||||
|
@ -4,7 +4,7 @@ import eva2.gui.BeanInspector;
|
||||
import eva2.gui.GenericObjectEditor;
|
||||
import eva2.server.go.InterfacePopulationChangedEventListener;
|
||||
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.selection.InterfaceSelection;
|
||||
import eva2.server.go.operators.selection.SelectBestIndividuals;
|
||||
@ -157,10 +157,10 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
|
||||
|
||||
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
|
||||
// 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;
|
||||
@ -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()));
|
||||
|
||||
// m_Population / parents are of sizes lambda / mu
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) {
|
||||
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(getPopulation(), parents);
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
|
||||
((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(getPopulation(), parents);
|
||||
}
|
||||
|
||||
// now generate the lambda offsprings
|
||||
|
@ -2,7 +2,7 @@ package eva2.server.go.strategies;
|
||||
|
||||
import eva2.server.go.InterfacePopulationChangedEventListener;
|
||||
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.SelectRandom;
|
||||
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());
|
||||
// double[] meas = parents.getPopulationMeasures();
|
||||
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) {
|
||||
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(m_Population, parents);
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
|
||||
((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptAfterSelection(m_Population, parents);
|
||||
}
|
||||
|
||||
for (int i = 0; i < parents.size(); i++) {
|
||||
@ -133,8 +133,8 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
||||
}
|
||||
this.evaluatePopulation(result);
|
||||
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceMutationGenerational) {
|
||||
((InterfaceMutationGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(m_Population, parents, result, true);
|
||||
if (parents.getEAIndividual(0).getMutationOperator() instanceof InterfaceAdaptOperatorGenerational) {
|
||||
((InterfaceAdaptOperatorGenerational)parents.getEAIndividual(0).getMutationOperator()).adaptGenerational(m_Population, parents, result, true);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user