Bugfix; better name for MutateGAStandard
This commit is contained in:
		@@ -6,7 +6,7 @@ import java.util.BitSet;
 | 
			
		||||
import eva2.server.go.operators.crossover.CrossoverGANPoint;
 | 
			
		||||
import eva2.server.go.operators.crossover.InterfaceCrossover;
 | 
			
		||||
import eva2.server.go.operators.mutation.InterfaceMutation;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGAStandard;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGANBit;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationProblem;
 | 
			
		||||
import eva2.tools.math.RNG;
 | 
			
		||||
 | 
			
		||||
@@ -25,7 +25,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
 | 
			
		||||
 | 
			
		||||
    public GAIndividualBinaryData() {
 | 
			
		||||
        this.m_MutationProbability  = 0.1;
 | 
			
		||||
        this.m_MutationOperator     = new MutateGAStandard();
 | 
			
		||||
        this.m_MutationOperator     = new MutateGANBit();
 | 
			
		||||
        this.m_CrossoverProbability = 1.0;
 | 
			
		||||
        this.m_CrossoverOperator    = new CrossoverGANPoint();
 | 
			
		||||
        this.m_GenotypeLength       = 20;
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ import eva2.server.go.individuals.codings.ga.InterfaceGADoubleCoding;
 | 
			
		||||
import eva2.server.go.operators.crossover.CrossoverGANPoint;
 | 
			
		||||
import eva2.server.go.operators.crossover.InterfaceCrossover;
 | 
			
		||||
import eva2.server.go.operators.mutation.InterfaceMutation;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGAStandard;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGAUniform;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationProblem;
 | 
			
		||||
import eva2.tools.math.RNG;
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +31,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
 | 
			
		||||
 | 
			
		||||
    public GAIndividualDoubleData() {
 | 
			
		||||
        this.m_MutationProbability  = 0.1;
 | 
			
		||||
        this.m_MutationOperator     = new MutateGAStandard();
 | 
			
		||||
        this.m_MutationOperator     = new MutateGAUniform();
 | 
			
		||||
        this.m_CrossoverProbability = 0.7;
 | 
			
		||||
        this.m_CrossoverOperator    = new CrossoverGANPoint();
 | 
			
		||||
        this.m_Range                = new double[1][2];
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,11 @@ package eva2.server.go.individuals;
 | 
			
		||||
 | 
			
		||||
import java.util.BitSet;
 | 
			
		||||
 | 
			
		||||
import eva2.server.go.individuals.codings.ga.GAStandardCodingDouble;
 | 
			
		||||
import eva2.server.go.individuals.codings.ga.GAStandardCodingInteger;
 | 
			
		||||
import eva2.server.go.individuals.codings.ga.InterfaceGADoubleCoding;
 | 
			
		||||
import eva2.server.go.individuals.codings.ga.InterfaceGAIntegerCoding;
 | 
			
		||||
import eva2.server.go.operators.crossover.CrossoverGANPoint;
 | 
			
		||||
import eva2.server.go.operators.mutation.InterfaceMutation;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGAStandard;
 | 
			
		||||
import eva2.server.go.operators.mutation.MutateGANBit;
 | 
			
		||||
import eva2.server.go.problems.InterfaceOptimizationProblem;
 | 
			
		||||
import eva2.tools.math.RNG;
 | 
			
		||||
 | 
			
		||||
@@ -31,7 +29,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
 | 
			
		||||
 | 
			
		||||
    public GAIndividualIntegerData() {
 | 
			
		||||
        this.m_MutationProbability  = 0.1;
 | 
			
		||||
        this.m_MutationOperator     = new MutateGAStandard();
 | 
			
		||||
        this.m_MutationOperator     = new MutateGANBit();
 | 
			
		||||
        this.m_CrossoverProbability = 0.7;
 | 
			
		||||
        this.m_CrossoverOperator    = new CrossoverGANPoint();
 | 
			
		||||
        this.m_Range                = new int[1][2];
 | 
			
		||||
 
 | 
			
		||||
@@ -16,13 +16,13 @@ import eva2.tools.math.RNG;
 | 
			
		||||
 * Time: 10:03:37
 | 
			
		||||
 * To change this template use Options | File Templates.
 | 
			
		||||
 */
 | 
			
		||||
public class MutateGAStandard implements InterfaceMutation, java.io.Serializable {
 | 
			
		||||
public class MutateGANBit implements InterfaceMutation, java.io.Serializable {
 | 
			
		||||
    private int         m_NumberOfMutations = 1;
 | 
			
		||||
 | 
			
		||||
    public MutateGAStandard() {
 | 
			
		||||
    public MutateGANBit() {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
    public MutateGAStandard(MutateGAStandard mutator) {
 | 
			
		||||
    public MutateGANBit(MutateGANBit mutator) {
 | 
			
		||||
        this.m_NumberOfMutations     = mutator.m_NumberOfMutations;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -30,7 +30,7 @@ public class MutateGAStandard implements InterfaceMutation, java.io.Serializable
 | 
			
		||||
     * @return The clone
 | 
			
		||||
     */
 | 
			
		||||
    public Object clone() {
 | 
			
		||||
        return new MutateGAStandard(this);
 | 
			
		||||
        return new MutateGANBit(this);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /** This method allows you to evaluate wether two mutation operators
 | 
			
		||||
@@ -38,8 +38,8 @@ public class MutateGAStandard implements InterfaceMutation, java.io.Serializable
 | 
			
		||||
     * @param mutator   The other mutation operator
 | 
			
		||||
     */
 | 
			
		||||
    public boolean equals(Object mutator) {
 | 
			
		||||
        if (mutator instanceof MutateGAStandard) {
 | 
			
		||||
            MutateGAStandard mut = (MutateGAStandard)mutator;
 | 
			
		||||
        if (mutator instanceof MutateGANBit) {
 | 
			
		||||
            MutateGANBit mut = (MutateGANBit)mutator;
 | 
			
		||||
            if (this.m_NumberOfMutations != mut.m_NumberOfMutations) return false;
 | 
			
		||||
            return true;
 | 
			
		||||
        } else return false;
 | 
			
		||||
@@ -86,7 +86,7 @@ public class MutateGAStandard implements InterfaceMutation, java.io.Serializable
 | 
			
		||||
     * @return A descriptive string.
 | 
			
		||||
     */
 | 
			
		||||
    public String getStringRepresentation() {
 | 
			
		||||
        return "GA standard mutation";
 | 
			
		||||
        return "GA n-Bit mutation";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
/**********************************************************************************************************************
 | 
			
		||||
@@ -97,13 +97,13 @@ public class MutateGAStandard implements InterfaceMutation, java.io.Serializable
 | 
			
		||||
     * @return The name.
 | 
			
		||||
     */
 | 
			
		||||
    public String getName() {
 | 
			
		||||
        return "GA standard mutation";
 | 
			
		||||
        return "GA n-Bit mutation";
 | 
			
		||||
    }
 | 
			
		||||
    /** This method returns a global info string
 | 
			
		||||
     * @return description
 | 
			
		||||
     */
 | 
			
		||||
    public static String globalInfo() {
 | 
			
		||||
        return "The standard mutation switches n bits of the GA genotype.";
 | 
			
		||||
        return "Switch n bits of the GA genotype.";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /** This method allows you to set the number of mutations that occur in the
 | 
			
		||||
@@ -51,7 +51,7 @@ public class MutateGAUniform implements InterfaceMutation, Serializable {
 | 
			
		||||
 | 
			
		||||
	public void init(AbstractEAIndividual individual,
 | 
			
		||||
			InterfaceOptimizationProblem opt) {
 | 
			
		||||
		if (useInvertedLength && (individual instanceof InterfaceGAIndividual)) setBitwiseProb(((InterfaceGAIndividual)individual).getGenotypeLength());
 | 
			
		||||
		if (useInvertedLength && (individual instanceof InterfaceGAIndividual)) setBitwiseProb(1./((double)((InterfaceGAIndividual)individual).getGenotypeLength()));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@@ -70,6 +70,7 @@ public class MutateGAUniform implements InterfaceMutation, Serializable {
 | 
			
		||||
		return bitwiseProb;
 | 
			
		||||
	}
 | 
			
		||||
	public void setBitwiseProb(double bitwiseProb) {
 | 
			
		||||
		if (bitwiseProb <0. && (bitwiseProb > 1.)) System.err.println("Warning, probability should be within [0,1], given: " + bitwiseProb); 
 | 
			
		||||
		this.bitwiseProb = bitwiseProb;
 | 
			
		||||
	}
 | 
			
		||||
	public String bitwiseProbTipText() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user