Minor additions to MutateEAMixer and MatlabProblem

This commit is contained in:
Marcel Kronfeld 2010-11-11 10:17:56 +00:00
parent a2b88073ba
commit 65632f4cf9
2 changed files with 13 additions and 2 deletions

View File

@ -49,6 +49,16 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable {
this.m_Mutators.setWeightsLabel("Weigths"); this.m_Mutators.setWeightsLabel("Weigths");
} }
/**
* Create a mutation mixer with equal weights of the given mutation operators.
* @param mutators
*/
public MutateEAMixer(InterfaceMutation[] mutators) {
this.m_Mutators = new PropertyMutationMixer(mutators);
this.m_UseSelfAdaption = false;
}
public MutateEAMixer(MutateEAMixer mutator) { public MutateEAMixer(MutateEAMixer mutator) {
this.m_Mutators = (PropertyMutationMixer)mutator.m_Mutators.clone(); this.m_Mutators = (PropertyMutationMixer)mutator.m_Mutators.clone();
this.m_UseSelfAdaption = mutator.m_UseSelfAdaption; this.m_UseSelfAdaption = mutator.m_UseSelfAdaption;
@ -150,7 +160,7 @@ public class MutateEAMixer implements InterfaceMutation, java.io.Serializable {
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This mmeta-mutation operator allows you to combine multiple alternative mutation operators."; return "This meta-mutation operator allows you to combine multiple alternative mutation operators.";
} }
/** Choose the set of mutators. /** Choose the set of mutators.

View File

@ -52,6 +52,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
public MatlabProblem(MatlabProblem o) { public MatlabProblem(MatlabProblem o) {
// this.matlab = o.matlab; // this.matlab = o.matlab;
this.m_Template=null;
this.handler = o.handler; this.handler = o.handler;
this.runnable = o.runnable; this.runnable = o.runnable;
this.allowSingleRunnable = o.allowSingleRunnable; this.allowSingleRunnable = o.allowSingleRunnable;
@ -99,7 +100,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(range); ((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(range);
} }
} else { } else {
m_Template = new GAIndividualIntegerData(); if (m_Template == null) m_Template = new GAIndividualIntegerData();
int intLen = 1+((getProblemDimension()-1)/32); int intLen = 1+((getProblemDimension()-1)/32);
int lastIntCodingBits = getProblemDimension()-((intLen-1)*32); int lastIntCodingBits = getProblemDimension()-((intLen-1)*32);
if (lastIntCodingBits > 32) System.err.println("ERROR in MatlabProblem:initTemplate"); if (lastIntCodingBits > 32) System.err.println("ERROR in MatlabProblem:initTemplate");