Lots of refactoring.
* Renamed m_foo variables to proper names. * Renamed methods with abbreviated names * Code formatting for better readability * Removed commented code
This commit is contained in:
parent
bcf9e6fd6f
commit
bf1af304dd
@ -124,7 +124,7 @@ public class OptimizerFactory {
|
||||
double lambda, double CR,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0);
|
||||
|
||||
@ -205,7 +205,7 @@ public class OptimizerFactory {
|
||||
InterfaceSelection selection, AbstractOptimizationProblem problem,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
AbstractEAIndividual tmpIndi = problem.getIndividualTemplate();
|
||||
AbstractEAIndividual.setOperators(tmpIndi, mutationoperator, pm, crossoveroperator, pc);
|
||||
@ -243,7 +243,7 @@ public class OptimizerFactory {
|
||||
AbstractOptimizationProblem problem,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
setTemplateOperators(problem, mut, pm, cross, pc);
|
||||
|
||||
@ -317,7 +317,7 @@ public class OptimizerFactory {
|
||||
AbstractOptimizationProblem problem,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
subOpt.setProblem(problem);
|
||||
|
||||
return new MultiObjectiveEA(subOpt, archiving, archiveSize,
|
||||
@ -335,7 +335,7 @@ public class OptimizerFactory {
|
||||
|
||||
System.err.println("Currently not implemented!");
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
AbstractEAIndividual tmpIndi = problem.getIndividualTemplate();
|
||||
tmpIndi.setCrossoverOperator(new NoCrossover());
|
||||
@ -375,7 +375,7 @@ public class OptimizerFactory {
|
||||
AbstractOptimizationProblem problem,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
setTemplateOperators(problem, mutator, 1., new NoCrossover(), 0);
|
||||
|
||||
@ -406,7 +406,7 @@ public class OptimizerFactory {
|
||||
AbstractOptimizationProblem problem, int popsize,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0);
|
||||
|
||||
MonteCarloSearch mc = new MonteCarloSearch();
|
||||
@ -443,7 +443,7 @@ public class OptimizerFactory {
|
||||
double phi2, double speedLim, PSOTopologyEnum selectedTopology, int topologyRange,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
setTemplateOperators(problem, new NoMutation(), 0, new NoCrossover(), 0);
|
||||
|
||||
@ -484,7 +484,7 @@ public class OptimizerFactory {
|
||||
double temperature, InterfaceMutation mut,
|
||||
InterfacePopulationChangedEventListener listener) {
|
||||
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
|
||||
setTemplateOperators(problem, mut, 1, new NoCrossover(), 0);
|
||||
|
||||
@ -520,7 +520,7 @@ public class OptimizerFactory {
|
||||
double learningRate, double mutateSigma, double mutationRate,
|
||||
int positiveSamples, InterfaceSelection selection, int popsize,
|
||||
AbstractOptimizationProblem problem, InterfacePopulationChangedEventListener listener) {
|
||||
problem.initProblem();
|
||||
problem.initializeProblem();
|
||||
PopulationBasedIncrementalLearning pbil = new PopulationBasedIncrementalLearning();
|
||||
|
||||
pbil.setLearningRate(learningRate);
|
||||
@ -771,7 +771,7 @@ public class OptimizerFactory {
|
||||
InterfaceTerminator term) {
|
||||
Population pop = new Population(popSize);
|
||||
RNG.setRandomSeed(seed);
|
||||
problem.initPopulation(pop);
|
||||
problem.initializePopulation(pop);
|
||||
return makeParams(opt, pop, problem, seed, term);
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
transient private boolean show = false;
|
||||
// transient private InterfaceTest test = new Test1();
|
||||
// Opt. Algorithms and Parameters
|
||||
//transient private InterfaceOptimizer m_Optimizer = new EvolutionaryMultiObjectiveOptimization();
|
||||
//transient private InterfaceOptimizationProblem m_Problem = new TF1Problem();
|
||||
//transient private int m_FunctionCalls = 1000;
|
||||
//transient private InterfaceOptimizer optimizer = new EvolutionaryMultiObjectiveOptimization();
|
||||
//transient private InterfaceOptimizationProblem problem = new TF1Problem();
|
||||
//transient private int functionCalls = 1000;
|
||||
private GOParameters m_GO;
|
||||
transient private int m_MultiRuns = 1;
|
||||
transient private int m_RecentFC;
|
||||
@ -324,7 +324,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
((GAIndividualDoubleData) tmpIndy).setCrossoverProbability(1.0);
|
||||
((GAIndividualDoubleData) tmpIndy).setMutationProbability(1.0);
|
||||
((F1Problem) problem).setEAIndividual(tmpIndy);
|
||||
//((FGRNInferringProblem)this.m_Problem).setStructreSkelInterval(1);
|
||||
//((FGRNInferringProblem)this.problem).setStructreSkelInterval(1);
|
||||
this.m_GO.getOptimizer().setProblem(problem);
|
||||
this.m_GO.getOptimizer().addPopulationChangedEventListener(this);
|
||||
this.doWork();
|
||||
@ -340,8 +340,8 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
tmpIndy = new ESIndividualDoubleData();
|
||||
((AbstractEAIndividual) tmpIndy).setMutationOperator(new MutateESLocal());
|
||||
((F1Problem) problem).setEAIndividual(tmpIndy);
|
||||
//((FGRNInferringProblem)this.m_Problem).setUseHEigenMatrix(true);
|
||||
//((FGRNInferringProblem)this.m_Problem).setUseOnlyPositiveNumbers(true);
|
||||
//((FGRNInferringProblem)this.problem).setUseHEigenMatrix(true);
|
||||
//((FGRNInferringProblem)this.problem).setUseOnlyPositiveNumbers(true);
|
||||
this.m_GO.getOptimizer().setProblem(problem);
|
||||
this.m_GO.getOptimizer().addPopulationChangedEventListener(this);
|
||||
this.doWork();
|
||||
@ -388,7 +388,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
}
|
||||
|
||||
// init problem
|
||||
this.m_GO.getProblem().initProblem();
|
||||
this.m_GO.getProblem().initializeProblem();
|
||||
this.m_GO.getOptimizer().setProblem(this.m_GO.getProblem());
|
||||
// int optimizer and population
|
||||
//this.m_GO.getOptimizer().init();
|
||||
@ -402,7 +402,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
//this.writeToFile("Here i'll write something characterizing the algorithm.");
|
||||
|
||||
for (int j = 0; j < this.m_MultiRuns; j++) {
|
||||
this.m_GO.getProblem().initProblem(); // in the loop as well, dynamic probs may need that (MK)
|
||||
this.m_GO.getProblem().initializeProblem(); // in the loop as well, dynamic probs may need that (MK)
|
||||
this.m_TmpData = new ArrayList();
|
||||
this.currentRun = j;
|
||||
if (this.show) {
|
||||
@ -415,7 +415,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
this.writeToFile(" FitnessCalls\t Best\t Mean\t Worst \t" + BeanInspector.toString(this.m_GO.getProblem().getAdditionalDataHeader(), '\t', false, ""));
|
||||
if ((this.m_ContinueFlag) && (this.m_Backup != null)) {
|
||||
this.m_RecentFC += this.m_Backup.getFunctionCalls();
|
||||
this.m_GO.getOptimizer().getProblem().initProblem();
|
||||
this.m_GO.getOptimizer().getProblem().initializeProblem();
|
||||
this.m_GO.getOptimizer().addPopulationChangedEventListener(null);
|
||||
this.m_GO.getOptimizer().setPopulation(this.m_Backup);
|
||||
this.m_GO.getOptimizer().getProblem().evaluate(this.m_GO.getOptimizer().getPopulation());
|
||||
@ -427,9 +427,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
this.m_RecentFC = 0;
|
||||
this.m_GO.getOptimizer().init();
|
||||
}
|
||||
//while (this.m_GO.getOptimizer().getPopulation().getFunctionCalls() < this.m_FunctionCalls) {
|
||||
//while (this.m_GO.getOptimizer().getPopulation().getFunctionCalls() < this.functionCalls) {
|
||||
while (!this.m_GO.getTerminator().isTerminated(this.m_GO.getOptimizer().getPopulation())) {
|
||||
//System.out.println("Simulated Function calls "+ this.m_Optimizer.getPopulation().getFunctionCalls());
|
||||
//System.out.println("Simulated Function calls "+ this.optimizer.getPopulation().getFunctionCalls());
|
||||
if (Thread.interrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
@ -751,10 +751,10 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
// * @param functionCalls The maximal number of Function calls
|
||||
// */
|
||||
// public void setFunctionCalls(int functionCalls) {
|
||||
// this.m_FunctionCalls = functionCalls;
|
||||
// this.functionCalls = functionCalls;
|
||||
// }
|
||||
// public int getFunctionCalls() {
|
||||
// return this.m_FunctionCalls;
|
||||
// return this.functionCalls;
|
||||
// }
|
||||
// public String functionCallsTipText() {
|
||||
// return "The maxiaml number of function(fitness) evaluations that are performed. Mote: Generational algorihtms may be delayed!";
|
||||
@ -764,13 +764,13 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
// * @param optimizer The new optimizing algorithm
|
||||
// */
|
||||
// public void setOptimizer(InterfaceOptimizer optimizer) {
|
||||
// this.m_Optimizer = optimizer;
|
||||
// this.m_Optimizer.addPopulationChangedEventListener(this);
|
||||
// this.m_ExperimentName = this.m_Optimizer.getName()+"-"+this.m_PerformedRuns.size();
|
||||
// this.m_Optimizer.SetProblem(this.m_Problem);
|
||||
// this.optimizer = optimizer;
|
||||
// this.optimizer.addPopulationChangedEventListener(this);
|
||||
// this.m_ExperimentName = this.optimizer.getName()+"-"+this.m_PerformedRuns.size();
|
||||
// this.optimizer.SetProblem(this.problem);
|
||||
// }
|
||||
// public InterfaceOptimizer getOptimizer() {
|
||||
// return this.m_Optimizer;
|
||||
// return this.optimizer;
|
||||
// }
|
||||
// public String optimizerTipText() {
|
||||
// return "Choose a optimizing strategies.";
|
||||
@ -779,11 +779,11 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
||||
// * @param problem
|
||||
// */
|
||||
// public void SetProblem (InterfaceOptimizationProblem problem) {
|
||||
// this.m_Problem = problem;
|
||||
// this.m_Optimizer.SetProblem(this.m_Problem);
|
||||
// this.problem = problem;
|
||||
// this.optimizer.SetProblem(this.problem);
|
||||
// }
|
||||
// public InterfaceOptimizationProblem getProblem () {
|
||||
// return this.m_Problem;
|
||||
// return this.problem;
|
||||
// }
|
||||
// public String problemTipText() {
|
||||
// return "Choose the problem that is to optimize and the EA individual parameters.";
|
||||
|
@ -129,7 +129,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
|
||||
Population pop = new Population();
|
||||
pop.setTargetSize(this.m_State.m_InitialPopulationSize);
|
||||
this.m_State.m_CurrentProblem = (InterfaceOptimizationProblem) this.m_State.m_OriginalProblem.clone();
|
||||
this.m_State.m_CurrentProblem.initPopulation(pop);
|
||||
this.m_State.m_CurrentProblem.initializePopulation(pop);
|
||||
this.m_State.m_CurrentProblem.evaluate(pop);
|
||||
this.m_State.addPopulation2History(pop);
|
||||
this.m_View.problemChanged(true);
|
||||
@ -140,7 +140,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
|
||||
tmpP.initProcessElementParametrization();
|
||||
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } }
|
||||
this.m_State.makeFitnessCache(true);
|
||||
this.m_State.m_CurrentProblem.initProblem();
|
||||
this.m_State.m_CurrentProblem.initializeProblem();
|
||||
this.m_State.makeBackup();
|
||||
this.m_View.problemChanged(true);
|
||||
if (this.m_State.m_CurrentProblem.isMultiObjective()) {
|
||||
|
@ -32,40 +32,38 @@ import java.util.*;
|
||||
*/
|
||||
public abstract class AbstractEAIndividual implements IndividualInterface, java.io.Serializable {
|
||||
|
||||
public int m_FunctionCalls = 0; // TODO ist irgendwie eine Kruecke
|
||||
protected int m_Age = 0;
|
||||
private long m_ID = 0;
|
||||
private static long m_IDcounter = 0;
|
||||
public int functionCalls = 0; // TODO ist irgendwie eine Kruecke
|
||||
protected int age = 0;
|
||||
private long id = 0;
|
||||
private static long idCounter = 0;
|
||||
private boolean logParents = false;
|
||||
// heritage is to contain a list of all parents of the individual
|
||||
private Long[] parentIDs = null;
|
||||
transient private AbstractEAIndividual[] parentTree = null;
|
||||
protected double[] m_Fitness = new double[1];
|
||||
private double m_ConstraintViolation = 0;
|
||||
public boolean m_AreaConst4ParallelViolated = false; // no idea what felix used this for...
|
||||
public boolean m_Marked = false; // is for GUI only!
|
||||
public boolean m_isPenalized = false; // may be set true for penalty based constraints
|
||||
protected double[] m_SelectionProbability = new double[1];
|
||||
;
|
||||
protected double m_CrossoverProbability = 1.0;
|
||||
protected double m_MutationProbability = 0.2;
|
||||
protected InterfaceMutation m_MutationOperator = new NoMutation();
|
||||
protected InterfaceCrossover m_CrossoverOperator = new NoCrossover();
|
||||
protected InterfaceInitialization m_InitOperator = new DefaultInitialization();
|
||||
// protected String[] m_Identifiers = new String[m_ObjectIncrement];
|
||||
// protected Object[] m_Objects = new Object[m_ObjectIncrement];
|
||||
protected HashMap<String, Object> m_dataHash = new HashMap<String, Object>();
|
||||
protected double[] fitness = new double[1];
|
||||
private double constraintViolation = 0;
|
||||
public boolean areaConst4ParallelViolated = false; // no idea what felix used this for...
|
||||
public boolean isMarked = false; // is for GUI only!
|
||||
public boolean isPenalized = false; // may be set true for penalty based constraints
|
||||
protected double[] selectionProbability = new double[1];
|
||||
|
||||
protected double crossoverProbability = 1.0;
|
||||
protected double mutationProbability = 0.2;
|
||||
protected InterfaceMutation mutationOperator = new NoMutation();
|
||||
protected InterfaceCrossover crossoverOperator = new NoCrossover();
|
||||
protected InterfaceInitialization initializationOperator = new DefaultInitialization();
|
||||
protected HashMap<String, Object> dataHash = new HashMap<String, Object>();
|
||||
// introduced for the nichingPSO/ANPSO (M.Aschoff)
|
||||
private int individualIndex = -1;
|
||||
|
||||
public AbstractEAIndividual() {
|
||||
m_IDcounter++;
|
||||
m_ID = m_IDcounter;
|
||||
// System.out.println("my id is " + m_ID);
|
||||
idCounter++;
|
||||
id = idCounter;
|
||||
// System.out.println("my id is " + id);
|
||||
}
|
||||
|
||||
public long getIndyID() {
|
||||
return m_ID;
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getIndividualIndex() {
|
||||
@ -95,11 +93,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param pCross
|
||||
*/
|
||||
public void setOperators(InterfaceInitialization initOp, InterfaceMutation mutOp, double pMut, InterfaceCrossover coOp, double pCross) {
|
||||
m_InitOperator = initOp;
|
||||
m_MutationProbability = pMut;
|
||||
m_MutationOperator = mutOp;
|
||||
m_CrossoverProbability = pCross;
|
||||
m_CrossoverOperator = coOp;
|
||||
initializationOperator = initOp;
|
||||
mutationProbability = pMut;
|
||||
mutationOperator = mutOp;
|
||||
crossoverProbability = pCross;
|
||||
crossoverOperator = coOp;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,12 +123,12 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param pCross
|
||||
*/
|
||||
public void initCloneOperators(InterfaceMutation mutOp, double pMut, InterfaceCrossover coOp, double pCross, InterfaceOptimizationProblem problem) {
|
||||
m_MutationProbability = pMut;
|
||||
m_MutationOperator = (InterfaceMutation) mutOp.clone();
|
||||
m_MutationOperator.init(this, problem);
|
||||
m_CrossoverProbability = pCross;
|
||||
m_CrossoverOperator = (InterfaceCrossover) coOp.clone();
|
||||
m_CrossoverOperator.init(this, problem);
|
||||
mutationProbability = pMut;
|
||||
mutationOperator = (InterfaceMutation) mutOp.clone();
|
||||
mutationOperator.init(this, problem);
|
||||
crossoverProbability = pCross;
|
||||
crossoverOperator = (InterfaceCrossover) coOp.clone();
|
||||
crossoverOperator.init(this, problem);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,13 +154,13 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
public void cloneAEAObjects(AbstractEAIndividual individual) {
|
||||
// m_Name = new String(individual.m_Name);
|
||||
m_dataHash = (HashMap<String, Object>) (individual.m_dataHash.clone());
|
||||
m_ConstraintViolation = individual.m_ConstraintViolation;
|
||||
// m_AreaConst4ParallelViolated = individual.m_AreaConst4ParallelViolated;
|
||||
m_Marked = individual.m_Marked;
|
||||
m_isPenalized = individual.m_isPenalized;
|
||||
dataHash = (HashMap<String, Object>) (individual.dataHash.clone());
|
||||
constraintViolation = individual.constraintViolation;
|
||||
// areaConst4ParallelViolated = individual.areaConst4ParallelViolated;
|
||||
isMarked = individual.isMarked;
|
||||
isPenalized = individual.isPenalized;
|
||||
individualIndex = individual.individualIndex;
|
||||
m_InitOperator = individual.m_InitOperator.clone();
|
||||
initializationOperator = individual.initializationOperator.clone();
|
||||
if (individual.parentIDs != null) {
|
||||
parentIDs = new Long[individual.parentIDs.length];
|
||||
System.arraycopy(individual.parentIDs, 0, parentIDs, 0, parentIDs.length);
|
||||
@ -191,7 +189,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
if (!this.equalFitness(indy)) {
|
||||
return false;
|
||||
}
|
||||
this.m_ConstraintViolation = indy.m_ConstraintViolation;
|
||||
this.constraintViolation = indy.constraintViolation;
|
||||
|
||||
// check the genotypes
|
||||
if (!this.equalGenotypes(indy)) {
|
||||
@ -199,21 +197,21 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
}
|
||||
|
||||
// Age will not be used
|
||||
//if (this.m_Age != indy.m_Age) return false;
|
||||
//if (this.age != indy.age) return false;
|
||||
|
||||
// checking on mutation/crossover probabilities
|
||||
if (this.m_MutationProbability != indy.m_MutationProbability) {
|
||||
if (this.mutationProbability != indy.mutationProbability) {
|
||||
return false;
|
||||
}
|
||||
if (this.m_CrossoverProbability != indy.m_CrossoverProbability) {
|
||||
if (this.crossoverProbability != indy.crossoverProbability) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// checking in mutation/crossover operators
|
||||
if (!this.m_MutationOperator.equals(indy.m_MutationOperator)) {
|
||||
if (!this.mutationOperator.equals(indy.mutationOperator)) {
|
||||
return false;
|
||||
}
|
||||
if (!this.m_CrossoverOperator.equals(indy.m_CrossoverOperator)) {
|
||||
if (!this.crossoverOperator.equals(indy.crossoverOperator)) {
|
||||
return false;
|
||||
}
|
||||
// System.err.println("Check whether this is semantically meant by equality!!! (AbstractEAIndividual.equals())");
|
||||
@ -297,12 +295,12 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
// public boolean equals(Object obj) {
|
||||
// if (obj instanceof AbstractEAIndividual) {
|
||||
// AbstractEAIndividual indy = (AbstractEAIndividual)obj;
|
||||
// if (this.m_Fitness.length != indy.m_Fitness.length) return false;
|
||||
//// for (int i = 0; i < this.m_Fitness.length; i++) if (this.m_Fitness[i] != indy.m_Fitness[i]) return false;
|
||||
//// for (int i = 0; i < this.m_Fitness.length; i++)
|
||||
//// if (new Double(this.m_Fitness[i]).compareTo(new Double(indy.m_Fitness[i])) != 0) return false;
|
||||
// for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
// if (Math.abs(this.m_Fitness[i]- indy.m_Fitness[i]) > 0.00000001) return false;
|
||||
// if (this.fitness.length != indy.fitness.length) return false;
|
||||
//// for (int i = 0; i < this.fitness.length; i++) if (this.fitness[i] != indy.fitness[i]) return false;
|
||||
//// for (int i = 0; i < this.fitness.length; i++)
|
||||
//// if (new Double(this.fitness[i]).compareTo(new Double(indy.fitness[i])) != 0) return false;
|
||||
// for (int i = 0; i < this.fitness.length; i++) {
|
||||
// if (Math.abs(this.fitness[i]- indy.fitness[i]) > 0.00000001) return false;
|
||||
// }
|
||||
// return true;
|
||||
// } else {
|
||||
@ -315,10 +313,10 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param opt The optimization problem that is to be solved.
|
||||
*/
|
||||
public void init(InterfaceOptimizationProblem opt) {
|
||||
m_InitOperator.initialize(this, opt);
|
||||
initializationOperator.initialize(this, opt);
|
||||
// this.defaultInit(opt);
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -334,8 +332,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* This method will mutate the individual randomly
|
||||
*/
|
||||
public void mutate() {
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
this.m_MutationOperator.mutate(this);
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
this.mutationOperator.mutate(this);
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,8 +348,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
public AbstractEAIndividual[] mateWith(Population partners) {
|
||||
AbstractEAIndividual[] result;
|
||||
if (RNG.flipCoin(this.m_CrossoverProbability)) {
|
||||
result = this.m_CrossoverOperator.mate(this, partners);
|
||||
if (RNG.flipCoin(this.crossoverProbability)) {
|
||||
result = this.crossoverOperator.mate(this, partners);
|
||||
if (logParents) {
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i].setParents(this, partners);
|
||||
@ -477,7 +475,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The current age.
|
||||
*/
|
||||
public int getAge() {
|
||||
return this.m_Age;
|
||||
return this.age;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,21 +485,21 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param age The new age.
|
||||
*/
|
||||
public void SetAge(int age) {
|
||||
this.m_Age = age;
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will incr the current age by one.
|
||||
*/
|
||||
public void incrAge() {
|
||||
this.m_Age++;
|
||||
this.age++;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method allows you to reset the user data
|
||||
*/
|
||||
public void resetUserData() {
|
||||
m_dataHash.clear();
|
||||
dataHash.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -509,8 +507,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* individual
|
||||
*/
|
||||
public void resetConstraintViolation() {
|
||||
m_isPenalized = false;
|
||||
this.m_ConstraintViolation = 0;
|
||||
isPenalized = false;
|
||||
this.constraintViolation = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -520,7 +518,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param c The constraint violation.
|
||||
*/
|
||||
public void addConstraintViolation(double c) {
|
||||
this.m_ConstraintViolation += Math.abs(c);
|
||||
this.constraintViolation += Math.abs(c);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -529,7 +527,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The current level of constraint violation
|
||||
*/
|
||||
public double getConstraintViolation() {
|
||||
return this.m_ConstraintViolation;
|
||||
return this.constraintViolation;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -538,7 +536,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return True if constraints are violated
|
||||
*/
|
||||
public boolean violatesConstraint() {
|
||||
if (this.m_ConstraintViolation > 0) {
|
||||
if (this.constraintViolation > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -552,23 +550,23 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return true if marked false if not
|
||||
*/
|
||||
public boolean getMarked() {
|
||||
return this.m_Marked;
|
||||
return this.isMarked;
|
||||
}
|
||||
|
||||
public void SetMarked(boolean t) {
|
||||
this.m_Marked = t;
|
||||
this.isMarked = t;
|
||||
}
|
||||
|
||||
public boolean isMarked() {
|
||||
return this.m_Marked;
|
||||
return this.isMarked;
|
||||
}
|
||||
|
||||
public void unmark() {
|
||||
this.m_Marked = false;
|
||||
this.isMarked = false;
|
||||
}
|
||||
|
||||
public void mark() {
|
||||
this.m_Marked = true;
|
||||
this.isMarked = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -577,7 +575,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return
|
||||
*/
|
||||
public boolean isMarkedPenalized() {
|
||||
return m_isPenalized;
|
||||
return isPenalized;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -586,7 +584,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return
|
||||
*/
|
||||
public void SetMarkPenalized(boolean p) {
|
||||
m_isPenalized = p;
|
||||
isPenalized = p;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -598,7 +596,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
@Override
|
||||
public double[] getFitness() {
|
||||
return this.m_Fitness;
|
||||
return this.fitness;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -609,8 +607,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The fitness value at index
|
||||
*/
|
||||
public double getFitness(int index) {
|
||||
if (this.m_Fitness.length > index) {
|
||||
return this.m_Fitness[index];
|
||||
if (this.fitness.length > index) {
|
||||
return this.fitness[index];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -620,11 +618,10 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* This method will set the complete Fitness of the individual
|
||||
*
|
||||
* @param fitness The new fitness array
|
||||
* @deprecated
|
||||
*/
|
||||
@Override
|
||||
public void setFitness(double[] fitness) {
|
||||
this.m_Fitness = fitness;
|
||||
this.fitness = fitness;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -634,15 +631,15 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param fitness The new fitness value.
|
||||
*/
|
||||
public void SetFitness(int index, double fitness) {
|
||||
if (this.m_Fitness.length > index) {
|
||||
this.m_Fitness[index] = fitness;
|
||||
if (this.fitness.length > index) {
|
||||
this.fitness[index] = fitness;
|
||||
} else {
|
||||
double[] tmpD = new double[index + 1];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
tmpD[i] = this.m_Fitness[i];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
tmpD[i] = this.fitness[i];
|
||||
}
|
||||
this.m_Fitness = tmpD;
|
||||
this.m_Fitness[index] = fitness;
|
||||
this.fitness = tmpD;
|
||||
this.fitness[index] = fitness;
|
||||
}
|
||||
}
|
||||
|
||||
@ -653,9 +650,9 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param resetVal The new fitness array
|
||||
*/
|
||||
public void resetFitness(double resetVal) {
|
||||
if (m_Fitness != null) {
|
||||
for (int i = 0; i < m_Fitness.length; i++) {
|
||||
m_Fitness[i] = resetVal;
|
||||
if (fitness != null) {
|
||||
for (int i = 0; i < fitness.length; i++) {
|
||||
fitness[i] = resetVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -665,11 +662,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* for parallelizing MOEAs
|
||||
*/
|
||||
public void checkAreaConst4Parallelization(ArrayList Constraints) {
|
||||
this.m_AreaConst4ParallelViolated = false;
|
||||
this.areaConst4ParallelViolated = false;
|
||||
if (Constraints != null) {
|
||||
for (int i = 0; i < Constraints.size(); i++) {
|
||||
if (!((InterfaceConstraint) Constraints.get(i)).isValid(this)) {
|
||||
this.m_AreaConst4ParallelViolated = true;
|
||||
this.areaConst4ParallelViolated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -684,15 +681,15 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return True if better false else
|
||||
*/
|
||||
public boolean isDominating(AbstractEAIndividual indy) {
|
||||
if (this.m_AreaConst4ParallelViolated) {
|
||||
if (this.areaConst4ParallelViolated) {
|
||||
return false;
|
||||
}
|
||||
if (indy.m_AreaConst4ParallelViolated) {
|
||||
if (indy.areaConst4ParallelViolated) {
|
||||
return true;
|
||||
}
|
||||
return isDominatingFitness(getFitness(), indy.getFitness());
|
||||
// for (int i = 0; (i < this.m_Fitness.length) && (i < tmpFitness.length); i++) {
|
||||
// if (this.m_Fitness[i] <= tmpFitness[i]) result &= true;
|
||||
// for (int i = 0; (i < this.fitness.length) && (i < tmpFitness.length); i++) {
|
||||
// if (this.fitness[i] <= tmpFitness[i]) result &= true;
|
||||
// else result &= false;
|
||||
// }
|
||||
// return result;
|
||||
@ -770,15 +767,15 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* is worse, 0 if they are equal in that respect.
|
||||
*/
|
||||
public int compareConstraintViolation(AbstractEAIndividual indy) {
|
||||
if ((this.m_ConstraintViolation > 0) && (indy.m_ConstraintViolation <= 0)) {
|
||||
if ((this.constraintViolation > 0) && (indy.constraintViolation <= 0)) {
|
||||
return -1;
|
||||
}
|
||||
if ((this.m_ConstraintViolation <= 0) && (indy.m_ConstraintViolation > 0)) {
|
||||
if ((this.constraintViolation <= 0) && (indy.constraintViolation > 0)) {
|
||||
return 1;
|
||||
} else { // both violate: ((this.m_ConstraintViolation > 0) && (indy.m_ConstraintViolation > 0)) {
|
||||
if (this.m_ConstraintViolation < indy.m_ConstraintViolation) {
|
||||
} else { // both violate: ((this.constraintViolation > 0) && (indy.constraintViolation > 0)) {
|
||||
if (this.constraintViolation < indy.constraintViolation) {
|
||||
return 1;
|
||||
} else if (this.m_ConstraintViolation > indy.m_ConstraintViolation) {
|
||||
} else if (this.constraintViolation > indy.constraintViolation) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
@ -801,8 +798,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
} else {
|
||||
return (constrViolComp > 0);
|
||||
}
|
||||
// for (int i = 0; (i < this.m_Fitness.length) && (i < tmpFitness.length); i++) {
|
||||
// if (this.m_Fitness[i] <= tmpFitness[i]) result &= true;
|
||||
// for (int i = 0; (i < this.fitness.length) && (i < tmpFitness.length); i++) {
|
||||
// if (this.fitness[i] <= tmpFitness[i]) result &= true;
|
||||
// else result &= false;
|
||||
// }
|
||||
// return result;
|
||||
@ -818,10 +815,10 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
public boolean isDominatingEqual(AbstractEAIndividual indy) {
|
||||
// TODO: should this method really be called "..Equal"?
|
||||
if (this.m_AreaConst4ParallelViolated) {
|
||||
if (this.areaConst4ParallelViolated) {
|
||||
return false;
|
||||
}
|
||||
if (indy.m_AreaConst4ParallelViolated) {
|
||||
if (indy.areaConst4ParallelViolated) {
|
||||
return true;
|
||||
}
|
||||
return isDominatingFitnessNotEqual(getFitness(), indy.getFitness());
|
||||
@ -854,7 +851,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The complete selection probability array
|
||||
*/
|
||||
public double[] getSelectionProbability() {
|
||||
return this.m_SelectionProbability;
|
||||
return this.selectionProbability;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -866,8 +863,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The selection probability value at index
|
||||
*/
|
||||
public double getSelectionProbability(int index) {
|
||||
if (this.m_SelectionProbability.length > index) {
|
||||
return this.m_SelectionProbability[index];
|
||||
if (this.selectionProbability.length > index) {
|
||||
return this.selectionProbability[index];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
@ -879,7 +876,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param sel The new selection probability array
|
||||
*/
|
||||
public void SetSelectionProbability(double[] sel) {
|
||||
this.m_SelectionProbability = sel;
|
||||
this.selectionProbability = sel;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -889,15 +886,15 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param sel The new selection probability value.
|
||||
*/
|
||||
public void SetSelectionProbability(int index, double sel) {
|
||||
if (this.m_SelectionProbability.length > index) {
|
||||
this.m_SelectionProbability[index] = sel;
|
||||
if (this.selectionProbability.length > index) {
|
||||
this.selectionProbability[index] = sel;
|
||||
} else {
|
||||
double[] tmpD = new double[index + 1];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
tmpD[i] = this.m_SelectionProbability[i];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
tmpD[i] = this.selectionProbability[i];
|
||||
}
|
||||
this.m_SelectionProbability = tmpD;
|
||||
this.m_SelectionProbability[index] = sel;
|
||||
this.selectionProbability = tmpD;
|
||||
this.selectionProbability[index] = sel;
|
||||
}
|
||||
}
|
||||
|
||||
@ -908,11 +905,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param mutator The mutation operator.
|
||||
*/
|
||||
public void setMutationOperator(InterfaceMutation mutator) {
|
||||
this.m_MutationOperator = mutator;
|
||||
this.mutationOperator = mutator;
|
||||
}
|
||||
|
||||
public InterfaceMutation getMutationOperator() {
|
||||
return this.m_MutationOperator;
|
||||
return this.mutationOperator;
|
||||
}
|
||||
|
||||
public String mutationOperatorTipText() {
|
||||
@ -932,11 +929,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
if (mutprob > 1) {
|
||||
mutprob = 1;
|
||||
}
|
||||
m_MutationProbability = mutprob;
|
||||
mutationProbability = mutprob;
|
||||
}
|
||||
|
||||
public double getMutationProbability() {
|
||||
return m_MutationProbability;
|
||||
return mutationProbability;
|
||||
}
|
||||
|
||||
public String mutationProbabilityTipText() {
|
||||
@ -950,11 +947,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param crossover The crossover operator.
|
||||
*/
|
||||
public void setCrossoverOperator(InterfaceCrossover crossover) {
|
||||
this.m_CrossoverOperator = crossover;
|
||||
this.crossoverOperator = crossover;
|
||||
}
|
||||
|
||||
public InterfaceCrossover getCrossoverOperator() {
|
||||
return this.m_CrossoverOperator;
|
||||
return this.crossoverOperator;
|
||||
}
|
||||
|
||||
public String crossoverOperatorTipText() {
|
||||
@ -967,17 +964,17 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param prob
|
||||
*/
|
||||
public void setCrossoverProbability(double prob) {
|
||||
this.m_CrossoverProbability = prob;
|
||||
if (this.m_CrossoverProbability > 1) {
|
||||
this.m_CrossoverProbability = 1;
|
||||
this.crossoverProbability = prob;
|
||||
if (this.crossoverProbability > 1) {
|
||||
this.crossoverProbability = 1;
|
||||
}
|
||||
if (this.m_CrossoverProbability < 0) {
|
||||
this.m_CrossoverProbability = 0;
|
||||
if (this.crossoverProbability < 0) {
|
||||
this.crossoverProbability = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public double getCrossoverProbability() {
|
||||
return this.m_CrossoverProbability;
|
||||
return this.crossoverProbability;
|
||||
}
|
||||
|
||||
public String crossoverProbabilityTipText() {
|
||||
@ -985,11 +982,11 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
}
|
||||
|
||||
public InterfaceInitialization getInitOperator() {
|
||||
return m_InitOperator;
|
||||
return initializationOperator;
|
||||
}
|
||||
|
||||
public void setInitOperator(InterfaceInitialization mInitOperator) {
|
||||
m_InitOperator = mInitOperator;
|
||||
initializationOperator = mInitOperator;
|
||||
}
|
||||
|
||||
public String initOperatorTipText() {
|
||||
@ -1004,7 +1001,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param obj The object that is to be stored.
|
||||
*/
|
||||
public void putData(String name, Object obj) {
|
||||
m_dataHash.put(name, obj);
|
||||
dataHash.put(name, obj);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1020,7 +1017,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
// if (name.equalsIgnoreCase("SelectionProbabilityArray")) return this.getSelectionProbability();
|
||||
// if (name.equalsIgnoreCase("Fitness")) return this.getFitness();
|
||||
// if (name.equalsIgnoreCase("FitnessArray")) return this.getFitness();
|
||||
Object data = m_dataHash.get(name);
|
||||
Object data = dataHash.get(name);
|
||||
if (data == null) { // Fitness is actually in use... so lets have a minor special treatment
|
||||
// try {
|
||||
if (name.compareToIgnoreCase("Fitness") == 0) {
|
||||
@ -1045,7 +1042,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return true if data is associated with the key, else false
|
||||
*/
|
||||
public boolean hasData(String key) {
|
||||
if (m_dataHash.get(key) == null) {
|
||||
if (dataHash.get(key) == null) {
|
||||
return (key.compareToIgnoreCase("Fitness") == 0);
|
||||
} else {
|
||||
return true;
|
||||
@ -1323,7 +1320,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
// else return this.getFitness();
|
||||
// }
|
||||
public boolean isDominantNotEqual(double[] otherFitness) {
|
||||
return isDominatingFitnessNotEqual(m_Fitness, otherFitness);
|
||||
return isDominatingFitnessNotEqual(fitness, otherFitness);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1332,7 +1329,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
@Override
|
||||
public boolean isDominant(double[] otherFitness) {
|
||||
return isDominatingFitness(m_Fitness, otherFitness);
|
||||
return isDominatingFitness(fitness, otherFitness);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -25,10 +25,10 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
private double[][] m_Range;
|
||||
|
||||
public ESIndividualBinaryData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_MutationOperator = new MutateESGlobal();
|
||||
this.m_CrossoverProbability = 0.5;
|
||||
this.m_CrossoverOperator = new CrossoverESDefault();
|
||||
this.mutationProbability = 1.0;
|
||||
this.mutationOperator = new MutateESGlobal();
|
||||
this.crossoverProbability = 0.5;
|
||||
this.crossoverOperator = new CrossoverESDefault();
|
||||
this.m_Genotype = new double[1];
|
||||
this.m_Range = new double[1][2];
|
||||
this.m_Range[0][0] = 0;
|
||||
@ -49,18 +49,18 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
this.m_UseHardSwitch = individual.m_UseHardSwitch;
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -211,8 +211,8 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for ESIndividualBinaryData is no BitSet!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -224,12 +224,12 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
String result = "";
|
||||
result += "ESIndividual coding double: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -25,10 +25,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
private double[][] m_Range;
|
||||
|
||||
public ESIndividualDoubleData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_MutationOperator = new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate);
|
||||
this.m_CrossoverProbability = 0.5;
|
||||
this.m_CrossoverOperator = new CrossoverESDefault();
|
||||
this.mutationProbability = 1.0;
|
||||
this.mutationOperator = new MutateESGlobal(0.2, MutateESCrossoverTypeEnum.intermediate);
|
||||
this.crossoverProbability = 0.5;
|
||||
this.crossoverOperator = new CrossoverESDefault();
|
||||
this.m_Genotype = new double[1];
|
||||
this.m_Phenotype = null;
|
||||
this.m_Range = new double[1][2];
|
||||
@ -50,18 +50,18 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -264,8 +264,8 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for ESIndividualDoubleData is not double[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -276,14 +276,14 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
public String getStringRepresentation() {
|
||||
StringBuilder strB = new StringBuilder(200);
|
||||
strB.append("ESIndividual coding double: (Fitness {");
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
strB.append(this.m_Fitness[i]);
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
strB.append(this.fitness[i]);
|
||||
strB.append(";");
|
||||
}
|
||||
strB.append("}/SelProb{");
|
||||
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
strB.append(this.m_SelectionProbability[i]);
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
strB.append(this.selectionProbability[i]);
|
||||
strB.append(";");
|
||||
}
|
||||
strB.append("}) Value: [");
|
||||
@ -404,8 +404,8 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
// public String toString() {
|
||||
// String str = "Ind " + m_Genotype[0];
|
||||
// for (int i=1; i<this.m_Genotype.length; i++) str += "/" + m_Genotype[i];
|
||||
// str += "~" + m_Fitness[0];
|
||||
// for (int i=1; i<this.m_Fitness.length; i++) str += "/" + m_Fitness[i];
|
||||
// str += "~" + fitness[0];
|
||||
// for (int i=1; i<this.fitness.length; i++) str += "/" + fitness[i];
|
||||
// return str;
|
||||
// }
|
||||
}
|
||||
|
@ -21,10 +21,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
private int[][] m_Range;
|
||||
|
||||
public ESIndividualIntegerData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_MutationOperator = new MutateESGlobal();
|
||||
this.m_CrossoverProbability = 0.5;
|
||||
this.m_CrossoverOperator = new CrossoverESDefault();
|
||||
this.mutationProbability = 1.0;
|
||||
this.mutationOperator = new MutateESGlobal();
|
||||
this.crossoverProbability = 0.5;
|
||||
this.crossoverOperator = new CrossoverESDefault();
|
||||
this.m_Genotype = new double[1];
|
||||
this.m_Range = new int[1][2];
|
||||
this.m_Range[0][0] = -10;
|
||||
@ -45,18 +45,18 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -226,8 +226,8 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for ESIndividualIntegerData is not int[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -239,12 +239,12 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
String result = "";
|
||||
result += "ESIndividual coding int: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -25,10 +25,10 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
|
||||
|
||||
public ESIndividualPermutationData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_MutationOperator = new MutateESGlobal();
|
||||
this.m_CrossoverProbability = 0.5;
|
||||
this.m_CrossoverOperator = new CrossoverESDefault();
|
||||
this.mutationProbability = 1.0;
|
||||
this.mutationOperator = new MutateESGlobal();
|
||||
this.crossoverProbability = 0.5;
|
||||
this.crossoverOperator = new CrossoverESDefault();
|
||||
this.m_Genotype = new double[1][1];
|
||||
this.m_Range = new double[1][1][2];
|
||||
this.m_Range[0][0][0] = 0;
|
||||
@ -62,18 +62,18 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
|
||||
@ -259,8 +259,8 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for ESIndividualPermutationData is not int[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -272,12 +272,12 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
String result = "";
|
||||
result += "ESIndividual coding permutation: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -20,8 +20,8 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
private InterfaceDataTypeBinary m_BitSet = new GAIndividualBinaryData();
|
||||
|
||||
public GAESIndividualBinaryDoubleData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_CrossoverProbability = 1.0;
|
||||
this.mutationProbability = 1.0;
|
||||
this.crossoverProbability = 1.0;
|
||||
this.m_Numbers = new GAIndividualDoubleData();
|
||||
this.m_BitSet = new GAIndividualBinaryData();
|
||||
}
|
||||
@ -31,18 +31,18 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
this.m_BitSet = (InterfaceDataTypeBinary)((AbstractEAIndividual)individual.getBitSet()).clone();
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -113,10 +113,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
*/
|
||||
@Override
|
||||
public void mutate() {
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_Numbers).mutate();
|
||||
}
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_BitSet).mutate();
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
|
||||
@Override
|
||||
public AbstractEAIndividual[] mateWith(Population partners) {
|
||||
AbstractEAIndividual[] result;
|
||||
if (RNG.flipCoin(this.m_CrossoverProbability)) {
|
||||
if (RNG.flipCoin(this.crossoverProbability)) {
|
||||
AbstractEAIndividual[] resNum, resBin;
|
||||
AbstractEAIndividual numTmp, binTmp;
|
||||
Population numPop, binPop;
|
||||
|
@ -23,10 +23,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
protected int m_GenotypeLength;
|
||||
|
||||
public GAIndividualBinaryData() {
|
||||
this.m_MutationProbability = 0.1;
|
||||
this.m_MutationOperator = new MutateGANBit();
|
||||
this.m_CrossoverProbability = 1.0;
|
||||
this.m_CrossoverOperator = new CrossoverGAGINPoint();
|
||||
this.mutationProbability = 0.1;
|
||||
this.mutationOperator = new MutateGANBit();
|
||||
this.crossoverProbability = 1.0;
|
||||
this.crossoverOperator = new CrossoverGAGINPoint();
|
||||
this.m_GenotypeLength = 20;
|
||||
this.m_Genotype = new BitSet();
|
||||
}
|
||||
@ -46,18 +46,18 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = (InterfaceCrossover)individual.m_CrossoverOperator.clone();
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = (InterfaceCrossover)individual.crossoverOperator.clone();
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -121,8 +121,8 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GAIndividualBinaryData is no BitSet!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method can be used to read the current fitness of the individual.
|
||||
@ -132,7 +132,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
*/
|
||||
@Override
|
||||
public double[] getFitness() {
|
||||
return this.m_Fitness;
|
||||
return this.fitness;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,12 +146,12 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
String result = "";
|
||||
result += "GAIndividual: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "{";
|
||||
@ -167,7 +167,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
}
|
||||
result += "}";
|
||||
result += "\n Mutation ("+this.m_MutationProbability+"):" + this.m_MutationOperator.getStringRepresentation();
|
||||
result += "\n Mutation ("+this.mutationProbability +"):" + this.mutationOperator.getStringRepresentation();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
private InterfaceGADoubleCoding m_DoubleCoding = new GAStandardCodingDouble();
|
||||
|
||||
public GAIndividualDoubleData() {
|
||||
this.m_MutationProbability = 0.1;
|
||||
this.m_MutationOperator = new MutateGAUniform();
|
||||
this.m_CrossoverProbability = 0.7;
|
||||
this.m_CrossoverOperator = new CrossoverGAGINPoint();
|
||||
this.mutationProbability = 0.1;
|
||||
this.mutationOperator = new MutateGAUniform();
|
||||
this.crossoverProbability = 0.7;
|
||||
this.crossoverOperator = new CrossoverGAGINPoint();
|
||||
this.m_Range = new double[1][2];
|
||||
this.m_Range[0][0] = -10;
|
||||
this.m_Range[0][1] = 10;
|
||||
@ -54,20 +54,20 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = (InterfaceCrossover)individual.m_CrossoverOperator.clone();
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = (InterfaceCrossover)individual.crossoverOperator.clone();
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Precision = individual.m_Precision;
|
||||
this.m_DoubleCoding = individual.m_DoubleCoding;
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -245,8 +245,8 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GAIndividualDoubleData is not double[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -258,12 +258,12 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
String result = "";
|
||||
result += "GAIndividual coding double: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -27,10 +27,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
private InterfaceGAIntegerCoding m_IntegerCoding = new GAStandardCodingInteger();
|
||||
|
||||
public GAIndividualIntegerData() {
|
||||
this.m_MutationProbability = 0.2;
|
||||
this.m_MutationOperator = new MutateGANBit();
|
||||
this.m_CrossoverProbability = 0.7;
|
||||
this.m_CrossoverOperator = new CrossoverGAGINPoint();
|
||||
this.mutationProbability = 0.2;
|
||||
this.mutationOperator = new MutateGANBit();
|
||||
this.crossoverProbability = 0.7;
|
||||
this.crossoverOperator = new CrossoverGAGINPoint();
|
||||
this.m_Range = new int[1][2];
|
||||
this.m_CodingLenghts = new int[1];
|
||||
this.m_CodingLenghts[0] = 3;
|
||||
@ -54,19 +54,19 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_IntegerCoding = individual.m_IntegerCoding;
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -271,8 +271,8 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GAIndividualDoubleData is not double[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -284,12 +284,12 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
String result = "";
|
||||
result += "GAIndividual coding int: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -20,8 +20,8 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
private InterfaceDataTypeProgram m_Program = new GPIndividualProgramData();
|
||||
|
||||
public GAPIndividualProgramData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_CrossoverProbability = 1.0;
|
||||
this.mutationProbability = 1.0;
|
||||
this.crossoverProbability = 1.0;
|
||||
this.m_Numbers = new GAIndividualDoubleData();
|
||||
this.m_Program = new GPIndividualProgramData();
|
||||
}
|
||||
@ -31,18 +31,18 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
this.m_Program = (InterfaceDataTypeProgram)((AbstractEAIndividual)individual.getProgramRepresentation()).clone();
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -113,10 +113,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
*/
|
||||
@Override
|
||||
public void mutate() {
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_Numbers).mutate();
|
||||
}
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_Program).mutate();
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
|
||||
@Override
|
||||
public AbstractEAIndividual[] mateWith(Population partners) {
|
||||
AbstractEAIndividual[] result;
|
||||
if (RNG.flipCoin(this.m_CrossoverProbability)) {
|
||||
if (RNG.flipCoin(this.crossoverProbability)) {
|
||||
AbstractEAIndividual[] resNum, resBin;
|
||||
AbstractEAIndividual numTmp, binTmp;
|
||||
Population numPop, binPop;
|
||||
|
@ -41,10 +41,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
this.m_Area = new GPArea[1];
|
||||
this.m_GenotypeLengthPerProgram = 240;
|
||||
this.m_Genotype = new BitSet();
|
||||
this.m_MutationOperator = new MutateDefault();
|
||||
this.m_CrossoverOperator = new CrossoverGADefault();
|
||||
this.m_MutationProbability = 0.5;
|
||||
this.m_CrossoverProbability = 0.5;
|
||||
this.mutationOperator = new MutateDefault();
|
||||
this.crossoverOperator = new CrossoverGADefault();
|
||||
this.mutationProbability = 0.5;
|
||||
this.crossoverProbability = 0.5;
|
||||
}
|
||||
|
||||
public GEIndividualProgramData(GEIndividualProgramData individual) {
|
||||
@ -92,18 +92,18 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
}
|
||||
}
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -576,8 +576,8 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GPIndividualDoubleData is no InterfaceProgram[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
|
@ -21,10 +21,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
protected int[] m_Genotype;
|
||||
|
||||
public GIIndividualIntegerData() {
|
||||
this.m_MutationProbability = 0.2;
|
||||
this.m_MutationOperator = new MutateDefault();
|
||||
this.m_CrossoverProbability = 0.7;
|
||||
this.m_CrossoverOperator = new CrossoverGIDefault();
|
||||
this.mutationProbability = 0.2;
|
||||
this.mutationOperator = new MutateDefault();
|
||||
this.crossoverProbability = 0.7;
|
||||
this.crossoverOperator = new CrossoverGIDefault();
|
||||
this.m_Range = new int[10][2];
|
||||
for (int i = 0; i < this.m_Range.length; i++) {
|
||||
this.m_Range[i][0] = 0;
|
||||
@ -55,18 +55,18 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
}
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -230,8 +230,8 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GAIndividualDoubleData is not double[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -243,12 +243,12 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
String result = "";
|
||||
result += "GIIndividual coding int: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "[";
|
||||
|
@ -18,8 +18,8 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
private InterfaceDataTypePermutation m_Permutation = new OBGAIndividualPermutationData();
|
||||
|
||||
public GIOBGAIndividualIntegerPermutationData() {
|
||||
this.m_MutationProbability = 1.0;
|
||||
this.m_CrossoverProbability = 1.0;
|
||||
this.mutationProbability = 1.0;
|
||||
this.crossoverProbability = 1.0;
|
||||
this.m_Integer = new GIIndividualIntegerData();
|
||||
this.m_Permutation = new OBGAIndividualPermutationData();
|
||||
}
|
||||
@ -29,18 +29,18 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
this.m_Permutation = (InterfaceDataTypePermutation)((AbstractEAIndividual)individual.getPermutations()).clone();
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -111,10 +111,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
*/
|
||||
@Override
|
||||
public void mutate() {
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_Integer).mutate();
|
||||
}
|
||||
if (RNG.flipCoin(this.m_MutationProbability)) {
|
||||
if (RNG.flipCoin(this.mutationProbability)) {
|
||||
((AbstractEAIndividual)this.m_Permutation).mutate();
|
||||
}
|
||||
}
|
||||
@ -133,7 +133,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
|
||||
@Override
|
||||
public AbstractEAIndividual[] mateWith(Population partners) {
|
||||
AbstractEAIndividual[] result;
|
||||
if (RNG.flipCoin(this.m_CrossoverProbability)) {
|
||||
if (RNG.flipCoin(this.crossoverProbability)) {
|
||||
AbstractEAIndividual[] resNum, resBin;
|
||||
AbstractEAIndividual numTmp, binTmp;
|
||||
Population numPop, binPop;
|
||||
|
@ -33,8 +33,8 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
this.m_Area = new GPArea[1];
|
||||
m_Area[0] = new GPArea();
|
||||
this.m_Genotype = new AbstractGPNode[1];
|
||||
this.m_MutationOperator = new MutateDefault();
|
||||
this.m_CrossoverOperator = new CrossoverGPDefault();
|
||||
this.mutationOperator = new MutateDefault();
|
||||
this.crossoverOperator = new CrossoverGPDefault();
|
||||
}
|
||||
|
||||
public GPIndividualProgramData(GPIndividualProgramData individual) {
|
||||
@ -65,18 +65,18 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
this.m_CheckMaxDepth = individual.m_CheckMaxDepth;
|
||||
|
||||
// cloning the members of AbstractEAIndividual
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i];
|
||||
}
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
cloneAEAObjects((AbstractEAIndividual) individual);
|
||||
}
|
||||
@ -232,8 +232,8 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for GPIndividualDoubleData is no InterfaceProgram[]!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -245,12 +245,12 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
|
||||
String result = "";
|
||||
result += "GPIndividual coding program: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
for (int i = 0; i < this.m_Genotype.length; i++) {
|
||||
|
@ -153,7 +153,7 @@ public class IndividualWeightedFitnessComparator implements Comparator<Object>,
|
||||
// public static void main(String[] args) {
|
||||
// TF1Problem prob = new TF1Problem();
|
||||
// Population pop = new Population(10);
|
||||
// prob.initPopulation(pop);
|
||||
// prob.initializePopulation(pop);
|
||||
// prob.evaluate(pop);
|
||||
// System.out.println(pop.getStringRepresentation());
|
||||
// System.out.println("***");
|
||||
|
@ -25,10 +25,10 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
int[] firstindex;
|
||||
|
||||
public OBGAIndividualPermutationData() {
|
||||
this.m_MutationProbability = 0.2;
|
||||
this.m_MutationOperator = new MutateOBGAFlip();
|
||||
this.m_CrossoverProbability = 1.0;
|
||||
this.m_CrossoverOperator = new CrossoverOBGAPMX();
|
||||
this.mutationProbability = 0.2;
|
||||
this.mutationOperator = new MutateOBGAFlip();
|
||||
this.crossoverProbability = 1.0;
|
||||
this.crossoverOperator = new CrossoverOBGAPMX();
|
||||
this.setPermutationDataLength(new int[]{20});
|
||||
firstindex = new int[]{0};
|
||||
}
|
||||
@ -49,17 +49,17 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
|
||||
System.arraycopy(individual.m_Genotype, 0, this.m_Genotype, 0, this.m_Genotype.length);
|
||||
this.firstindex = individual.firstindex;
|
||||
this.m_Age = individual.m_Age;
|
||||
this.m_CrossoverOperator = individual.m_CrossoverOperator;
|
||||
this.m_CrossoverProbability = individual.m_CrossoverProbability;
|
||||
this.m_MutationOperator = (InterfaceMutation)individual.m_MutationOperator.clone();
|
||||
this.m_MutationProbability = individual.m_MutationProbability;
|
||||
this.m_SelectionProbability = new double[individual.m_SelectionProbability.length];
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
this.m_SelectionProbability[i] = individual.m_SelectionProbability[i]; }
|
||||
this.m_Fitness = new double[individual.m_Fitness.length];
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
this.m_Fitness[i] = individual.m_Fitness[i];
|
||||
this.age = individual.age;
|
||||
this.crossoverOperator = individual.crossoverOperator;
|
||||
this.crossoverProbability = individual.crossoverProbability;
|
||||
this.mutationOperator = (InterfaceMutation)individual.mutationOperator.clone();
|
||||
this.mutationProbability = individual.mutationProbability;
|
||||
this.selectionProbability = new double[individual.selectionProbability.length];
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
this.selectionProbability[i] = individual.selectionProbability[i]; }
|
||||
this.fitness = new double[individual.fitness.length];
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
this.fitness[i] = individual.fitness[i];
|
||||
}
|
||||
this.cloneAEAObjects(individual);
|
||||
}
|
||||
@ -111,8 +111,8 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
this.defaultInit(opt);
|
||||
System.out.println("Initial value for OBGAIndividualBinaryData is no Permutation!");
|
||||
}
|
||||
this.m_MutationOperator.init(this, opt);
|
||||
this.m_CrossoverOperator.init(this, opt);
|
||||
this.mutationOperator.init(this, opt);
|
||||
this.crossoverOperator.init(this, opt);
|
||||
}
|
||||
|
||||
/** This method can be used to read the current fitness of the individual.
|
||||
@ -122,7 +122,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
*/
|
||||
@Override
|
||||
public double[] getFitness() {
|
||||
return this.m_Fitness;
|
||||
return this.fitness;
|
||||
}
|
||||
|
||||
/** This method will return a string description of the GAIndividal
|
||||
@ -134,12 +134,12 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
String result = "";
|
||||
result += "OBGAIndividual: (";
|
||||
result += "Fitness {";
|
||||
for (int i = 0; i < this.m_Fitness.length; i++) {
|
||||
result += this.m_Fitness[i] + ";";
|
||||
for (int i = 0; i < this.fitness.length; i++) {
|
||||
result += this.fitness[i] + ";";
|
||||
}
|
||||
result += "}/SelProb{";
|
||||
for (int i = 0; i < this.m_SelectionProbability.length; i++) {
|
||||
result += this.m_SelectionProbability[i] + ";";
|
||||
for (int i = 0; i < this.selectionProbability.length; i++) {
|
||||
result += this.selectionProbability[i] + ";";
|
||||
}
|
||||
result += "})\n Value: ";
|
||||
result += "{";
|
||||
@ -153,7 +153,7 @@ public class OBGAIndividualPermutationData extends AbstractEAIndividual implemen
|
||||
result += "\n";
|
||||
}
|
||||
result += "}";
|
||||
result += "\n Mutation ("+this.m_MutationProbability+"):" + this.m_MutationOperator.getStringRepresentation();
|
||||
result += "\n Mutation ("+this.mutationProbability +"):" + this.mutationOperator.getStringRepresentation();
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -27,11 +27,11 @@ import javax.swing.*;
|
||||
public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessElement {
|
||||
|
||||
// private JComboBox m_OptimizerChooser;
|
||||
// private InterfaceOptimizer m_Optimizer;
|
||||
// private InterfaceOptimizer optimizer;
|
||||
|
||||
public MOCCOParameterizeMO(MOCCOStandalone mocco) {
|
||||
this.m_Mocco = mocco;
|
||||
// this.m_Optimizer = (InterfaceOptimizer)this.m_Mocco.m_State.m_Optimizer.clone();
|
||||
// this.optimizer = (InterfaceOptimizer)this.m_Mocco.m_State.optimizer.clone();
|
||||
}
|
||||
|
||||
/** This method will call the init method and will go to stall
|
||||
@ -67,11 +67,11 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE
|
||||
"Warning", JOptionPane.WARNING_MESSAGE);
|
||||
}
|
||||
// JOptionPane.showMessageDialog(this.m_Mocco.m_JFrame,
|
||||
// "The current "+this.m_Mocco.m_State.m_Optimizer.getName() +
|
||||
// "The current "+this.m_Mocco.m_State.optimizer.getName() +
|
||||
// " is typically a single-objective optimizer. I'm defaulting to a " +
|
||||
// "multi-objective EA instead, please parameterize accordingly.",
|
||||
// "Warning", JOptionPane.WARNING_MESSAGE);
|
||||
// this.m_Mocco.m_State.m_Optimizer = new MultiObjectiveEA();
|
||||
// this.m_Mocco.m_State.optimizer = new MultiObjectiveEA();
|
||||
}
|
||||
this.m_Mocco.m_JPanelParameters.removeAll();
|
||||
this.m_Mocco.m_JPanelParameters.setLayout(new BorderLayout());
|
||||
@ -145,7 +145,7 @@ public class MOCCOParameterizeMO extends MOCCOPhase implements InterfaceProcessE
|
||||
ActionListener continue2 = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
//m_Mocco.m_State.m_Optimizer = (InterfaceOptimizer)m_Optimizer.clone();
|
||||
//m_Mocco.m_State.optimizer = (InterfaceOptimizer)optimizer.clone();
|
||||
m_Mocco.m_JPanelControl.removeAll();
|
||||
m_Mocco.m_JPanelParameters.removeAll();
|
||||
m_Mocco.m_State.m_Optimizer.setProblem(m_Mocco.m_State.m_CurrentProblem);
|
||||
|
@ -25,11 +25,11 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser
|
||||
protected long randomSeed = (long)0.0;
|
||||
|
||||
// Opt. Algorithms and Parameters
|
||||
protected InterfaceOptimizer m_Optimizer;
|
||||
protected InterfaceOptimizationProblem m_Problem ;
|
||||
protected InterfaceTerminator m_Terminator;
|
||||
protected InterfacePostProcessParams m_PostProc = new PostProcessParams(false);
|
||||
transient protected InterfacePopulationChangedEventListener m_Listener;
|
||||
protected InterfaceOptimizer optimizer;
|
||||
protected InterfaceOptimizationProblem problem;
|
||||
protected InterfaceTerminator terminator;
|
||||
protected InterfacePostProcessParams postProcessing = new PostProcessParams(false);
|
||||
transient protected InterfacePopulationChangedEventListener populationChangedEventListener;
|
||||
transient private List<InterfaceNotifyOnInformers> toInformAboutInformers = null;
|
||||
|
||||
protected AbstractGOParameters() {
|
||||
@ -37,20 +37,20 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser
|
||||
|
||||
protected AbstractGOParameters(AbstractGOParameters goParameters) {
|
||||
this();
|
||||
this.m_Optimizer = goParameters.m_Optimizer;
|
||||
this.m_Problem = goParameters.m_Problem;
|
||||
this.m_Terminator = goParameters.m_Terminator;
|
||||
this.m_Optimizer.setProblem(this.m_Problem);
|
||||
this.randomSeed = goParameters.randomSeed;
|
||||
this.m_PostProc = goParameters.m_PostProc;
|
||||
this.optimizer = goParameters.optimizer;
|
||||
this.problem = goParameters.problem;
|
||||
this.terminator = goParameters.terminator;
|
||||
this.optimizer.setProblem(this.problem);
|
||||
this.randomSeed = goParameters.randomSeed;
|
||||
this.postProcessing = goParameters.postProcessing;
|
||||
}
|
||||
|
||||
public AbstractGOParameters(InterfaceOptimizer opt, InterfaceOptimizationProblem prob, InterfaceTerminator term) {
|
||||
this();
|
||||
m_Optimizer = opt;
|
||||
m_Problem = prob;
|
||||
m_Terminator = term;
|
||||
m_PostProc = new PostProcessParams(false);
|
||||
optimizer = opt;
|
||||
problem = prob;
|
||||
terminator = term;
|
||||
postProcessing = new PostProcessParams(false);
|
||||
opt.setProblem(prob);
|
||||
}
|
||||
|
||||
@ -60,12 +60,12 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser
|
||||
* @param src
|
||||
*/
|
||||
public void setSameParams(AbstractGOParameters src) {
|
||||
setOptimizer(src.m_Optimizer);
|
||||
setProblem(src.m_Problem);
|
||||
setTerminator(src.m_Terminator);
|
||||
this.m_Optimizer.setProblem(this.m_Problem);
|
||||
setOptimizer(src.optimizer);
|
||||
setProblem(src.problem);
|
||||
setTerminator(src.terminator);
|
||||
this.optimizer.setProblem(this.problem);
|
||||
setSeed(src.randomSeed);
|
||||
setPostProcessParams(src.m_PostProc);
|
||||
setPostProcessParams(src.postProcessing);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -74,22 +74,22 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser
|
||||
* @param ea
|
||||
*/
|
||||
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||
this.m_Listener = ea;
|
||||
if (this.m_Optimizer != null) {
|
||||
this.m_Optimizer.addPopulationChangedEventListener(this.m_Listener);
|
||||
this.populationChangedEventListener = ea;
|
||||
if (this.optimizer != null) {
|
||||
this.optimizer.addPopulationChangedEventListener(this.populationChangedEventListener);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removePopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||
if (populationChangedEventListener ==ea) {
|
||||
populationChangedEventListener =null;
|
||||
if (this.optimizer !=null) {
|
||||
this.optimizer.removePopulationChangedEventListener(ea);
|
||||
}
|
||||
}
|
||||
public boolean removePopulationChangedEventListener(
|
||||
InterfacePopulationChangedEventListener ea) {
|
||||
if (m_Listener==ea) {
|
||||
m_Listener=null;
|
||||
if (this.m_Optimizer!=null) {
|
||||
this.m_Optimizer.removePopulationChangedEventListener(ea);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,11 +117,11 @@ public abstract class AbstractGOParameters implements InterfaceGOParameters, Ser
|
||||
sBuilder.append("seed=");
|
||||
sBuilder.append(randomSeed);
|
||||
sBuilder.append("\nProblem: ");
|
||||
sBuilder.append(BeanInspector.toString(m_Problem));
|
||||
sBuilder.append(BeanInspector.toString(problem));
|
||||
sBuilder.append("\nOptimizer: ");
|
||||
sBuilder.append(BeanInspector.toString(m_Optimizer));
|
||||
sBuilder.append(BeanInspector.toString(optimizer));
|
||||
sBuilder.append("\nTerminator: ");
|
||||
sBuilder.append(BeanInspector.toString(m_Terminator));
|
||||
sBuilder.append(BeanInspector.toString(terminator));
|
||||
sBuilder.append("\n");
|
||||
return sBuilder.toString();
|
||||
}
|
||||
@ -156,28 +156,28 @@ listener.setInformers(getInformerList());
|
||||
|
||||
@Override
|
||||
public void setOptimizer(InterfaceOptimizer optimizer) {
|
||||
this.m_Optimizer = optimizer;
|
||||
this.m_Optimizer.setProblem(this.m_Problem);
|
||||
if (this.m_Listener != null) {
|
||||
this.m_Optimizer.addPopulationChangedEventListener(this.m_Listener);
|
||||
this.optimizer = optimizer;
|
||||
this.optimizer.setProblem(this.problem);
|
||||
if (this.populationChangedEventListener != null) {
|
||||
this.optimizer.addPopulationChangedEventListener(this.populationChangedEventListener);
|
||||
}
|
||||
fireNotifyOnInformers();
|
||||
}
|
||||
|
||||
private List<InterfaceAdditionalPopulationInformer> getInformerList() {
|
||||
LinkedList<InterfaceAdditionalPopulationInformer> ret = new LinkedList<InterfaceAdditionalPopulationInformer>();
|
||||
if (m_Problem instanceof InterfaceAdditionalPopulationInformer) {
|
||||
ret.add(m_Problem);
|
||||
if (problem instanceof InterfaceAdditionalPopulationInformer) {
|
||||
ret.add(problem);
|
||||
}
|
||||
if (m_Optimizer instanceof InterfaceAdditionalPopulationInformer) {
|
||||
ret.add((InterfaceAdditionalPopulationInformer)m_Optimizer);
|
||||
if (optimizer instanceof InterfaceAdditionalPopulationInformer) {
|
||||
ret.add((InterfaceAdditionalPopulationInformer) optimizer);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizer getOptimizer() {
|
||||
return this.m_Optimizer;
|
||||
return this.optimizer;
|
||||
}
|
||||
public String optimizerTipText() {
|
||||
return "Choose an optimization strategy.";
|
||||
@ -194,14 +194,14 @@ listener.setInformers(getInformerList());
|
||||
*/
|
||||
@Override
|
||||
public void setProblem (InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.m_Optimizer.setProblem(this.m_Problem);
|
||||
this.problem = problem;
|
||||
this.optimizer.setProblem(this.problem);
|
||||
fireNotifyOnInformers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.problem;
|
||||
}
|
||||
@Override
|
||||
public String problemTipText() {
|
||||
@ -237,11 +237,11 @@ listener.setInformers(getInformerList());
|
||||
*/
|
||||
@Override
|
||||
public void setTerminator(InterfaceTerminator term) {
|
||||
this.m_Terminator = term;
|
||||
this.terminator = term;
|
||||
}
|
||||
@Override
|
||||
public InterfaceTerminator getTerminator() {
|
||||
return this.m_Terminator;
|
||||
return this.terminator;
|
||||
}
|
||||
@Override
|
||||
public String terminatorTipText() {
|
||||
@ -250,11 +250,11 @@ listener.setInformers(getInformerList());
|
||||
|
||||
@Override
|
||||
public InterfacePostProcessParams getPostProcessParams() {
|
||||
return m_PostProc;
|
||||
return postProcessing;
|
||||
}
|
||||
@Override
|
||||
public void setPostProcessParams(InterfacePostProcessParams ppp) {
|
||||
m_PostProc = ppp;
|
||||
postProcessing = ppp;
|
||||
}
|
||||
@Override
|
||||
public String postProcessParamsTipText() {
|
||||
@ -262,6 +262,6 @@ listener.setInformers(getInformerList());
|
||||
}
|
||||
@Override
|
||||
public void setDoPostProcessing(boolean doPP){
|
||||
m_PostProc.setDoPostProcessing(doPP);
|
||||
postProcessing.setDoPostProcessing(doPP);
|
||||
}
|
||||
}
|
||||
|
@ -82,11 +82,11 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((DifferentialEvolution) this.m_Optimizer).getPopulation();
|
||||
return ((DifferentialEvolution) this.optimizer).getPopulation();
|
||||
}
|
||||
|
||||
public void setPopulation(Population pop){
|
||||
((DifferentialEvolution) this.m_Optimizer).setPopulation(pop);
|
||||
((DifferentialEvolution) this.optimizer).setPopulation(pop);
|
||||
}
|
||||
|
||||
public String populationTipText() {
|
||||
@ -97,10 +97,10 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param f
|
||||
*/
|
||||
public void setF (double f) {
|
||||
((DifferentialEvolution) this.m_Optimizer).setF(f);
|
||||
((DifferentialEvolution) this.optimizer).setF(f);
|
||||
}
|
||||
public double getF() {
|
||||
return ((DifferentialEvolution) this.m_Optimizer).getF();
|
||||
return ((DifferentialEvolution) this.optimizer).getF();
|
||||
}
|
||||
public String fTipText() {
|
||||
return "F is a real and constant factor which controlls the ampllification of the differential variation.";
|
||||
@ -110,10 +110,10 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param k
|
||||
*/
|
||||
public void setK(double k) {
|
||||
((DifferentialEvolution) this.m_Optimizer).setK(k);
|
||||
((DifferentialEvolution) this.optimizer).setK(k);
|
||||
}
|
||||
public double getK() {
|
||||
return ((DifferentialEvolution) this.m_Optimizer).getK();
|
||||
return ((DifferentialEvolution) this.optimizer).getK();
|
||||
}
|
||||
public String kTipText() {
|
||||
return "Probability of alteration through DE1.";
|
||||
@ -123,10 +123,10 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param l
|
||||
*/
|
||||
public void setLambda (double l) {
|
||||
((DifferentialEvolution) this.m_Optimizer).setLambda(l);
|
||||
((DifferentialEvolution) this.optimizer).setLambda(l);
|
||||
}
|
||||
public double getLambda() {
|
||||
return ((DifferentialEvolution) this.m_Optimizer).getLambda();
|
||||
return ((DifferentialEvolution) this.optimizer).getLambda();
|
||||
}
|
||||
public String lambdaTipText() {
|
||||
return "Enhance greediness through amplification of the differential vector to the best individual for DE2.";
|
||||
@ -136,10 +136,10 @@ public class DEParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param s The type.
|
||||
*/
|
||||
public void setDEType(DETypeEnum s) {
|
||||
((DifferentialEvolution) this.m_Optimizer).setDEType(s);
|
||||
((DifferentialEvolution) this.optimizer).setDEType(s);
|
||||
}
|
||||
public DETypeEnum getDEType() {
|
||||
return ((DifferentialEvolution) this.m_Optimizer).getDEType();
|
||||
return ((DifferentialEvolution) this.optimizer).getDEType();
|
||||
}
|
||||
public String dETypeTipText() {
|
||||
return "Choose the type of Differential Evolution.";
|
||||
|
@ -89,10 +89,10 @@ public class EPParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((EvolutionaryProgramming)this.m_Optimizer).getPopulation();
|
||||
return ((EvolutionaryProgramming)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((EvolutionaryProgramming)this.m_Optimizer).setPopulation(pop);
|
||||
((EvolutionaryProgramming)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
@ -102,10 +102,10 @@ public class EPParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param selection
|
||||
*/
|
||||
public void setEnvironmentSelection(InterfaceSelection selection) {
|
||||
((EvolutionaryProgramming)this.m_Optimizer).setEnvironmentSelection(selection);
|
||||
((EvolutionaryProgramming)this.optimizer).setEnvironmentSelection(selection);
|
||||
}
|
||||
public InterfaceSelection getEnvironmentSelection() {
|
||||
return ((EvolutionaryProgramming)this.m_Optimizer).getEnvironmentSelection();
|
||||
return ((EvolutionaryProgramming)this.optimizer).getEnvironmentSelection();
|
||||
}
|
||||
public String environmentSelectionTipText() {
|
||||
return "Choose a method for selecting the reduced population.";
|
||||
|
@ -86,10 +86,10 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((GeneticAlgorithm)this.m_Optimizer).getPopulation();
|
||||
return ((GeneticAlgorithm)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((GeneticAlgorithm)this.m_Optimizer).setPopulation(pop);
|
||||
((GeneticAlgorithm)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
@ -112,10 +112,10 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param selection
|
||||
*/
|
||||
public void setParentSelection(InterfaceSelection selection) {
|
||||
((GeneticAlgorithm)this.m_Optimizer).setParentSelection(selection);
|
||||
((GeneticAlgorithm)this.optimizer).setParentSelection(selection);
|
||||
}
|
||||
public InterfaceSelection getParentSelection() {
|
||||
return ((GeneticAlgorithm)this.m_Optimizer).getParentSelection();
|
||||
return ((GeneticAlgorithm)this.optimizer).getParentSelection();
|
||||
}
|
||||
public String parentSelectionTipText() {
|
||||
return "Choose a parent selection method.";
|
||||
@ -125,10 +125,10 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param elitism
|
||||
*/
|
||||
public void setElitism (boolean elitism) {
|
||||
((GeneticAlgorithm)this.m_Optimizer).setElitism(elitism);
|
||||
((GeneticAlgorithm)this.optimizer).setElitism(elitism);
|
||||
}
|
||||
public boolean getElitism() {
|
||||
return ((GeneticAlgorithm)this.m_Optimizer).getElitism();
|
||||
return ((GeneticAlgorithm)this.optimizer).getElitism();
|
||||
}
|
||||
public String elitismTipText() {
|
||||
return "Enable/disable elitism.";
|
||||
@ -141,10 +141,10 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
if (partners < 0) {
|
||||
partners = 0;
|
||||
}
|
||||
((GeneticAlgorithm)this.m_Optimizer).setNumberOfPartners(partners);
|
||||
((GeneticAlgorithm)this.optimizer).setNumberOfPartners(partners);
|
||||
}
|
||||
public int getNumberOfPartners() {
|
||||
return ((GeneticAlgorithm)this.m_Optimizer).getNumberOfPartners();
|
||||
return ((GeneticAlgorithm)this.optimizer).getNumberOfPartners();
|
||||
}
|
||||
public String numberOfPartnersTipText() {
|
||||
return "The number of mating partners needed to create offsprings.";
|
||||
@ -154,10 +154,10 @@ public class GAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @param selection
|
||||
*/
|
||||
public void setPartnerSelection(InterfaceSelection selection) {
|
||||
((GeneticAlgorithm)this.m_Optimizer).setPartnerSelection(selection);
|
||||
((GeneticAlgorithm)this.optimizer).setPartnerSelection(selection);
|
||||
}
|
||||
public InterfaceSelection getPartnerSelection() {
|
||||
return ((GeneticAlgorithm)this.m_Optimizer).getPartnerSelection();
|
||||
return ((GeneticAlgorithm)this.optimizer).getPartnerSelection();
|
||||
}
|
||||
public String partnerSelectionTipText() {
|
||||
return "Choose a selection method for selecting recombination partners for given parents.";
|
||||
|
@ -82,10 +82,10 @@ public class HCParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((HillClimbing) this.m_Optimizer).getPopulation();
|
||||
return ((HillClimbing) this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((HillClimbing) this.m_Optimizer).setPopulation(pop);
|
||||
((HillClimbing) this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
|
@ -80,10 +80,10 @@ public class MCParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((MonteCarloSearch)this.m_Optimizer).getPopulation();
|
||||
return ((MonteCarloSearch)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((MonteCarloSearch)this.m_Optimizer).setPopulation(pop);
|
||||
((MonteCarloSearch)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
|
@ -70,10 +70,10 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((MultiObjectiveEA)this.m_Optimizer).getPopulation();
|
||||
return ((MultiObjectiveEA)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((MultiObjectiveEA)this.m_Optimizer).setPopulation(pop);
|
||||
((MultiObjectiveEA)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the Population used.";
|
||||
@ -84,11 +84,11 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
*/
|
||||
@Override
|
||||
public InterfaceOptimizer getOptimizer() {
|
||||
return ((MultiObjectiveEA)this.m_Optimizer).getOptimizer();
|
||||
return ((MultiObjectiveEA)this.optimizer).getOptimizer();
|
||||
}
|
||||
@Override
|
||||
public void setOptimizer(InterfaceOptimizer b){
|
||||
((MultiObjectiveEA)this.m_Optimizer).setOptimizer(b);
|
||||
((MultiObjectiveEA)this.optimizer).setOptimizer(b);
|
||||
}
|
||||
@Override
|
||||
public String optimizerTipText() {
|
||||
@ -99,10 +99,10 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The current optimizing method
|
||||
*/
|
||||
public InterfaceArchiving getArchivingStrategy() {
|
||||
return ((MultiObjectiveEA)this.m_Optimizer).getArchivingStrategy();
|
||||
return ((MultiObjectiveEA)this.optimizer).getArchivingStrategy();
|
||||
}
|
||||
public void setArchivingStrategy(InterfaceArchiving b){
|
||||
((MultiObjectiveEA)this.m_Optimizer).setArchivingStrategy(b);
|
||||
((MultiObjectiveEA)this.optimizer).setArchivingStrategy(b);
|
||||
}
|
||||
public String archivingStrategyTipText() {
|
||||
return "Choose the archiving strategy.";
|
||||
@ -112,10 +112,10 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The current optimizing method
|
||||
*/
|
||||
public InterfaceInformationRetrieval getInformationRetrieval() {
|
||||
return ((MultiObjectiveEA)this.m_Optimizer).getInformationRetrieval();
|
||||
return ((MultiObjectiveEA)this.optimizer).getInformationRetrieval();
|
||||
}
|
||||
public void setInformationRetrieval(InterfaceInformationRetrieval b){
|
||||
((MultiObjectiveEA)this.m_Optimizer).setInformationRetrieval(b);
|
||||
((MultiObjectiveEA)this.optimizer).setInformationRetrieval(b);
|
||||
}
|
||||
public String informationRetrievalTipText() {
|
||||
return "Choose the Information Retrieval strategy.";
|
||||
@ -125,20 +125,20 @@ public class MOEAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The current optimizing method
|
||||
*/
|
||||
public int getArchiveSize() {
|
||||
Population archive = ((MultiObjectiveEA)this.m_Optimizer).getPopulation().getArchive();
|
||||
Population archive = ((MultiObjectiveEA)this.optimizer).getPopulation().getArchive();
|
||||
if (archive == null) {
|
||||
archive = new Population();
|
||||
((MultiObjectiveEA)this.m_Optimizer).getPopulation().SetArchive(archive);
|
||||
((MultiObjectiveEA)this.optimizer).getPopulation().SetArchive(archive);
|
||||
}
|
||||
return ((MultiObjectiveEA)this.m_Optimizer).getArchiveSize();
|
||||
return ((MultiObjectiveEA)this.optimizer).getArchiveSize();
|
||||
}
|
||||
public void setArchiveSize(int b){
|
||||
Population archive = ((MultiObjectiveEA)this.m_Optimizer).getPopulation().getArchive();
|
||||
Population archive = ((MultiObjectiveEA)this.optimizer).getPopulation().getArchive();
|
||||
if (archive == null) {
|
||||
archive = new Population();
|
||||
((MultiObjectiveEA)this.m_Optimizer).getPopulation().SetArchive(archive);
|
||||
((MultiObjectiveEA)this.optimizer).getPopulation().SetArchive(archive);
|
||||
}
|
||||
((MultiObjectiveEA)this.m_Optimizer).getPopulation().getArchive().setTargetSize(b);
|
||||
((MultiObjectiveEA)this.optimizer).getPopulation().getArchive().setTargetSize(b);
|
||||
}
|
||||
public String archiveSizeTipText() {
|
||||
return "Choose the size of the archive.";
|
||||
|
@ -60,7 +60,7 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return description
|
||||
*/
|
||||
// public static String globalInfo() {
|
||||
// return ((PopulationBasedIncrementalLearning)this.m_Optimizer).globalInfo();
|
||||
// return ((PopulationBasedIncrementalLearning)this.optimizer).globalInfo();
|
||||
// }
|
||||
|
||||
@Override
|
||||
@ -75,10 +75,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getPopulation();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setPopulation(pop);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
@ -88,10 +88,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @param selection
|
||||
*/
|
||||
public void setSelectionMethod(InterfaceSelection selection) {
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setSelectionMethod(selection);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setSelectionMethod(selection);
|
||||
}
|
||||
public InterfaceSelection getSelectionMethod() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getSelectionMethod();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getSelectionMethod();
|
||||
}
|
||||
public String selectionMethodTipText() {
|
||||
return "Choose a selection method.";
|
||||
@ -101,10 +101,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @param elitism
|
||||
*/
|
||||
public void setElitism (boolean elitism) {
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setElitism(elitism);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setElitism(elitism);
|
||||
}
|
||||
public boolean getElitism() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getElitism();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getElitism();
|
||||
}
|
||||
public String elitismTipText() {
|
||||
return "Enable/disable elitism.";
|
||||
@ -117,10 +117,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
if (LearningRate < 0) {
|
||||
LearningRate = 0;
|
||||
}
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setLearningRate(LearningRate);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setLearningRate(LearningRate);
|
||||
}
|
||||
public double getLearningRate() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getLearningRate();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getLearningRate();
|
||||
}
|
||||
public String learningRateTipText() {
|
||||
return "The learing rate of PBIL.";
|
||||
@ -136,11 +136,11 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
if (m > 1) {
|
||||
m = 1;
|
||||
}
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setMutationRate(m);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setMutationRate(m);
|
||||
|
||||
}
|
||||
public double getMutationRate() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getMutationRate();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getMutationRate();
|
||||
}
|
||||
public String mutationRateTipText() {
|
||||
return "The mutation rate of PBIL.";
|
||||
@ -153,10 +153,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
if (m < 0) {
|
||||
m = 0;
|
||||
}
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setMutateSigma(m);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setMutateSigma(m);
|
||||
}
|
||||
public double getMutateSigma() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getMutateSigma();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getMutateSigma();
|
||||
}
|
||||
public String mutateSigmaTipText() {
|
||||
return "Set the sigma for the mutation of the probability vector.";
|
||||
@ -169,10 +169,10 @@ public class PBILParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
if (PositiveSamples < 1) {
|
||||
PositiveSamples = 1;
|
||||
}
|
||||
((PopulationBasedIncrementalLearning)this.m_Optimizer).setPositiveSamples(PositiveSamples);
|
||||
((PopulationBasedIncrementalLearning)this.optimizer).setPositiveSamples(PositiveSamples);
|
||||
}
|
||||
public int getPositiveSamples() {
|
||||
return ((PopulationBasedIncrementalLearning)this.m_Optimizer).getPositiveSamples();
|
||||
return ((PopulationBasedIncrementalLearning)this.optimizer).getPositiveSamples();
|
||||
}
|
||||
public String positiveSamplesTipText() {
|
||||
return "The number of positive samples that update the PBIL vector.";
|
||||
|
@ -89,10 +89,10 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getPopulation();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getPopulation();
|
||||
}
|
||||
public void setPopulation(Population pop){
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setPopulation(pop);
|
||||
((ParticleSwarmOptimization)this.optimizer).setPopulation(pop);
|
||||
}
|
||||
public String populationTipText() {
|
||||
return "Edit the properties of the population used.";
|
||||
@ -102,26 +102,26 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
* @param f
|
||||
*/
|
||||
public void setInitialVelocity (double f) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setInitialVelocity(f);
|
||||
((ParticleSwarmOptimization)this.optimizer).setInitialVelocity(f);
|
||||
}
|
||||
public double getInitialVelocity() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getInitialVelocity();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getInitialVelocity();
|
||||
}
|
||||
public String initialVelocityTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).initialVelocityTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).initialVelocityTipText();
|
||||
}
|
||||
|
||||
/** This method will set the speed limit
|
||||
* @param k
|
||||
*/
|
||||
public void setSpeedLimit (double k) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setSpeedLimit(k);
|
||||
((ParticleSwarmOptimization)this.optimizer).setSpeedLimit(k);
|
||||
}
|
||||
public double getSpeedLimit() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getSpeedLimit();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getSpeedLimit();
|
||||
}
|
||||
public String speedLimitTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).speedLimitTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).speedLimitTipText();
|
||||
}
|
||||
|
||||
/** This method will set the inertness
|
||||
@ -130,15 +130,15 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
public void setInertnessOrChi(double k) {
|
||||
// if (k < 0) k = 0;
|
||||
// if (k > 1) k = 1;
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setInertnessOrChi(k);
|
||||
((ParticleSwarmOptimization)this.optimizer).setInertnessOrChi(k);
|
||||
}
|
||||
|
||||
public double getInertnessOrChi() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getInertnessOrChi();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getInertnessOrChi();
|
||||
}
|
||||
|
||||
public String inertnessOrChiTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).inertnessOrChiTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).inertnessOrChiTipText();
|
||||
}
|
||||
|
||||
/** This method will set greediness to move towards the best solution
|
||||
@ -146,13 +146,13 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
* @param l
|
||||
*/
|
||||
public void setPhi1 (double l) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setPhi1(l);
|
||||
((ParticleSwarmOptimization)this.optimizer).setPhi1(l);
|
||||
}
|
||||
public double getPhi1() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getPhi1();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getPhi1();
|
||||
}
|
||||
public String phi1TipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).phi1TipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).phi1TipText();
|
||||
}
|
||||
|
||||
/** This method will set greediness to move towards the best solution
|
||||
@ -160,13 +160,13 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
* @param l
|
||||
*/
|
||||
public void setPhi2 (double l) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setPhi2(l);
|
||||
((ParticleSwarmOptimization)this.optimizer).setPhi2(l);
|
||||
}
|
||||
public double getPhi2() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getPhi2();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getPhi2();
|
||||
}
|
||||
public String phi2TipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).phi2TipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).phi2TipText();
|
||||
}
|
||||
|
||||
|
||||
@ -174,129 +174,129 @@ public class PSOParameters extends AbstractGOParameters implements InterfaceGOPa
|
||||
* @param s Check Constraints.
|
||||
*/
|
||||
public void setCheckRange(boolean s) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setCheckRange(s);
|
||||
((ParticleSwarmOptimization)this.optimizer).setCheckRange(s);
|
||||
}
|
||||
public boolean isCheckRange() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).isCheckRange();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).isCheckRange();
|
||||
}
|
||||
public String checkConstraintsTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).checkRangeTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).checkRangeTipText();
|
||||
}
|
||||
|
||||
/** This method allows you to choose the topology type.
|
||||
* @param t The type.
|
||||
*/
|
||||
public void setTopology(PSOTopologyEnum t) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setTopology(t);
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setGOEShowProperties(getClass());
|
||||
((ParticleSwarmOptimization)this.optimizer).setTopology(t);
|
||||
((ParticleSwarmOptimization)this.optimizer).setGOEShowProperties(getClass());
|
||||
}
|
||||
public PSOTopologyEnum getTopology() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getTopology();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getTopology();
|
||||
}
|
||||
public String topologyTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).topologyTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).topologyTipText();
|
||||
}
|
||||
|
||||
/** The range of the local neighbourhood.
|
||||
* @param s The range.
|
||||
*/
|
||||
public void setTopologyRange(int s) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setTopologyRange(s);
|
||||
((ParticleSwarmOptimization)this.optimizer).setTopologyRange(s);
|
||||
}
|
||||
public int getTopologyRange() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getTopologyRange();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getTopologyRange();
|
||||
}
|
||||
public String topologyRangeTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).topologyRangeTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).topologyRangeTipText();
|
||||
}
|
||||
|
||||
public double getSubSwarmRadius() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getSubSwarmRadius();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getSubSwarmRadius();
|
||||
}
|
||||
public void setSubSwarmRadius(double radius) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setSubSwarmRadius(radius);
|
||||
((ParticleSwarmOptimization)this.optimizer).setSubSwarmRadius(radius);
|
||||
}
|
||||
public String subSwarmRadiusTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).subSwarmRadiusTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).subSwarmRadiusTipText();
|
||||
}
|
||||
|
||||
public int getMaxSubSwarmSize() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getMaxSubSwarmSize();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getMaxSubSwarmSize();
|
||||
}
|
||||
public void setMaxSubSwarmSize(int subSize) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setMaxSubSwarmSize(subSize);
|
||||
((ParticleSwarmOptimization)this.optimizer).setMaxSubSwarmSize(subSize);
|
||||
}
|
||||
public String maxSubSwarmSizeTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).maxSubSwarmSizeTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).maxSubSwarmSizeTipText();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the checkSpeedLimit
|
||||
**/
|
||||
public boolean isCheckSpeedLimit() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).isCheckSpeedLimit();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).isCheckSpeedLimit();
|
||||
}
|
||||
/**
|
||||
* @param checkSpeedLimit the checkSpeedLimit to set
|
||||
**/
|
||||
public void setCheckSpeedLimit(boolean checkSpeedLimit) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setCheckSpeedLimit(checkSpeedLimit);
|
||||
((ParticleSwarmOptimization)this.optimizer).setCheckSpeedLimit(checkSpeedLimit);
|
||||
GenericObjectEditor.setHideProperty(getClass(), "speedLimit", !checkSpeedLimit);
|
||||
}
|
||||
|
||||
public String checkSpeedLimitTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).checkSpeedLimitTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).checkSpeedLimitTipText();
|
||||
}
|
||||
|
||||
/** This method allows you to choose the algorithm type.
|
||||
* @param s The type.
|
||||
*/
|
||||
public void setAlgoType(SelectedTag s) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setAlgoType(s);
|
||||
((ParticleSwarmOptimization)this.optimizer).setAlgoType(s);
|
||||
}
|
||||
|
||||
public SelectedTag getAlgoType() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).getAlgoType();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).getAlgoType();
|
||||
}
|
||||
|
||||
public String algoTypeTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).algoTypeTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).algoTypeTipText();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return the treeBranchDeg
|
||||
// */
|
||||
// public int getTreeBranchDegree() {
|
||||
// return ((ParticleSwarmOptimization)this.m_Optimizer).getTreeBranchDegree();
|
||||
// return ((ParticleSwarmOptimization)this.optimizer).getTreeBranchDegree();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param treeBranchDeg the treeBranchDeg to set
|
||||
// */
|
||||
// public void setTreeBranchDegree(int treeBranchDeg) {
|
||||
// ((ParticleSwarmOptimization)this.m_Optimizer).setTreeBranchDegree(treeBranchDeg);
|
||||
// ((ParticleSwarmOptimization)this.optimizer).setTreeBranchDegree(treeBranchDeg);
|
||||
// }
|
||||
//
|
||||
// public String treeBranchDegreeTipText() {
|
||||
// return ((ParticleSwarmOptimization)this.m_Optimizer).treeBranchDegreeTipText();
|
||||
// return ((ParticleSwarmOptimization)this.optimizer).treeBranchDegreeTipText();
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return the wrapTopology
|
||||
*/
|
||||
public boolean isWrapTopology() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).isWrapTopology();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).isWrapTopology();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param wrapTopology the wrapTopology to set
|
||||
*/
|
||||
public void setWrapTopology(boolean wrapTopology) {
|
||||
((ParticleSwarmOptimization)this.m_Optimizer).setWrapTopology(wrapTopology);
|
||||
((ParticleSwarmOptimization)this.optimizer).setWrapTopology(wrapTopology);
|
||||
}
|
||||
|
||||
public String wrapTopologyTipText() {
|
||||
return ((ParticleSwarmOptimization)this.m_Optimizer).wrapTopologyTipText();
|
||||
return ((ParticleSwarmOptimization)this.optimizer).wrapTopologyTipText();
|
||||
}
|
||||
|
||||
}
|
@ -239,7 +239,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
while (isOptRunning() && (runCounter < m_Statistics.getStatisticsParameter().getMultiRuns())) {
|
||||
m_Statistics.startOptPerformed(getInfoString(), runCounter, goParams, getInformerList());
|
||||
|
||||
this.goParams.getProblem().initProblem();
|
||||
this.goParams.getProblem().initializeProblem();
|
||||
this.goParams.getOptimizer().setProblem(this.goParams.getProblem());
|
||||
this.goParams.getTerminator().init(this.goParams.getProblem());
|
||||
maybeInitParamCtrl(goParams);
|
||||
|
@ -27,7 +27,7 @@ public class SAParameters extends AbstractGOParameters implements InterfaceGOPar
|
||||
// Opt. Algorithms and Parameters
|
||||
private InterfaceOptimizer m_Optimizer = new SimulatedAnnealing();
|
||||
private InterfaceOptimizationProblem m_Problem = new B1Problem();
|
||||
//private int m_FunctionCalls = 1000;
|
||||
//private int functionCalls = 1000;
|
||||
private InterfaceTerminator m_Terminator = new EvaluationTerminator();
|
||||
// private String m_OutputFileName = "none";
|
||||
transient private InterfacePopulationChangedEventListener m_Listener;
|
||||
|
@ -79,11 +79,11 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @return The population of current solutions to a given problem.
|
||||
*/
|
||||
public Population getPopulation() {
|
||||
return ((SteadyStateGA) this.m_Optimizer).getPopulation();
|
||||
return ((SteadyStateGA) this.optimizer).getPopulation();
|
||||
}
|
||||
|
||||
public void setPopulation(Population pop){
|
||||
((SteadyStateGA) this.m_Optimizer).setPopulation(pop);
|
||||
((SteadyStateGA) this.optimizer).setPopulation(pop);
|
||||
}
|
||||
|
||||
public String populationTipText() {
|
||||
@ -107,11 +107,11 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @param selection
|
||||
*/
|
||||
public void setParentSelection(InterfaceSelection selection) {
|
||||
((SteadyStateGA) this.m_Optimizer).setParentSelection(selection);
|
||||
((SteadyStateGA) this.optimizer).setParentSelection(selection);
|
||||
}
|
||||
|
||||
public InterfaceSelection getParentSelection() {
|
||||
return ((SteadyStateGA) this.m_Optimizer).getParentSelection();
|
||||
return ((SteadyStateGA) this.optimizer).getParentSelection();
|
||||
}
|
||||
|
||||
public String parentSelectionTipText() {
|
||||
@ -128,11 +128,11 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
if (partners < 0) {
|
||||
partners = 0;
|
||||
}
|
||||
((SteadyStateGA) this.m_Optimizer).setNumberOfPartners(partners);
|
||||
((SteadyStateGA) this.optimizer).setNumberOfPartners(partners);
|
||||
}
|
||||
|
||||
public int getNumberOfPartners() {
|
||||
return ((SteadyStateGA) this.m_Optimizer).getNumberOfPartners();
|
||||
return ((SteadyStateGA) this.optimizer).getNumberOfPartners();
|
||||
}
|
||||
public String numberOfPartnersTipText() {
|
||||
return "The number of mating partners needed to create offsprings.";
|
||||
@ -142,10 +142,10 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @param selection
|
||||
*/
|
||||
public void setPartnerSelection(InterfaceSelection selection) {
|
||||
((SteadyStateGA)this.m_Optimizer).setPartnerSelection(selection);
|
||||
((SteadyStateGA)this.optimizer).setPartnerSelection(selection);
|
||||
}
|
||||
public InterfaceSelection getPartnerSelection() {
|
||||
return ((SteadyStateGA)this.m_Optimizer).getPartnerSelection();
|
||||
return ((SteadyStateGA)this.optimizer).getPartnerSelection();
|
||||
}
|
||||
public String partnerSelectionTipText() {
|
||||
return "Choose a selection method for selecting recombination partners for given parents.";
|
||||
@ -155,10 +155,10 @@ public class SSGAParameters extends AbstractGOParameters implements InterfaceGOP
|
||||
* @param s A InterfaceReplacement strategy.
|
||||
*/
|
||||
public void setReplacementSelection(InterfaceReplacement s) {
|
||||
((SteadyStateGA)this.m_Optimizer).setReplacementSelection(s);
|
||||
((SteadyStateGA)this.optimizer).setReplacementSelection(s);
|
||||
}
|
||||
public InterfaceReplacement getReplacementSelection() {
|
||||
return ((SteadyStateGA)this.m_Optimizer).getReplacementSelection();
|
||||
return ((SteadyStateGA)this.optimizer).getReplacementSelection();
|
||||
}
|
||||
public String replacementSelectionTipText() {
|
||||
return "Choose a replacement strategy.";
|
||||
|
@ -395,7 +395,7 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
|
||||
F1Problem f1 = new F1Problem();
|
||||
f1.setProblemDimension(2);
|
||||
f1.setEAIndividual(new ESIndividualDoubleData());
|
||||
f1.initPopulation(pop);
|
||||
f1.initializePopulation(pop);
|
||||
ckm.cluster(pop, (Population)null);
|
||||
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab
|
||||
if (true) {
|
||||
int k = 3;
|
||||
double[] x;
|
||||
f1.initPopulation(pop);
|
||||
f1.initializePopulation(pop);
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
x = ((InterfaceDataTypeDouble)pop.get(i)).getDoubleData();
|
||||
switch (i%k) {
|
||||
@ -343,7 +343,7 @@ public class ClusteringXMeans implements InterfaceClustering, java.io.Serializab
|
||||
((InterfaceDataTypeDouble)pop.get(i)).SetDoubleGenotype(x);
|
||||
}
|
||||
} else {
|
||||
f1.initPopulation(pop);
|
||||
f1.initializePopulation(pop);
|
||||
}
|
||||
ckm.cluster(pop, (Population)null);
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
// indy = (AbstractEAIndividual)oldIPOP[i].get(j);
|
||||
// myPoint = new DPoint(indy.getFitness()[0], indy.getFitness()[1]);
|
||||
// tmp = new Chart2DDPointIconText(""+i);
|
||||
// if (indy.m_AreaConst4ParallelViolated) tmp.setIcon(new Chart2DDPointIconCircle());
|
||||
// if (indy.areaConst4ParallelViolated) tmp.setIcon(new Chart2DDPointIconCircle());
|
||||
// myPoint.setIcon(tmp);
|
||||
// mySet.addDPoint(myPoint);
|
||||
// }
|
||||
@ -382,7 +382,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
|
||||
// prob.evaluate(newIPOP[i]);
|
||||
// System.out.println("Invalid Individual in Island "+i+" ("+newIPOP[i].size()+"): ");
|
||||
// for (int j = 0; j < newIPOP[i].size(); j++) {
|
||||
// if(((AbstractEAIndividual)newIPOP[i].get(j)).m_AreaConst4ParallelViolated) {
|
||||
// if(((AbstractEAIndividual)newIPOP[i].get(j)).areaConst4ParallelViolated) {
|
||||
// System.out.print(j+", ");
|
||||
// ((AbstractEAIndividual)newIPOP[i].get(j)).checkAreaConst4Parallelization(((AbstractMultiObjectiveOptimizationProblem)prob).m_AreaConst4Parallelization);
|
||||
// }
|
||||
|
@ -132,7 +132,7 @@ public class MutateESCorrVector implements InterfaceMutation, java.io.Serializab
|
||||
// mutate the velocity vector and write it back
|
||||
if ((m_scalingDev > 0) || (m_rotationDev > 0)) {
|
||||
// for (int i = 0; i < vel.length; i++) {
|
||||
// vel[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
|
||||
// vel[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.mutationStepSize);
|
||||
// }
|
||||
double rotateRad = m_rotationDev*(Math.PI/360.)*RNG.gaussianDouble(1.);
|
||||
// rotate with a gaussian distribution of deviation rotationDeg
|
||||
|
@ -14,39 +14,39 @@ import eva2.tools.math.RNG;
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public class MutateESCorrolated implements InterfaceMutation, java.io.Serializable {
|
||||
protected double m_MutationStepSize = 0.2;
|
||||
protected double m_Tau1 = 0.15;
|
||||
protected double m_LowerLimitStepSize = 0.0000005;
|
||||
protected double mutationStepSize = 0.2;
|
||||
protected double tau1 = 0.15;
|
||||
protected double lowerLimitStepSize = 0.0000005;
|
||||
private static final long serialVersionUID = 1L;
|
||||
private double[] m_Sigmas = null;
|
||||
private double[] m_Alphas = null;
|
||||
protected double m_Tau2 = 0.15;
|
||||
private double[] sigmas = null;
|
||||
private double[] alphas = null;
|
||||
protected double tau2 = 0.15;
|
||||
|
||||
public MutateESCorrolated() {
|
||||
this.m_Sigmas = null;
|
||||
this.m_Alphas = null;
|
||||
this.sigmas = null;
|
||||
this.alphas = null;
|
||||
}
|
||||
|
||||
public MutateESCorrolated(MutateESCorrolated mutator) {
|
||||
if ((mutator.m_Sigmas != null)) {
|
||||
this.m_Sigmas = new double[mutator.m_Sigmas.length];
|
||||
for (int i = 0; i < this.m_Sigmas.length; i++) {
|
||||
this.m_Sigmas[i] = mutator.m_Sigmas[i];
|
||||
if ((mutator.sigmas != null)) {
|
||||
this.sigmas = new double[mutator.sigmas.length];
|
||||
for (int i = 0; i < this.sigmas.length; i++) {
|
||||
this.sigmas[i] = mutator.sigmas[i];
|
||||
}
|
||||
|
||||
}
|
||||
if (mutator.m_Alphas != null) {
|
||||
this.m_Alphas = new double[mutator.m_Alphas.length];
|
||||
for (int i = 0; i < this.m_Alphas.length; i++) {
|
||||
this.m_Alphas[i] = mutator.m_Alphas[i];
|
||||
if (mutator.alphas != null) {
|
||||
this.alphas = new double[mutator.alphas.length];
|
||||
for (int i = 0; i < this.alphas.length; i++) {
|
||||
this.alphas[i] = mutator.alphas[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.m_MutationStepSize = mutator.m_MutationStepSize;
|
||||
this.m_Tau1 = mutator.m_Tau1;
|
||||
this.m_Tau2 = mutator.m_Tau2;
|
||||
this.m_LowerLimitStepSize = mutator.m_LowerLimitStepSize;
|
||||
this.mutationStepSize = mutator.mutationStepSize;
|
||||
this.tau1 = mutator.tau1;
|
||||
this.tau2 = mutator.tau2;
|
||||
this.lowerLimitStepSize = mutator.lowerLimitStepSize;
|
||||
}
|
||||
|
||||
/** This method will enable you to clone a given mutation operator
|
||||
@ -68,27 +68,27 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
}
|
||||
if (mutator instanceof MutateESCorrolated) {
|
||||
MutateESCorrolated mut = (MutateESCorrolated)mutator;
|
||||
if (this.m_Tau1 != mut.m_Tau1) {
|
||||
if (this.tau1 != mut.tau1) {
|
||||
return false;
|
||||
}
|
||||
if (this.m_Tau2 != mut.m_Tau2) {
|
||||
if (this.tau2 != mut.tau2) {
|
||||
return false;
|
||||
}
|
||||
if (this.m_LowerLimitStepSize != mut.m_LowerLimitStepSize) {
|
||||
if (this.lowerLimitStepSize != mut.lowerLimitStepSize) {
|
||||
return false;
|
||||
}
|
||||
if (this.m_Sigmas != null) {
|
||||
for (int i = 0; i < this.m_Sigmas.length; i++) {
|
||||
if (this.m_Sigmas[i] != mut.m_Sigmas[i]) {
|
||||
if (this.sigmas != null) {
|
||||
for (int i = 0; i < this.sigmas.length; i++) {
|
||||
if (this.sigmas[i] != mut.sigmas[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (this.m_Alphas != null) {
|
||||
for (int i = 0; i < this.m_Alphas.length; i++) {
|
||||
if (this.m_Alphas[i] != mut.m_Alphas[i]) {
|
||||
if (this.alphas != null) {
|
||||
for (int i = 0; i < this.alphas.length; i++) {
|
||||
if (this.alphas[i] != mut.alphas[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -109,18 +109,18 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt) {
|
||||
if (individual instanceof InterfaceESIndividual) {
|
||||
double[] x = ((InterfaceESIndividual)individual).getDGenotype();
|
||||
if (this.m_Sigmas == null) {
|
||||
if (this.sigmas == null) {
|
||||
// init the Sigmas
|
||||
this.m_Sigmas = new double[x.length];
|
||||
for (int i = 0; i < this.m_Sigmas.length; i++) {
|
||||
this.m_Sigmas[i] = this.m_MutationStepSize;
|
||||
this.sigmas = new double[x.length];
|
||||
for (int i = 0; i < this.sigmas.length; i++) {
|
||||
this.sigmas[i] = this.mutationStepSize;
|
||||
}
|
||||
}
|
||||
if (this.m_Alphas == null) {
|
||||
if (this.alphas == null) {
|
||||
// init the Alphas
|
||||
this.m_Alphas = new double[(x.length*(x.length-1))/2];
|
||||
for (int i = 0; i < this.m_Alphas.length; i++) {
|
||||
this.m_Alphas[i] = 0.0;
|
||||
this.alphas = new double[(x.length*(x.length-1))/2];
|
||||
for (int i = 0; i < this.alphas.length; i++) {
|
||||
this.alphas[i] = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -136,34 +136,34 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
// double[] xCopy = ((InterfaceESIndividual)individual).getDGenotype();
|
||||
// double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
|
||||
// double tmpR = RNG.gaussianDouble(1);
|
||||
// if (this.m_Sigmas == null) {
|
||||
// if (this.sigmas == null) {
|
||||
// // init the Sigmas
|
||||
// this.m_Sigmas = new double[x.length];
|
||||
// for (int i = 0; i < this.m_Sigmas.length; i++) this.m_Sigmas[i] = this.m_MutationStepSize;
|
||||
// this.sigmas = new double[x.length];
|
||||
// for (int i = 0; i < this.sigmas.length; i++) this.sigmas[i] = this.mutationStepSize;
|
||||
// }
|
||||
//
|
||||
// //Mutate Sigmas
|
||||
// for (int i = 0; i < x.length; i++) {
|
||||
// this.m_Sigmas[i] = this.m_Sigmas[i] * Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RNG.gaussianDouble(1));
|
||||
// if (this.m_Sigmas[i] < this.m_LowerLimitStepSize) this.m_Sigmas[i] = this.m_LowerLimitStepSize;
|
||||
// this.sigmas[i] = this.sigmas[i] * Math.exp(this.tau1 * tmpR + this.tau2 * RNG.gaussianDouble(1));
|
||||
// if (this.sigmas[i] < this.lowerLimitStepSize) this.sigmas[i] = this.lowerLimitStepSize;
|
||||
// }
|
||||
//
|
||||
//// if (this.m_Alphas == null) {
|
||||
//// if (this.alphas == null) {
|
||||
//// // init the Alphas
|
||||
//// this.m_Alphas = new double[(x.length*(x.length-1))/2];
|
||||
//// for (int i = 0; i < this.m_Alphas.length; i++) this.m_Alphas[i] = 0.0;
|
||||
//// this.alphas = new double[(x.length*(x.length-1))/2];
|
||||
//// for (int i = 0; i < this.alphas.length; i++) this.alphas[i] = 0.0;
|
||||
//// }
|
||||
//
|
||||
//// //Mutate Alphas
|
||||
//// for (int i = 0; i < this.m_Alphas.length; i++) {
|
||||
//// this.m_Alphas[i] = this.m_Alphas[i] + RNG.gaussianDouble(0.01);
|
||||
//// if (this.m_Alphas[i] < -m_PI/2) this.m_Alphas[i] = -m_PI/2;
|
||||
//// if (this.m_Alphas[i] > m_PI/2) this.m_Alphas[i] = m_PI/2;
|
||||
//// for (int i = 0; i < this.alphas.length; i++) {
|
||||
//// this.alphas[i] = this.alphas[i] + RNG.gaussianDouble(0.01);
|
||||
//// if (this.alphas[i] < -m_PI/2) this.alphas[i] = -m_PI/2;
|
||||
//// if (this.alphas[i] > m_PI/2) this.alphas[i] = m_PI/2;
|
||||
//// }
|
||||
//
|
||||
// //Generate mutationvector in unitspace modified by sigmas
|
||||
// for (int i = 0; i < x.length; i++) {
|
||||
// xCopy[i] = RNG.gaussianDouble(this.m_Sigmas[i]);
|
||||
// xCopy[i] = RNG.gaussianDouble(this.sigmas[i]);
|
||||
// }
|
||||
//
|
||||
// //modify genotype
|
||||
@ -199,26 +199,26 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
|
||||
//Mutate Sigmas
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
this.m_Sigmas[i] *= Math.exp(this.m_Tau1 * tmpR + this.m_Tau2 * RNG.gaussianDouble(1));
|
||||
if (this.m_Sigmas[i] < this.m_LowerLimitStepSize) {
|
||||
this.m_Sigmas[i] = this.m_LowerLimitStepSize;
|
||||
this.sigmas[i] *= Math.exp(this.tau1 * tmpR + this.tau2 * RNG.gaussianDouble(1));
|
||||
if (this.sigmas[i] < this.lowerLimitStepSize) {
|
||||
this.sigmas[i] = this.lowerLimitStepSize;
|
||||
}
|
||||
}
|
||||
|
||||
//Mutate Alphas
|
||||
for (int i = 0; i < this.m_Alphas.length; i++) {
|
||||
this.m_Alphas[i] += RNG.gaussianDouble(0.2);
|
||||
if (this.m_Alphas[i] < -Math.PI/2) {
|
||||
this.m_Alphas[i] = -Math.PI/2;
|
||||
for (int i = 0; i < this.alphas.length; i++) {
|
||||
this.alphas[i] += RNG.gaussianDouble(0.2);
|
||||
if (this.alphas[i] < -Math.PI/2) {
|
||||
this.alphas[i] = -Math.PI/2;
|
||||
}
|
||||
if (this.m_Alphas[i] > Math.PI/2) {
|
||||
this.m_Alphas[i] = Math.PI/2;
|
||||
if (this.alphas[i] > Math.PI/2) {
|
||||
this.alphas[i] = Math.PI/2;
|
||||
}
|
||||
}
|
||||
|
||||
//Generate mutationvector in unitspace modified by sigmas
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
xCopy[i] = RNG.gaussianDouble(this.m_Sigmas[i]);
|
||||
xCopy[i] = RNG.gaussianDouble(this.sigmas[i]);
|
||||
}
|
||||
|
||||
//turn mutationvector with alphas
|
||||
@ -268,7 +268,7 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
sum+=n-count-1;
|
||||
}
|
||||
sum+=j-i; sum--;
|
||||
return this.m_Alphas[sum];
|
||||
return this.alphas[sum];
|
||||
}else{
|
||||
System.err.println("Falscher Zugriff auf Alphaliste!");
|
||||
return 0.0;
|
||||
@ -308,10 +308,10 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
this.m_Tau2 = d;
|
||||
this.tau2 = d;
|
||||
}
|
||||
public double getTau2() {
|
||||
return this.m_Tau2;
|
||||
return this.tau2;
|
||||
}
|
||||
public String tau2TipText() {
|
||||
return "Set the value for tau2.";
|
||||
@ -322,12 +322,12 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
*/
|
||||
public void setMutationStepSize(double d) {
|
||||
if (d < 0) {
|
||||
d = this.m_LowerLimitStepSize;
|
||||
d = this.lowerLimitStepSize;
|
||||
}
|
||||
this.m_MutationStepSize = d;
|
||||
this.mutationStepSize = d;
|
||||
}
|
||||
public double getMutationStepSize() {
|
||||
return this.m_MutationStepSize;
|
||||
return this.mutationStepSize;
|
||||
}
|
||||
public String mutationStepSizeTipText() {
|
||||
return "Choose the initial mutation step size.";
|
||||
@ -340,10 +340,10 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
this.m_LowerLimitStepSize = d;
|
||||
this.lowerLimitStepSize = d;
|
||||
}
|
||||
public double getLowerLimitStepSize() {
|
||||
return this.m_LowerLimitStepSize;
|
||||
return this.lowerLimitStepSize;
|
||||
}
|
||||
public String lowerLimitStepSizeTipText() {
|
||||
return "Set the lower limit for the mutation step size.";
|
||||
@ -356,10 +356,10 @@ public class MutateESCorrolated implements InterfaceMutation, java.io.Serializab
|
||||
if (d < 0) {
|
||||
d = 0;
|
||||
}
|
||||
this.m_Tau1 = d;
|
||||
this.tau1 = d;
|
||||
}
|
||||
public double getTau1() {
|
||||
return this.m_Tau1;
|
||||
return this.tau1;
|
||||
}
|
||||
public String tau1TipText() {
|
||||
return "Set the value for tau1.";
|
||||
|
@ -120,7 +120,7 @@ public class MutateESMutativeStepSizeControl implements InterfaceMutation, java.
|
||||
}
|
||||
}
|
||||
((InterfaceESIndividual)individual).SetDGenotype(x);
|
||||
// System.out.println("new step size: " + m_MutationStepSize);
|
||||
// System.out.println("new step size: " + mutationStepSize);
|
||||
}
|
||||
//System.out.println("After Mutate: " +((GAIndividual)individual).getSolutionRepresentationFor());
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ package eva2.optimization.operators.mutation;
|
||||
// * To change this template use Options | File Templates.
|
||||
// */
|
||||
//public class MutateESStandard implements InterfaceMutation, java.io.Serializable {
|
||||
// protected double m_MutationStepSize = 0.1;
|
||||
// protected double mutationStepSize = 0.1;
|
||||
// public MutateESStandard() {
|
||||
// }
|
||||
//
|
||||
// public MutateESStandard(MutateESStandard d) {
|
||||
// this.m_MutationStepSize = d.m_MutationStepSize;
|
||||
// this.mutationStepSize = d.mutationStepSize;
|
||||
// }
|
||||
//
|
||||
// /** This method will enable you to clone a given mutation operator
|
||||
@ -39,7 +39,7 @@ package eva2.optimization.operators.mutation;
|
||||
// public boolean equals(Object mutator) {
|
||||
// if (mutator instanceof MutateESStandard) {
|
||||
// MutateESStandard mut = (MutateESStandard)mutator;
|
||||
// if (this.m_MutationStepSize != mut.m_MutationStepSize) return false;
|
||||
// if (this.mutationStepSize != mut.mutationStepSize) return false;
|
||||
// return true;
|
||||
// } else return false;
|
||||
// }
|
||||
@ -62,7 +62,7 @@ package eva2.optimization.operators.mutation;
|
||||
// double[] x = ((InterfaceESIndividual)individual).getDGenotype();
|
||||
// double[][] range = ((InterfaceESIndividual)individual).getDoubleRange();
|
||||
// for (int i = 0; i < x.length; i++) {
|
||||
// x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.m_MutationStepSize);
|
||||
// x[i] += ((range[i][1] -range[i][0])/2)*RNG.gaussianDouble(this.mutationStepSize);
|
||||
// if (range[i][0] > x[i]) x[i] = range[i][0];
|
||||
// if (range[i][1] < x[i]) x[i] = range[i][1];
|
||||
// }
|
||||
@ -111,10 +111,10 @@ package eva2.optimization.operators.mutation;
|
||||
// */
|
||||
// public void setMutationStepSize(double step) {
|
||||
// if (step < 0) step = 0.0000001;
|
||||
// this.m_MutationStepSize = step;
|
||||
// this.mutationStepSize = step;
|
||||
// }
|
||||
// public double getMutationStepSize() {
|
||||
// return this.m_MutationStepSize;
|
||||
// return this.mutationStepSize;
|
||||
// }
|
||||
// public String mutationStepSizeTipText() {
|
||||
// return "Set the value for the fixed mutation step size.";
|
||||
|
@ -14,8 +14,8 @@ import eva2.optimization.populations.Population;
|
||||
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;
|
||||
// protected double m_MutationStepSize = 0.2; // now in base class
|
||||
// protected static double mutationStepSize = 0.2;
|
||||
// protected double mutationStepSize = 0.2; // now in base class
|
||||
protected double m_SuccessRate = 0.2;
|
||||
protected double m_Alpha = 1.2;
|
||||
|
||||
|
@ -1410,7 +1410,7 @@ listener.println("found " + getFoundOptima(solutions, mmkProb.getRealOptima(), e
|
||||
double[] avgFit = null;
|
||||
Population pop = new Population(portion);
|
||||
IndividualInterface indy;
|
||||
prob.initProblem();
|
||||
prob.initializeProblem();
|
||||
while (cnt < steps) {
|
||||
pop.clear();
|
||||
for (int i=0; i<curPopSize; i++) {
|
||||
|
@ -648,7 +648,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
this.functionCallCount += toHit; // little cheat, notify may be after some more evals
|
||||
firePropertyChangedEvent(funCallIntervalReached);
|
||||
d -= toHit;
|
||||
// this.m_FunctionCalls += (d-toHit);
|
||||
// this.functionCalls += (d-toHit);
|
||||
}
|
||||
if (d > 0) {
|
||||
this.functionCallCount += d; // add up the rest
|
||||
|
@ -110,10 +110,10 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz
|
||||
* Initializes the underlying problem in the problem class
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
bestIndividual = null;
|
||||
getProblem().initProblem();
|
||||
getProblem().initializeProblem();
|
||||
}
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz
|
||||
if (TRACE) {
|
||||
System.out.println("DynTransProblem at " + this + " initPop, problem is " + getProblem());
|
||||
}
|
||||
getProblem().initPopulation(population);
|
||||
getProblem().initializePopulation(population);
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
((AbstractEAIndividual)population.get(i)).SetAge(0);
|
||||
}
|
||||
@ -172,7 +172,7 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz
|
||||
/* to get the right values for problemDimension and Range */
|
||||
Population pop = new Population();
|
||||
pop.setTargetSize(1);
|
||||
prob.initPopulation(pop);
|
||||
prob.initializePopulation(pop);
|
||||
AbstractEAIndividual indy = (AbstractEAIndividual)pop.get(0);
|
||||
if (indy instanceof InterfaceDataTypeDouble) {
|
||||
problemDimension = ((InterfaceDataTypeDouble)indy).getDoubleRange().length;
|
||||
|
@ -84,7 +84,7 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
setCurrentProblemTime(getStartTime());
|
||||
if (myplot != null) {
|
||||
try {
|
||||
@ -108,8 +108,8 @@ makePlot();
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
//initProblem(); // this shouldnt be necessary
|
||||
public void initializePopulation(Population population) {
|
||||
//initializeProblem(); // this shouldnt be necessary
|
||||
this.initPopulationAt(population, getCurrentProblemTime());
|
||||
}
|
||||
|
||||
|
@ -16,94 +16,65 @@ import java.util.List;
|
||||
public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDouble
|
||||
implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
protected static InterfaceDistanceMetric m_Metric = new PhenotypeMetric();
|
||||
private double m_GlobalOpt = 0;
|
||||
protected Population m_ListOfOptima;
|
||||
protected double m_Epsilon = 0.05;
|
||||
// protected double[][] m_Range;
|
||||
// protected double[] m_Extrema;
|
||||
protected int m_ProblemDimension = 2;
|
||||
private double globalOptimum = 0;
|
||||
protected Population listOfOptima;
|
||||
protected double epsilon = 0.05;
|
||||
protected int problemDimension = 2;
|
||||
// if the global optimum is zero and we want to see logarithmic plots, the offset must be a little lower. see addOptimum()
|
||||
protected boolean makeGlobalOptUnreachable = false;
|
||||
protected boolean makeGlobalOptUnreachable = false;
|
||||
|
||||
public AbstractMultiModalProblemKnown() {
|
||||
this.m_ProblemDimension = 2;
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
// this.m_Extrema = new double[2];
|
||||
// this.m_Range = makeRange();
|
||||
// this.m_Extrema[0] = -2;
|
||||
// this.m_Extrema[1] = 6;
|
||||
this.problemDimension = 2;
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
|
||||
protected void cloneObjects(AbstractMultiModalProblemKnown b) {
|
||||
super.cloneObjects(b);
|
||||
if (b.m_ListOfOptima != null) {
|
||||
this.m_ListOfOptima = (Population)((Population)b.m_ListOfOptima).clone();
|
||||
}
|
||||
// if (b.m_Range != null) {
|
||||
// this.m_Range = new double[b.m_Range.length][b.m_Range[0].length];
|
||||
// for (int i = 0; i < this.m_Range.length; i++) {
|
||||
// for (int j = 0; j < this.m_Range[i].length; j++) {
|
||||
// this.m_Range[i][j] = b.m_Range[i][j];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
this.m_ProblemDimension = b.m_ProblemDimension;
|
||||
this.m_GlobalOpt = b.m_GlobalOpt;
|
||||
this.m_Epsilon = b.m_Epsilon;
|
||||
// if (b.m_Extrema != null) {
|
||||
// this.m_Extrema = new double[b.m_Extrema.length];
|
||||
// for (int i = 0; i < this.m_Extrema.length; i++) {
|
||||
// this.m_Extrema[i] = b.m_Extrema[i];
|
||||
// }
|
||||
// }
|
||||
if (b.listOfOptima != null) {
|
||||
this.listOfOptima = (Population)((Population)b.listOfOptima).clone();
|
||||
};
|
||||
this.globalOptimum = b.globalOptimum;
|
||||
this.epsilon = b.epsilon;
|
||||
}
|
||||
|
||||
public AbstractMultiModalProblemKnown(AbstractMultiModalProblemKnown b) {
|
||||
cloneObjects(b);
|
||||
}
|
||||
|
||||
// /** This method returns a deep clone of the problem.
|
||||
// * @return the clone
|
||||
// */
|
||||
// public Object clone() {
|
||||
// return (Object) new AbstractMultiModalProblem(this);
|
||||
// }
|
||||
|
||||
/** This method inits a given population
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
AbstractEAIndividual tmpIndy;
|
||||
|
||||
population.clear();
|
||||
|
||||
// this.m_ProblemDimension = 2;
|
||||
((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(makeRange());
|
||||
((InterfaceDataTypeDouble)this.template).setDoubleDataLength(this.problemDimension);
|
||||
((InterfaceDataTypeDouble)this.template).SetDoubleRange(makeRange());
|
||||
for (int i = 0; i < population.getTargetSize(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual)((AbstractEAIndividual)this.m_Template).clone();
|
||||
tmpIndy = (AbstractEAIndividual)((AbstractEAIndividual)this.template).clone();
|
||||
tmpIndy.init(this);
|
||||
population.add(tmpIndy);
|
||||
}
|
||||
// population init must be last
|
||||
// it set's fitcalls and generation to zero
|
||||
population.init();
|
||||
if (m_ListOfOptima == null) {
|
||||
this.m_GlobalOpt = Double.NEGATIVE_INFINITY;
|
||||
m_ListOfOptima = new Population();
|
||||
if (listOfOptima == null) {
|
||||
this.globalOptimum = Double.NEGATIVE_INFINITY;
|
||||
listOfOptima = new Population();
|
||||
this.initListOfOptima();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
this.m_GlobalOpt = Double.NEGATIVE_INFINITY;
|
||||
m_ListOfOptima = new Population();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
this.globalOptimum = Double.NEGATIVE_INFINITY;
|
||||
listOfOptima = new Population();
|
||||
this.initListOfOptima();
|
||||
if (!fullListAvailable() && (Double.isInfinite(m_GlobalOpt))) {
|
||||
m_GlobalOpt=0;
|
||||
if (!fullListAvailable() && (Double.isInfinite(globalOptimum))) {
|
||||
globalOptimum =0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,7 +86,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = this.m_GlobalOpt - evalUnnormalized(x)[0];
|
||||
result[0] = this.globalOptimum - evalUnnormalized(x)[0];
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -140,27 +111,11 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
@Override
|
||||
public Object[] getAdditionalDataValue(PopulationInterface pop) {
|
||||
Object[] result = new Object[2];
|
||||
// result += AbstractEAIndividual.getDefaultDataString(pop.getBestIndividual()) +"\t";
|
||||
result[0] = this.getNumberOfFoundOptima((Population)pop);
|
||||
result[1] = this.getMaximumPeakRatio((Population)pop);
|
||||
return ToolBox.appendArrays(result, super.getAdditionalDataValue(pop));
|
||||
}
|
||||
//
|
||||
// /** This method returns a string describing the optimization problem.
|
||||
// * @return The description.
|
||||
// */
|
||||
// public String getStringRepresentation() {
|
||||
// String result = "";
|
||||
//
|
||||
// result += "M0 function:\n";
|
||||
// result += "This problem has one global and one local optimum.\n";
|
||||
// result += "Parameters:\n";
|
||||
// result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
// result += "Noise level : " + this.getNoise() + "\n";
|
||||
// result += "Solution representation:\n";
|
||||
// //result += this.m_Template.getSolutionRepresentationFor();
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* Implementation of InterfaceMultimodalProblemKnown
|
||||
@ -178,33 +133,32 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
}
|
||||
|
||||
/** This method allows you to add a 2d optima to the list of optima
|
||||
* @param x
|
||||
* @param y
|
||||
* @param point
|
||||
*/
|
||||
protected void addOptimum(double[] point) {
|
||||
InterfaceDataTypeDouble tmpIndy;
|
||||
tmpIndy = (InterfaceDataTypeDouble)((AbstractEAIndividual)this.m_Template).clone();
|
||||
tmpIndy = (InterfaceDataTypeDouble)((AbstractEAIndividual)this.template).clone();
|
||||
tmpIndy.SetDoubleGenotype(point);
|
||||
((AbstractEAIndividual)tmpIndy).setFitness(evalUnnormalized(point));
|
||||
if (((AbstractEAIndividual)tmpIndy).getFitness(0)>=m_GlobalOpt) {
|
||||
m_GlobalOpt = ((AbstractEAIndividual)tmpIndy).getFitness(0);
|
||||
if (((AbstractEAIndividual)tmpIndy).getFitness(0)>= globalOptimum) {
|
||||
globalOptimum = ((AbstractEAIndividual)tmpIndy).getFitness(0);
|
||||
if (makeGlobalOptUnreachable) {
|
||||
double tmp=m_GlobalOpt;
|
||||
double tmp= globalOptimum;
|
||||
double dx = 1e-30;
|
||||
while (tmp==m_GlobalOpt) {
|
||||
while (tmp== globalOptimum) {
|
||||
// this increases the optimum until there is a real difference.
|
||||
// tries to avoid zero y-values which break the logarithmic plot
|
||||
tmp+=dx;
|
||||
dx *= 10;
|
||||
}
|
||||
m_GlobalOpt = tmp;
|
||||
globalOptimum = tmp;
|
||||
}
|
||||
}
|
||||
if (isDoRotation()) {
|
||||
point = inverseRotateMaybe(point); // theres an inverse rotation required
|
||||
tmpIndy.SetDoubleGenotype(point);
|
||||
}
|
||||
this.m_ListOfOptima.add(tmpIndy);
|
||||
this.listOfOptima.add(tmpIndy);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -222,7 +176,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
*/
|
||||
@Override
|
||||
public Population getRealOptima() {
|
||||
return this.m_ListOfOptima;
|
||||
return this.listOfOptima;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,7 +219,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return getMaximumPeakRatio(this.getRealOptima(), pop, m_Epsilon);
|
||||
return getMaximumPeakRatio(this.getRealOptima(), pop, epsilon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,7 +227,7 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
* Returns -1 if the full list is not available. Otherwise calculates the maximum peak ratio
|
||||
* based on the full list of known optima.
|
||||
* This assumes that the realOpts have fitness values assigned as for maximization and the
|
||||
* pop has fitness values assigned for minimization (mirrored by maximum fitness within realOpts).
|
||||
* population has fitness values assigned for minimization (mirrored by maximum fitness within realOpts).
|
||||
*
|
||||
* This is in analogy to the original implementation by F.Streichert.
|
||||
*
|
||||
@ -287,8 +241,6 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
if (realOpts==null || (realOpts.size()==0)) {
|
||||
return -1;
|
||||
}
|
||||
// if (!mmProb.fullListAvailable()) return -1;
|
||||
// Population realOpts = mmProb.getRealOptima();
|
||||
double tmp, maxOpt = realOpts.getEAIndividual(0).getFitness(0);
|
||||
sumRealMaxima = maxOpt;
|
||||
for (int i=1; i<realOpts.size(); i++) {
|
||||
@ -309,16 +261,14 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
EVAERROR.errorMsgOnce("warning: for the MPR calculation, negative fitness values may disturb the allover result (AbstractMultiModalProblemKnown)");
|
||||
}
|
||||
foundInvertedSum += Math.max(0., tmp);
|
||||
// System.out.println("foundInvertedSum = " + foundInvertedSum);
|
||||
}
|
||||
}
|
||||
}
|
||||
// System.out.println("foundSum: " + foundInvertedSum + " realsum: " + sumRealMaxima + " ratio: " + foundInvertedSum/sumRealMaxima);
|
||||
return foundInvertedSum/sumRealMaxima;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns -1 if the full list is not available. Otherwise calculates the maximum peak ratio
|
||||
* based on the full list of known optima. Assumes that both realOpts and pop have fitness
|
||||
* based on the full list of known optima. Assumes that both realOpts and population have fitness
|
||||
* values assigned as in a maximization problem. This is the standard formulation of MPR.
|
||||
*
|
||||
* @param mmProb
|
||||
@ -348,9 +298,8 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
* values are positive (and for a corresponding pair, foundFits[i]<realFits[i]).
|
||||
* If these assumptions hold, the MPR lies in [0,1].
|
||||
*
|
||||
* @param mmProb
|
||||
* @param pop
|
||||
* @param epsilon
|
||||
* @param realFits
|
||||
* @param foundFits
|
||||
* @return
|
||||
*/
|
||||
public static double getMaximumPeakRatioMaximization(double[] realFits, double[] foundFits) {
|
||||
@ -360,12 +309,12 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
|
||||
/**
|
||||
* Returns -1 if the full list is not available. Otherwise calculates the maximum peak ratio
|
||||
* based on the full list of known optima. Assumes that both realOpts and pop have fitness
|
||||
* based on the full list of known optima. Assumes that both realOpts and population have fitness
|
||||
* values assigned as in a minimization problem. Using a fitness value fitThreshold, they are inverted
|
||||
* and then treated as in maximization. An optimum which has not been found closely (by epsilon)
|
||||
* in the population is assumed to be covered with an individual of fitness fitThreshold.
|
||||
*
|
||||
* @param mmProb
|
||||
* @param realOpts
|
||||
* @param pop
|
||||
* @param epsilon
|
||||
* @return
|
||||
@ -408,67 +357,18 @@ implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
|
||||
// now we can call the standard calculation method
|
||||
return getMaximumPeakRatioMaximization(realFits, foundFits);
|
||||
}
|
||||
|
||||
// public double getMaximumPeakRatio(Population pop) {
|
||||
// double result = 0, sum = 0;
|
||||
// AbstractEAIndividual posOpt, opt;
|
||||
// boolean[] found = new boolean[this.m_Optima.size()];
|
||||
// for (int i = 0; i < found.length; i++) {
|
||||
// found[i] = false;
|
||||
// sum += ((AbstractEAIndividual)this.m_Optima.get(i)).getFitness(0) ;
|
||||
// //System.out.println("Optimum " + i + ".: " + (((AbstractEAIndividual)this.m_Optima.get(i)).getFitness(0)));
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < pop.size(); i++) {
|
||||
// posOpt = (AbstractEAIndividual) pop.get(i);
|
||||
// for (int j = 0; j < this.m_Optima.size(); j++) {
|
||||
// if (!found[j]) {
|
||||
// opt = (AbstractEAIndividual) this.m_Optima.get(j);
|
||||
// if (this.m_Metric.distance(posOpt, opt) < this.m_Epsilon) {
|
||||
// found[j] = true;
|
||||
// result += this.m_GlobalOpt - posOpt.getFitness(0);
|
||||
// //System.out.println("Found Optimum " + j + ".: " + (this.m_GlobalOpt - posOpt.getFitness(0)));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return result/sum;
|
||||
// }
|
||||
/**********************************************************************************************************************
|
||||
* These are for GUI
|
||||
*/
|
||||
|
||||
// /** This method returns this min and may fitness occuring
|
||||
// * @return double[]
|
||||
// */
|
||||
// public double[] getExtrema() {
|
||||
// double[] range = new double[2];
|
||||
// range[0] = -5;
|
||||
// range[1] = 5;
|
||||
// return range;
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @return the m_Epsilon
|
||||
// */
|
||||
// public double getEpsilon() {
|
||||
// return m_Epsilon;
|
||||
// }
|
||||
|
||||
/**
|
||||
* @param epsilon the m_Epsilon to set
|
||||
* @param epsilon the epsilon to set
|
||||
*/
|
||||
@Override
|
||||
public void setDefaultAccuracy(double epsilon) {
|
||||
super.SetDefaultAccuracy(epsilon);
|
||||
}
|
||||
//
|
||||
// public String epsilonTipText() {
|
||||
// return "Epsilon criterion indicating whether an optimum was found";
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getProblemDimension() {
|
||||
return m_ProblemDimension;
|
||||
return problemDimension;
|
||||
}
|
||||
}
|
@ -106,7 +106,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
|
||||
public AbstractMultiObjectiveOptimizationProblem(double borderHigh) {
|
||||
super();
|
||||
m_defaultBorderHigh=borderHigh;
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
makeBorder();
|
||||
if (this.m_Show) {
|
||||
this.initProblemFrame();
|
||||
@ -151,7 +151,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
|
||||
* problem frame (i'll provide a default implementation here.
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
makeBorder();
|
||||
this.m_ParetoFront = new Population();
|
||||
if (this.m_Show) {
|
||||
@ -380,7 +380,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
|
||||
tmpPop = moProblem.m_ParetoFront;
|
||||
} else {
|
||||
// in this case i use the population of the optimizer
|
||||
// and eventually the pop.archive if there is one
|
||||
// and eventually the population.archive if there is one
|
||||
tmpPop = new Population();
|
||||
tmpPop.addPopulation(p);
|
||||
if (p.getArchive() != null) {
|
||||
@ -594,28 +594,28 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
|
||||
}
|
||||
|
||||
// /** This method will calculate the s-Metric if an archive population is present.
|
||||
// * @param pop The population.
|
||||
// * @param population The population.
|
||||
// * @return s-metric
|
||||
// */
|
||||
// public double tcalculateSMetric(Population pop) {
|
||||
// public double tcalculateSMetric(Population population) {
|
||||
// double result = 0;
|
||||
//
|
||||
// ((SMetric)this.m_Metric).setObjectiveSpaceRange(this.m_Border);
|
||||
// result = this.m_Metric.calculateMetricOn(pop);
|
||||
// result = this.m_Metric.calculateMetricOn(population);
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// /** This method will calculate the s-Metric if an archive population is present.
|
||||
// * @param pop The population.
|
||||
// * @param population The population.
|
||||
// * @return s-metric
|
||||
// */
|
||||
// public double calculateRelativeSMetric(Population pop, double[][] ref) {
|
||||
// public double calculateRelativeSMetric(Population population, double[][] ref) {
|
||||
// double result = 0;
|
||||
// SMetricWithReference tmpMetric = new SMetricWithReference();
|
||||
// tmpMetric.setObjectiveSpaceRange(this.m_Border);
|
||||
// tmpMetric.setReferenceFront(ref);
|
||||
// result = tmpMetric.calculateMetricOn(pop);
|
||||
// result = tmpMetric.calculateMetricOn(population);
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
@ -42,33 +42,25 @@ import javax.swing.JTextArea;
|
||||
* Time: 13:40:12
|
||||
* To change this template use Options | File Templates.
|
||||
*/
|
||||
public abstract class AbstractOptimizationProblem
|
||||
implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serializable {
|
||||
public abstract class AbstractOptimizationProblem implements InterfaceOptimizationProblem, Serializable {
|
||||
class EvalThread extends Thread {
|
||||
AbstractOptimizationProblem prob;
|
||||
AbstractEAIndividual ind;
|
||||
// Vector<AbstractEAIndividual> resultrep;
|
||||
Population pop;
|
||||
Semaphore m_Semaphore;
|
||||
Population population;
|
||||
Semaphore semaphore;
|
||||
|
||||
public EvalThread(AbstractOptimizationProblem prob, AbstractEAIndividual ind, Population pop,Semaphore sema) {
|
||||
this.ind = ind;
|
||||
this.prob = prob;
|
||||
// this.resultrep = resultrep;
|
||||
this.pop = pop;
|
||||
this.m_Semaphore=sema;
|
||||
this.population = pop;
|
||||
this.semaphore =sema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// System.out.println("Running ET " + this);
|
||||
// long time=System.nanoTime();
|
||||
prob.evaluate(ind);
|
||||
// resultrep.add(ind);
|
||||
pop.incrFunctionCalls();
|
||||
m_Semaphore.release();
|
||||
// long duration=System.nanoTime()-time;
|
||||
// System.out.println("Finished ET" + this + ", time was " + duration);
|
||||
population.incrFunctionCalls();
|
||||
semaphore.release();
|
||||
}
|
||||
|
||||
}
|
||||
@ -82,9 +74,9 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
*/
|
||||
public static final String OLD_FITNESS_KEY = "oldFitness";
|
||||
|
||||
int parallelthreads = 1;
|
||||
private int parallelthreads = 1;
|
||||
|
||||
protected AbstractEAIndividual m_Template = null;
|
||||
protected AbstractEAIndividual template = null;
|
||||
// private transient ArrayList<ParamChangeListener> changeListeners = null;
|
||||
|
||||
private double defaultAccuracy = 0.001; // default accuracy for identifying optima.
|
||||
@ -112,7 +104,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
* If you override it, make sure to call the super method!
|
||||
*/
|
||||
@Override
|
||||
public abstract void initProblem();
|
||||
public abstract void initializeProblem();
|
||||
|
||||
/******************** The most important methods ****************************************/
|
||||
|
||||
@ -120,7 +112,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public abstract void initPopulation(Population population);
|
||||
public abstract void initializePopulation(Population population);
|
||||
|
||||
/** This method evaluates a given population and set the fitness values
|
||||
* accordingly
|
||||
@ -133,27 +125,6 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
|
||||
if (this.parallelthreads > 1) {
|
||||
Vector<AbstractEAIndividual> queue = new Vector<AbstractEAIndividual>(population.size());
|
||||
// Vector<AbstractEAIndividual> finished = new Vector<AbstractEAIndividual>(population.size());
|
||||
/* queue.addAll(population);
|
||||
Semaphore sema=new Semaphore(parallelthreads);
|
||||
while (finished.size() < population.size()) {
|
||||
try {
|
||||
sema.acquire();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ((population.size()-(queue.size() + finished.size())) < parallelthreads) {
|
||||
if (queue.size() > 0) {
|
||||
AbstractEAIndividual tmpindy = queue.get(0);
|
||||
queue.remove(0);
|
||||
tmpindy.resetConstraintViolation();
|
||||
EvalThread evalthread = new EvalThread(this,tmpindy,finished,population,sema);
|
||||
evalthread.start();
|
||||
|
||||
}
|
||||
}
|
||||
}*/
|
||||
Semaphore sema=new Semaphore(0);
|
||||
ExecutorService pool = Executors.newFixedThreadPool(parallelthreads);
|
||||
int cntIndies=0;
|
||||
@ -338,7 +309,6 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
Population maybeFiltered = (Population)pop;
|
||||
if (pop.size()>100) { // for efficiency reasons...
|
||||
maybeFiltered = maybeFiltered.filterByFitness(hist.getUpperBound(), fitCrit);
|
||||
// System.out.println("Reduced " + pop.size() + " to " + maybeFiltered.size());
|
||||
}
|
||||
Population sols = PostProcess.clusterBestUpdateHistogram((Population)maybeFiltered, this, hist, fitCrit, getDefaultAccuracy());
|
||||
}
|
||||
@ -429,7 +399,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
* @return the problem's individual template
|
||||
*/
|
||||
public AbstractEAIndividual getIndividualTemplate() {
|
||||
return m_Template;
|
||||
return template;
|
||||
}
|
||||
|
||||
public String individualTemplateTipText() {
|
||||
@ -451,7 +421,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
double epsilonPhenoSpace, double epsilonFitConv, double clusterSigma, int maxEvalsPerIndy) {
|
||||
Population potOptima = new Population();
|
||||
for (int i = 0; i < pop.size(); ++i){
|
||||
//System.out.println("Refining " + i + " of " + pop.size());
|
||||
//System.out.println("Refining " + i + " of " + population.size());
|
||||
AbstractEAIndividual indy = pop.getEAIndividual(i);
|
||||
// System.out.println("bef: " + indy.toString());
|
||||
boolean isConverged = AbstractOptimizationProblem.isPotentialOptimumNMS(prob, indy, epsilonPhenoSpace, epsilonFitConv, maxEvalsPerIndy);
|
||||
@ -496,7 +466,7 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
mutationStepSize = 0.0001;
|
||||
}
|
||||
if (numOfFailures<0) {
|
||||
numOfFailures = 100*AbstractEAIndividual.getDoublePositionShallow(this.m_Template).length;
|
||||
numOfFailures = 100*AbstractEAIndividual.getDoublePositionShallow(this.template).length;
|
||||
} // scales the effort with the number of problem dimensions
|
||||
|
||||
AbstractEAIndividual indy = (AbstractEAIndividual)orig.clone();
|
||||
@ -564,11 +534,10 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
double initRelPerturb = -1;
|
||||
int dim = -1;
|
||||
if (orig instanceof InterfaceDataTypeDouble) {
|
||||
// initPerturb = epsilonPhenoSpace/(2*(Mathematics.getAvgRange(((InterfaceDataTypeDouble)orig).getDoubleRange())));
|
||||
initRelPerturb = epsilonPhenoSpace*0.5;
|
||||
dim=((InterfaceDataTypeDouble)orig).getDoubleRange().length;
|
||||
if (maxEvaluations<0) {
|
||||
maxEvaluations = 500*AbstractEAIndividual.getDoublePositionShallow(prob.m_Template).length;
|
||||
maxEvaluations = 500*AbstractEAIndividual.getDoublePositionShallow(prob.template).length;
|
||||
} // scales the effort with the number of problem dimensions
|
||||
} else {
|
||||
System.err.println("Cannot initialize NMS on non-double valued individuals!");
|
||||
@ -584,19 +553,19 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
||||
int evalsPerf = PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, term, initRelPerturb, prob);
|
||||
overallDist = metric.distance(indy, pop.getBestEAIndividual());
|
||||
//System.out.println(System.currentTimeMillis() + " in " + evalsPerf + " evals moved by "+ overallDist);
|
||||
// System.out.println("aft: " + pop.getBestEAIndividual().toString() + ", evals performed: " + evalsPerf + ", opt moved by " + overallDist);
|
||||
// System.out.println("aft: " + population.getBestEAIndividual().toString() + ", evals performed: " + evalsPerf + ", opt moved by " + overallDist);
|
||||
// System.out.println("terminated because: " + term.lastTerminationMessage());
|
||||
orig.putData(PostProcess.movedDistanceKey, overallDist);
|
||||
orig.putData(PostProcess.movedToPositionKey, pop.getBestEAIndividual().getDoublePosition());
|
||||
// if (overallDist==0) {
|
||||
// PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, pop, term, initPerturb, this);
|
||||
// PostProcess.processSingleCandidatesNMCMA(PostProcessMethod.nelderMead, population, term, initPerturb, this);
|
||||
// }
|
||||
|
||||
// System.out.println("Checked "+ indy.getStringRepresentation());
|
||||
// String msg = "----discarding ";
|
||||
// if (overallDist <= epsilonPhenoSpace) msg= "++++keeping ";
|
||||
// System.out.println(msg + BeanInspector.toString(indy.getDoublePosition()));
|
||||
// System.out.println("which moved to " + BeanInspector.toString(pop.getBestEAIndividual().getDoublePosition()));
|
||||
// System.out.println("which moved to " + BeanInspector.toString(population.getBestEAIndividual().getDoublePosition()));
|
||||
// System.out.println(" by " + overallDist + " > " + epsilonPhenoSpace);
|
||||
|
||||
return (overallDist < epsilonPhenoSpace);
|
||||
|
@ -17,7 +17,7 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi
|
||||
private AbstractOptimizationProblem[] m_Slaves;
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
/* if (this.m_Parallelize) {
|
||||
// this is running on remote maschines
|
||||
String[] nodesList = this.m_Servers.getCheckedServerNodes();
|
||||
|
@ -21,17 +21,17 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
protected void initTemplate() {
|
||||
if (m_Template == null) {
|
||||
this.m_Template = new GAIndividualBinaryData();
|
||||
if (template == null) {
|
||||
this.template = new GAIndividualBinaryData();
|
||||
}
|
||||
if (((InterfaceGAIndividual)this.m_Template).getGenotypeLength()!=this.getProblemDimension()) {
|
||||
((InterfaceDataTypeBinary)this.m_Template).setBinaryDataLength(this.getProblemDimension());
|
||||
if (((InterfaceGAIndividual)this.template).getGenotypeLength()!=this.getProblemDimension()) {
|
||||
((InterfaceDataTypeBinary)this.template).setBinaryDataLength(this.getProblemDimension());
|
||||
}
|
||||
}
|
||||
|
||||
public void cloneObjects(AbstractProblemBinary o) {
|
||||
if (o.m_Template != null) {
|
||||
m_Template = (AbstractEAIndividual)o.m_Template.clone();
|
||||
if (o.template != null) {
|
||||
template = (AbstractEAIndividual)o.template.clone();
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem
|
||||
|
||||
// /**
|
||||
// * Initialize a single individual with index k in the
|
||||
// * initPopulation cycle.
|
||||
// * initializePopulation cycle.
|
||||
// * @param k
|
||||
// * @param indy
|
||||
// */
|
||||
@ -74,13 +74,13 @@ public abstract class AbstractProblemBinary extends AbstractOptimizationProblem
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
((InterfaceDataTypeBinary)this.m_Template).setBinaryDataLength(this.getProblemDimension());
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
public void initializePopulation(Population population) {
|
||||
((InterfaceDataTypeBinary)this.template).setBinaryDataLength(this.getProblemDimension());
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
initTemplate();
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ import eva2.tools.math.RNG;
|
||||
* that case, the default range parameter is not used.
|
||||
*
|
||||
* Anything you want to do before any optimization is started on the problem
|
||||
* should go into {@link #initProblem()}, but remember to call the super-method
|
||||
* should go into {@link #initializeProblem()}, but remember to call the super-method
|
||||
* in your implementation. The individual template will be initialized to an
|
||||
* ESIndividualDoubleData by then.
|
||||
*
|
||||
@ -44,21 +44,14 @@ import eva2.tools.math.RNG;
|
||||
* {@link #getName()} methods to provide some distinctive information for the
|
||||
* user.
|
||||
*
|
||||
*
|
||||
* @author mkron
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
implements InterfaceProblemDouble, Interface2DBorderProblem/*
|
||||
* ,
|
||||
* InterfaceParamControllable
|
||||
*/{
|
||||
public abstract class AbstractProblemDouble extends AbstractOptimizationProblem implements InterfaceProblemDouble, Interface2DBorderProblem {
|
||||
/**
|
||||
* Generated serial version identifier.
|
||||
*/
|
||||
private static final long serialVersionUID = -3904130243174390134L;
|
||||
private double m_DefaultRange = 10;
|
||||
private double m_Noise = 0;
|
||||
private double defaultRange = 10;
|
||||
private double noise = 0;
|
||||
private boolean doRotation = false; // should really be false by default
|
||||
private Matrix rotation;
|
||||
|
||||
@ -80,14 +73,14 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
protected void initTemplate() {
|
||||
if (m_Template == null) {
|
||||
m_Template = new ESIndividualDoubleData();
|
||||
if (template == null) {
|
||||
template = new ESIndividualDoubleData();
|
||||
}
|
||||
if (getProblemDimension() > 0) { // avoid evil case setting dim to 0
|
||||
// during object init
|
||||
((InterfaceDataTypeDouble) this.m_Template)
|
||||
((InterfaceDataTypeDouble) this.template)
|
||||
.setDoubleDataLength(getProblemDimension());
|
||||
((InterfaceDataTypeDouble) this.m_Template)
|
||||
((InterfaceDataTypeDouble) this.template)
|
||||
.SetDoubleRange(makeRange());
|
||||
}
|
||||
}
|
||||
@ -97,11 +90,11 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
protected void cloneObjects(AbstractProblemDouble o) {
|
||||
this.m_DefaultRange = o.m_DefaultRange;
|
||||
this.m_Noise = o.m_Noise;
|
||||
this.defaultRange = o.defaultRange;
|
||||
this.noise = o.noise;
|
||||
this.SetDefaultAccuracy(o.getDefaultAccuracy());
|
||||
if (o.m_Template != null) {
|
||||
this.m_Template = (AbstractEAIndividual) o.m_Template.clone();
|
||||
if (o.template != null) {
|
||||
this.template = (AbstractEAIndividual) o.template.clone();
|
||||
}
|
||||
if (o.constraintArray != null) {
|
||||
this.constraintArray = o.constraintArray.clone();
|
||||
@ -126,11 +119,8 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @return the double solution representation
|
||||
*/
|
||||
protected double[] getEvalArray(AbstractEAIndividual individual) {
|
||||
double[] x = new double[((InterfaceDataTypeDouble) individual)
|
||||
.getDoubleData().length];
|
||||
System.arraycopy(
|
||||
((InterfaceDataTypeDouble) individual).getDoubleData(), 0, x,
|
||||
0, x.length);
|
||||
double[] x = new double[((InterfaceDataTypeDouble) individual).getDoubleData().length];
|
||||
System.arraycopy(((InterfaceDataTypeDouble) individual).getDoubleData(), 0, x, 0, x.length);
|
||||
return x;
|
||||
}
|
||||
|
||||
@ -151,9 +141,9 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
// evaluate the vector
|
||||
fitness = this.eval(x);
|
||||
// if indicated, add Gaussian noise
|
||||
if (m_Noise != 0) {
|
||||
RNG.addNoise(fitness, m_Noise);
|
||||
}
|
||||
if (noise != 0) {
|
||||
RNG.addNoise(fitness, noise);
|
||||
}
|
||||
// set the fitness
|
||||
setEvalFitness(individual, x, fitness);
|
||||
if (isWithConstraints()) {
|
||||
@ -165,8 +155,8 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
protected double[] rotateMaybe(double[] x) {
|
||||
if (isDoRotation()) {
|
||||
if (rotation == null) {
|
||||
initProblem();
|
||||
}
|
||||
initializeProblem();
|
||||
}
|
||||
x = Mathematics.rotate(x, rotation);
|
||||
}
|
||||
return x;
|
||||
@ -175,8 +165,8 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
protected double[] inverseRotateMaybe(double[] x) {
|
||||
if (isDoRotation()) {
|
||||
if (rotation == null) {
|
||||
initProblem();
|
||||
}
|
||||
initializeProblem();
|
||||
}
|
||||
x = Mathematics.rotate(x, rotation.inverse());
|
||||
}
|
||||
return x;
|
||||
@ -190,16 +180,11 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @param indyPos
|
||||
* may contain the decoded individual position
|
||||
*/
|
||||
protected void addConstraints(AbstractEAIndividual individual,
|
||||
double[] indyPos) {
|
||||
AbstractConstraint[] cnstr = getConstraints();
|
||||
for (int i = 0; i < cnstr.length; i++) {
|
||||
// String name= (String)BeanInspector.callIfAvailable(cnstr[i],
|
||||
// "getName", new Object[]{});
|
||||
// System.out.println("checking constraint " + (name==null ?
|
||||
// cnstr[i].getClass().getSimpleName() : name));
|
||||
((AbstractConstraint) cnstr[i]).addViolation(individual, indyPos);
|
||||
}
|
||||
protected void addConstraints(AbstractEAIndividual individual, double[] indyPos) {
|
||||
AbstractConstraint[] contraints = getConstraints();
|
||||
for (AbstractConstraint contraint : contraints) {
|
||||
contraint.addViolation(individual, indyPos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,8 +195,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @param x
|
||||
* @param fit
|
||||
*/
|
||||
protected void setEvalFitness(AbstractEAIndividual individual, double[] x,
|
||||
double[] fit) {
|
||||
protected void setEvalFitness(AbstractEAIndividual individual, double[] x, double[] fit) {
|
||||
individual.setFitness(fit);
|
||||
}
|
||||
|
||||
@ -236,10 +220,9 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
public abstract int getProblemDimension();
|
||||
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
initTemplate();
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population,
|
||||
m_Template, this);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -289,14 +272,13 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
initTemplate();
|
||||
if (isDoRotation()) {
|
||||
rotation = initDefaultRotationMatrix(rotAngle,
|
||||
getProblemDimension());
|
||||
rotation = initializeDefaultRotationMatrix(rotAngle, getProblemDimension());
|
||||
} else {
|
||||
rotation = null;
|
||||
}
|
||||
rotation = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -307,17 +289,9 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @param dim
|
||||
* @return
|
||||
*/
|
||||
public static Matrix initDefaultRotationMatrix(double rotAngle, int dim) {
|
||||
public static Matrix initializeDefaultRotationMatrix(double rotAngle, int dim) {
|
||||
Matrix rotation = null;
|
||||
// Matrix vec = new Matrix(dim, 1);
|
||||
// for (int i=0; i<dim; i++) vec.set(i,0, i+1);
|
||||
// System.out.println(BeanInspector.toString(eval(vec.getColumnPackedCopy())));
|
||||
// rotation = new Matrix(dim, dim);
|
||||
// rotation = Mathematics.getRotationMatrix(vec).transpose();
|
||||
rotation = Mathematics.getRotationMatrix((rotAngle * Math.PI / 180.),
|
||||
dim).transpose();
|
||||
// double[] t= new double[dim]; Arrays.fill(t, 1.);
|
||||
// System.out.println(BeanInspector.toString(rotation.times(t)));
|
||||
rotation = Mathematics.getRotationMatrix((rotAngle * Math.PI / 180.), dim).transpose();
|
||||
return rotation;
|
||||
}
|
||||
|
||||
@ -331,9 +305,9 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
*/
|
||||
public void setNoise(double noise) {
|
||||
if (noise < 0) {
|
||||
noise = 0;
|
||||
}
|
||||
this.m_Noise = noise;
|
||||
noise = 0;
|
||||
}
|
||||
this.noise = noise;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -342,7 +316,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @return the current noise level
|
||||
*/
|
||||
public double getNoise() {
|
||||
return this.m_Noise;
|
||||
return this.noise;
|
||||
}
|
||||
|
||||
public String noiseTipText() {
|
||||
@ -356,7 +330,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeDouble indy) {
|
||||
this.m_Template = (AbstractEAIndividual) indy;
|
||||
this.template = (AbstractEAIndividual) indy;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,7 +340,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
*/
|
||||
@Override
|
||||
public InterfaceDataTypeDouble getEAIndividual() {
|
||||
return (InterfaceDataTypeDouble) this.m_Template;
|
||||
return (InterfaceDataTypeDouble) this.template;
|
||||
}
|
||||
|
||||
public String EAIndividualTipText() {
|
||||
@ -379,7 +353,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @return value of the absolute range limit
|
||||
*/
|
||||
public double getDefaultRange() {
|
||||
return m_DefaultRange;
|
||||
return defaultRange;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -388,7 +362,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
* @param defaultRange
|
||||
*/
|
||||
public void setDefaultRange(double defaultRange) {
|
||||
this.m_DefaultRange = defaultRange;
|
||||
this.defaultRange = defaultRange;
|
||||
initTemplate();
|
||||
}
|
||||
|
||||
@ -556,7 +530,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
sb.append("Dimension : ");
|
||||
sb.append(this.getProblemDimension());
|
||||
sb.append("\nNoise level : ");
|
||||
sb.append(this.m_Noise);
|
||||
sb.append(this.noise);
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@ -664,7 +638,7 @@ public abstract class AbstractProblemDouble extends AbstractOptimizationProblem
|
||||
if (!isShowing && showP) {
|
||||
TopoPlot plot = new TopoPlot(getName(), "x1", "x2");
|
||||
plot.setParams(60, 60, ColorBarCalculator.BLUE_TO_RED);
|
||||
this.initProblem();
|
||||
this.initializeProblem();
|
||||
plot.setTopology(this, makeRange(), true);
|
||||
if (this instanceof InterfaceMultimodalProblemKnown
|
||||
&& ((InterfaceMultimodalProblemKnown) this)
|
||||
|
@ -9,11 +9,9 @@ package eva2.optimization.problems;
|
||||
*/
|
||||
public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble implements Interface2DBorderProblem {
|
||||
|
||||
// protected AbstractEAIndividual m_OverallBest = null;
|
||||
protected int m_ProblemDimension = 10;
|
||||
protected double m_XOffset = 0.0; // TODO make them private, implement eval() and create abstract evalWithoutOffsets
|
||||
protected double m_YOffset = 0.0;
|
||||
// protected boolean m_UseTestConstraint = false;
|
||||
protected int problemDimension = 10;
|
||||
protected double xOffset = 0.0; // TODO make them private, implement eval() and create abstract evalWithoutOffsets
|
||||
protected double yOffset = 0.0;
|
||||
|
||||
public AbstractProblemDoubleOffset() {
|
||||
super();
|
||||
@ -23,10 +21,9 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
|
||||
public AbstractProblemDoubleOffset(AbstractProblemDoubleOffset b) {
|
||||
super();
|
||||
super.cloneObjects(b);
|
||||
this.m_ProblemDimension = b.m_ProblemDimension;
|
||||
this.m_XOffset = b.m_XOffset;
|
||||
this.m_YOffset = b.m_YOffset;
|
||||
// this.m_UseTestConstraint = b.m_UseTestConstraint;
|
||||
this.problemDimension = b.problemDimension;
|
||||
this.xOffset = b.xOffset;
|
||||
this.yOffset = b.yOffset;
|
||||
}
|
||||
|
||||
public AbstractProblemDoubleOffset(int dim) {
|
||||
@ -55,10 +52,10 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
|
||||
* @param XOffset The offset for the decision variables.
|
||||
*/
|
||||
public void setXOffset(double XOffset) {
|
||||
this.m_XOffset = XOffset;
|
||||
this.xOffset = XOffset;
|
||||
}
|
||||
public double getXOffset() {
|
||||
return this.m_XOffset;
|
||||
return this.xOffset;
|
||||
}
|
||||
public String XOffsetTipText() {
|
||||
return "Choose an offset for the decision variables.";
|
||||
@ -69,10 +66,10 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
|
||||
* @param YOffset The offset for the objective value.
|
||||
*/
|
||||
public void setYOffset(double YOffset) {
|
||||
this.m_YOffset = YOffset;
|
||||
this.yOffset = YOffset;
|
||||
}
|
||||
public double getYOffset() {
|
||||
return this.m_YOffset;
|
||||
return this.yOffset;
|
||||
}
|
||||
public String YOffsetTipText() {
|
||||
return "Choose an offset for the objective value.";
|
||||
@ -81,11 +78,11 @@ public abstract class AbstractProblemDoubleOffset extends AbstractProblemDouble
|
||||
* @param t Length of the x vector at is to be optimized
|
||||
*/
|
||||
public void setProblemDimension(int t) {
|
||||
this.m_ProblemDimension = t;
|
||||
this.problemDimension = t;
|
||||
}
|
||||
@Override
|
||||
public int getProblemDimension() {
|
||||
return this.m_ProblemDimension;
|
||||
return this.problemDimension;
|
||||
}
|
||||
public String problemDimensionTipText() {
|
||||
return "Length of the x vector to be optimized.";
|
||||
|
@ -20,17 +20,17 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
protected void initTemplate() {
|
||||
if (m_Template==null) {
|
||||
m_Template = new GIIndividualIntegerData();
|
||||
if (template ==null) {
|
||||
template = new GIIndividualIntegerData();
|
||||
}
|
||||
if (((InterfaceDataTypeInteger)this.m_Template).size()!=this.getProblemDimension()) {
|
||||
((InterfaceDataTypeInteger)this.m_Template).setIntegerDataLength(this.getProblemDimension());
|
||||
if (((InterfaceDataTypeInteger)this.template).size()!=this.getProblemDimension()) {
|
||||
((InterfaceDataTypeInteger)this.template).setIntegerDataLength(this.getProblemDimension());
|
||||
}
|
||||
}
|
||||
|
||||
public void cloneObjects(AbstractProblemInteger o) {
|
||||
if (o.m_Template != null) {
|
||||
m_Template = (AbstractEAIndividual)o.m_Template.clone();
|
||||
if (o.template != null) {
|
||||
template = (AbstractEAIndividual)o.template.clone();
|
||||
}
|
||||
if (o.m_OverallBest != null) {
|
||||
m_OverallBest = (AbstractEAIndividual)((AbstractEAIndividual)o.m_OverallBest).clone();
|
||||
@ -39,16 +39,16 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
initTemplate();
|
||||
this.m_OverallBest = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
this.m_OverallBest = null;
|
||||
((InterfaceDataTypeInteger)this.m_Template).setIntegerDataLength(this.m_ProblemDimension);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
((InterfaceDataTypeInteger)this.template).setIntegerDataLength(this.m_ProblemDimension);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -125,6 +125,6 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setIndividualTemplate(AbstractEAIndividual indy) {
|
||||
this.m_Template = (AbstractEAIndividual)indy;
|
||||
this.template = (AbstractEAIndividual)indy;
|
||||
}
|
||||
}
|
@ -45,8 +45,8 @@ public abstract class AbstractSynchronousOptimizationProblem extends
|
||||
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
evalsSinceChange = 0.;
|
||||
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
|
||||
result += "Parameters:\n";
|
||||
result += "Number of Bits: " + this.m_ProblemDimension +"\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -129,10 +129,10 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeBinary indy) {
|
||||
this.m_Template = (AbstractEAIndividual) indy;
|
||||
this.template = (AbstractEAIndividual) indy;
|
||||
}
|
||||
public InterfaceDataTypeBinary getEAIndividual() {
|
||||
return (InterfaceDataTypeBinary) this.m_Template;
|
||||
return (InterfaceDataTypeBinary) this.template;
|
||||
}
|
||||
public String EAIndividualTipText() {
|
||||
return "Choose the EAIndividual to use.";
|
||||
|
@ -154,7 +154,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
|
||||
/** This method inits the Problem to log multiruns
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
// nothing to init here
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
|
||||
result.append(this.m_Punish);
|
||||
result.append("\n");
|
||||
result.append("Solution representation:\n");
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@ -380,10 +380,10 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeBinary indy) {
|
||||
this.m_Template = (AbstractEAIndividual) indy;
|
||||
this.template = (AbstractEAIndividual) indy;
|
||||
}
|
||||
public InterfaceDataTypeBinary getEAIndividual() {
|
||||
return (InterfaceDataTypeBinary) this.m_Template;
|
||||
return (InterfaceDataTypeBinary) this.template;
|
||||
}
|
||||
public String EAIndividualTipText() {
|
||||
return "Choose the EA-individual to use.";
|
||||
|
@ -29,8 +29,8 @@ public class ConstrHimmelblauProblem extends AbstractProblemDouble implements Se
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void initProblem() {
|
||||
// super.initProblem();
|
||||
// public void initializeProblem() {
|
||||
// super.initializeProblem();
|
||||
// setConstraints(new AbstractConstraint[]{new ConstraintCollection(makeDefaultConstraints())});
|
||||
// }
|
||||
|
||||
|
@ -120,8 +120,8 @@ public class DynJumpProblem extends AbstractDynTransProblem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
translation = new double[getProblemDimension()];
|
||||
evalsSinceChange = 0.0;
|
||||
evaluations = 0.0;
|
||||
|
@ -74,15 +74,15 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan
|
||||
}
|
||||
|
||||
public ExternalRuntimeProblem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
((ESIndividualDoubleData)this.m_Template).setDoubleDataLength(m_ProblemDimension);
|
||||
((ESIndividualDoubleData)this.m_Template).SetDoubleRange(makeRange());
|
||||
this.template = new ESIndividualDoubleData();
|
||||
((ESIndividualDoubleData)this.template).setDoubleDataLength(m_ProblemDimension);
|
||||
((ESIndividualDoubleData)this.template).SetDoubleRange(makeRange());
|
||||
}
|
||||
|
||||
public ExternalRuntimeProblem(ExternalRuntimeProblem b) {
|
||||
//AbstractOptimizationProblem
|
||||
if (b.m_Template != null) {
|
||||
this.m_Template = (AbstractEAIndividual)((AbstractEAIndividual)b.m_Template).clone();
|
||||
if (b.template != null) {
|
||||
this.template = (AbstractEAIndividual)((AbstractEAIndividual)b.template).clone();
|
||||
}
|
||||
//ExternalRuntimeProblem
|
||||
if (b.m_OverallBest != null) {
|
||||
@ -122,7 +122,7 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan
|
||||
/** This method inits the Problem to log multiruns
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
this.m_OverallBest = null;
|
||||
File f = new File(m_Command);
|
||||
if (f.exists()) {
|
||||
@ -149,13 +149,13 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
this.m_OverallBest = null;
|
||||
|
||||
((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(makeRange());
|
||||
((InterfaceDataTypeDouble)this.template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.template).SetDoubleRange(makeRange());
|
||||
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -440,11 +440,11 @@ implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRan
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeDouble indy) {
|
||||
this.m_Template = (AbstractEAIndividual)indy;
|
||||
this.template = (AbstractEAIndividual)indy;
|
||||
}
|
||||
@Override
|
||||
public InterfaceDataTypeDouble getEAIndividual() {
|
||||
return (InterfaceDataTypeDouble)this.m_Template;
|
||||
return (InterfaceDataTypeDouble)this.template;
|
||||
}
|
||||
@Override
|
||||
public double functionValue(double[] point) {
|
||||
|
@ -16,7 +16,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
private int m_Iterations = 20;
|
||||
|
||||
public F10Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F10Problem(F10Problem b) {
|
||||
super(b);
|
||||
@ -42,9 +42,9 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
double c1 = this.calculateC(1);
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
double xi = x[i]-m_XOffset;
|
||||
double xi = x[i]- xOffset;
|
||||
result[0] += ((this.calculateC(xi))/(c1 * Math.pow(Math.abs(xi),2-this.m_D))) + Math.pow(xi, 2) -1;
|
||||
}
|
||||
return result;
|
||||
@ -68,10 +68,10 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
|
||||
result += "F10 Weierstrass-Mandelbrot Fractal Function:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
private double m_D = 4000;
|
||||
|
||||
public F11Problem() {
|
||||
this.m_ProblemDimension = 10;
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.problemDimension = 10;
|
||||
this.template = new ESIndividualDoubleData();
|
||||
setDefaultRange(600);
|
||||
}
|
||||
|
||||
@ -42,11 +42,11 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
double[] result = new double[1];
|
||||
double tmpProd = 1;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
double xi = x[i]-m_XOffset;
|
||||
double xi = x[i]- xOffset;
|
||||
result[0] += Math.pow(xi, 2);
|
||||
tmpProd *= Math.cos((xi)/Math.sqrt(i+1));
|
||||
}
|
||||
result[0] = ((result[0]/this.m_D) - tmpProd + 1)+m_YOffset;
|
||||
result[0] = ((result[0]/this.m_D) - tmpProd + 1)+ yOffset;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -58,10 +58,10 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
|
||||
result += "F11 Griewank Function:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
// result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa
|
||||
double[] result = new double[1];
|
||||
double tmp = 0;//-5;
|
||||
for (int i = 1; i < x.length-1; i++) {
|
||||
tmp += Math.pow(x[i]-m_XOffset, 2);
|
||||
tmp += Math.pow(x[i]- xOffset, 2);
|
||||
}
|
||||
double x0 = x[0]-m_XOffset;
|
||||
result[0] = m_YOffset+((Math.exp(-5*x0*x0)+2*Math.exp(-5*Math.pow(1-x0, 2)))*Math.exp(-5*tmp));
|
||||
double x0 = x[0]- xOffset;
|
||||
result[0] = yOffset +((Math.exp(-5*x0*x0)+2*Math.exp(-5*Math.pow(1-x0, 2)))*Math.exp(-5*tmp));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -52,10 +52,10 @@ public class F12Problem extends AbstractProblemDoubleOffset implements Serializa
|
||||
|
||||
result += "F12 Galar:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ import eva2.optimization.operators.postprocess.SolutionHistogram;
|
||||
public class F13Problem extends AbstractProblemDoubleOffset implements InterfaceMultimodalProblem, InterfaceInterestingHistogram {
|
||||
|
||||
public F13Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
setDefaultRange(500);
|
||||
}
|
||||
public F13Problem(F13Problem b) {
|
||||
@ -54,13 +54,13 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
|
||||
for (int i=0; i<x.length; i++) {
|
||||
double xi = (x[i]-m_XOffset);
|
||||
double xi = (x[i]- xOffset);
|
||||
result[0] -= xi*Math.sin(Math.sqrt(Math.abs(xi)));
|
||||
}
|
||||
result[0] += (418.9829 * m_ProblemDimension);
|
||||
result[0] += (418.9829 * problemDimension);
|
||||
// res = cn-sum_i(xi*sin(sqrt(abs(xi))))
|
||||
return result;
|
||||
}
|
||||
@ -73,10 +73,10 @@ public class F13Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
|
||||
result += "F13 Schwefel:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
double rotationDX = 2;
|
||||
|
||||
public F14Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.m_ProblemDimension = 2;
|
||||
this.template = new ESIndividualDoubleData();
|
||||
this.problemDimension = 2;
|
||||
}
|
||||
|
||||
public F14Problem(F14Problem b) {
|
||||
@ -34,8 +34,8 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
@Override
|
||||
public double[] eval(double[] x) {
|
||||
double[] result = new double[1];
|
||||
double x0 = x[0]-rotationDX-m_XOffset;
|
||||
double x1 = x[1]-rotationDX-m_XOffset;
|
||||
double x0 = x[0]-rotationDX- xOffset;
|
||||
double x1 = x[1]-rotationDX- xOffset;
|
||||
if (rotation != 0.) {
|
||||
double cosw = Math.cos(rotation);
|
||||
double sinw = Math.sin(rotation);
|
||||
@ -45,7 +45,7 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
x0=tmpx0;
|
||||
}
|
||||
//matlab: 40 + (- exp(cos(5*X)+cos(3*Y)) .* exp(-X.^2) .* (-.05*Y.^2+5));
|
||||
result[0] = m_YOffset+36.9452804947;//36.945280494653247;
|
||||
result[0] = yOffset +36.9452804947;//36.945280494653247;
|
||||
result[0] += (-Math.exp(Math.cos(3*x0)+Math.cos(6*x1)) * Math.exp(-x0*x0/10) * (-.05*x1*x1+5));
|
||||
|
||||
return result;
|
||||
@ -71,7 +71,7 @@ public class F14Problem extends AbstractProblemDoubleOffset implements Interface
|
||||
|
||||
result += "F14 function:\n";
|
||||
result += "Several local minima in linear order which may be rotated.\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
|
||||
public class F15Problem extends AbstractProblemDouble implements Serializable, InterfaceInterestingHistogram {
|
||||
private int dim=10;
|
||||
private int problemDimension =10;
|
||||
|
||||
public F15Problem() {
|
||||
super();
|
||||
@ -24,7 +24,7 @@ public class F15Problem extends AbstractProblemDouble implements Serializable, I
|
||||
|
||||
public F15Problem(F15Problem o) {
|
||||
super(o);
|
||||
dim=o.getProblemDimension();
|
||||
problemDimension =o.getProblemDimension();
|
||||
setDefaultRange(o.getDefaultRange());
|
||||
}
|
||||
|
||||
@ -41,17 +41,17 @@ public class F15Problem extends AbstractProblemDouble implements Serializable, I
|
||||
|
||||
s=Math.sin(Math.PI*x[0]);
|
||||
double[] y = new double[1];
|
||||
y[0] = 10.*s*s+sum+dim*(x[dim-1]-1)*(x[dim-1]-1);
|
||||
y[0] = 10.*s*s+sum+ problemDimension *(x[problemDimension -1]-1)*(x[problemDimension -1]-1);
|
||||
return y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProblemDimension() {
|
||||
return dim;
|
||||
return problemDimension;
|
||||
}
|
||||
|
||||
public void setProblemDimension(int d) {
|
||||
dim=d;
|
||||
problemDimension = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -62,14 +62,14 @@ public class F15Problem extends AbstractProblemDouble implements Serializable, I
|
||||
@Override
|
||||
public SolutionHistogram getHistogram() {
|
||||
if (getProblemDimension()<15) {
|
||||
return new SolutionHistogram(0, 2, 16);
|
||||
}
|
||||
else if (getProblemDimension()<25) {
|
||||
return new SolutionHistogram(0, 4, 16);
|
||||
}
|
||||
else {
|
||||
return new SolutionHistogram(0, 8, 16);
|
||||
}
|
||||
return new SolutionHistogram(0, 2, 16);
|
||||
}
|
||||
else if (getProblemDimension()<25) {
|
||||
return new SolutionHistogram(0, 4, 16);
|
||||
}
|
||||
else {
|
||||
return new SolutionHistogram(0, 8, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,6 +73,5 @@ public class F16Problem extends AbstractProblemDouble implements InterfaceMultim
|
||||
@Override
|
||||
public SolutionHistogram getHistogram() {
|
||||
return new SolutionHistogram(-0.001, 0.599, 15);
|
||||
// return new SolutionHistogram(-0.001, 0.099, 5);
|
||||
}
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ InterfaceMultimodalProblem, InterfaceInterestingHistogram, InterfaceFirstOrderDe
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
// if (alphas==null) {
|
||||
// create static random data
|
||||
Random rand = new Random(randSeed);
|
||||
|
@ -4,11 +4,7 @@ import eva2.optimization.strategies.InterfaceOptimizer;
|
||||
import eva2.tools.math.Mathematics;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: streiche
|
||||
* Date: 24.03.2003
|
||||
* Time: 17:58:55
|
||||
* To change this template use Options | File Templates.
|
||||
* F1 Sphere Problem
|
||||
*/
|
||||
public class F1Problem extends AbstractProblemDoubleOffset implements Interface2DBorderProblem, InterfaceHasInitRange, java.io.Serializable, InterfaceFirstOrderDerivableProblem {
|
||||
private double initialRangeRatio=1.; // reduce to initialize in a smaller subrange of the original range (in the corner box)
|
||||
@ -32,15 +28,17 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
setDefaultRange(defRange);
|
||||
}
|
||||
|
||||
/** This method returns a deep clone of the problem.
|
||||
/**
|
||||
* This method returns a deep clone of the problem.
|
||||
* @return the clone
|
||||
*/
|
||||
@Override
|
||||
public Object clone() {
|
||||
return (Object) new F1Problem(this);
|
||||
return new F1Problem(this);
|
||||
}
|
||||
|
||||
/** Ths method allows you to evaluate a simple bit string to determine the fitness
|
||||
/**
|
||||
* This method allows you to evaluate a simple bit string to determine the fitness
|
||||
* @param x The n-dimensional input vector
|
||||
* @return The m-dimensional output vector.
|
||||
*/
|
||||
@ -48,15 +46,16 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
// add an offset in solution space
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
result[0] += Math.pow(x[i] - this.m_XOffset, 2);
|
||||
result[0] += Math.pow(x[i] - this.xOffset, 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** This method returns a string describing the optimization problem.
|
||||
/**
|
||||
* This method returns a string describing the optimization problem.
|
||||
* @param opt The Optimizer that is used or had been used.
|
||||
* @return The description.
|
||||
*/
|
||||
@ -66,17 +65,16 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
sb.append("F1 Sphere model:\n");
|
||||
sb.append("Here the individual codes a vector of real number x and F1(x)= x^2 is to be minimized.\nParameters:\n");
|
||||
sb.append("Dimension : ");
|
||||
sb.append(this.m_ProblemDimension);
|
||||
sb.append(this.problemDimension);
|
||||
sb.append("\nNoise level : ");
|
||||
sb.append(this.getNoise());
|
||||
// sb.append("\nSolution representation:\n");
|
||||
// sb.append(this.m_Template.getSolutionRepresentationFor());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**********************************************************************************************************************
|
||||
* These are for GUI
|
||||
*/
|
||||
/**
|
||||
* These are for GUI
|
||||
*/
|
||||
|
||||
/** This method allows the CommonJavaObjectEditorPanel to read the
|
||||
* name to the current object.
|
||||
* @return The name.
|
||||
@ -99,7 +97,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
// first order partial derivation in direction x_i is 2*x_i
|
||||
double[] grads=new double[x.length];
|
||||
for (int i=0; i<x.length; i++) {
|
||||
grads[i]=(2.*(x[i] - this.m_XOffset));
|
||||
grads[i]=(2.*(x[i] - this.xOffset));
|
||||
}
|
||||
return grads;
|
||||
}
|
||||
@ -112,17 +110,15 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
if (initialRangeRatio<1.) {
|
||||
double[][] gR=makeRange();
|
||||
double[][] initR = makeRange();
|
||||
// double[] rng = Mathematics.shiftRange(initR);
|
||||
Mathematics.scaleRange(initialRangeRatio, initR);
|
||||
for (int i=0; i<getProblemDimension(); i++) {
|
||||
double d=gR[i][0]-initR[i][0];
|
||||
initR[i][0]+=d; // shift back by original offsets
|
||||
initR[i][1]+=d;
|
||||
}
|
||||
// System.out.println(BeanInspector.toString(initR));
|
||||
return initR;
|
||||
} else {
|
||||
return makeRange();
|
||||
}
|
||||
return makeRange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,6 @@ import java.io.Serializable;
|
||||
* with g(x,y) = x sin(a)cos(b)+(y+1)cos(a)sin(b), a=sqrt(|-x+y+1|), b=sqrt(|x+y+1|).
|
||||
*
|
||||
* For gnuplot: x *sin(sqrt(abs(-x+y+1)))*cos(sqrt(abs(x+y+1)))+(y+1)*cos(sqrt(abs(-x+y+1)))*sin(sqrt(abs(x+y+1)))
|
||||
*
|
||||
* @author mkron
|
||||
*
|
||||
*/
|
||||
public class F20Problem extends AbstractProblemDouble implements Serializable, InterfaceInterestingHistogram{
|
||||
@ -58,11 +56,7 @@ public class F20Problem extends AbstractProblemDouble implements Serializable, I
|
||||
double b=beta(x,y);
|
||||
return x*Math.sin(a)*Math.cos(b)+(y+1.)*Math.cos(a)*Math.sin(b);
|
||||
}
|
||||
|
||||
// private double alpha(double x, double y) {
|
||||
// return Math.sqrt(Math.abs(-x+y+1));
|
||||
// }
|
||||
|
||||
|
||||
private double beta(double x, double y) {
|
||||
return Math.sqrt(Math.abs(x+y+1));
|
||||
}
|
||||
@ -112,21 +106,21 @@ public class F20Problem extends AbstractProblemDouble implements Serializable, I
|
||||
}
|
||||
}
|
||||
if (getProblemDimension()==30) {
|
||||
if (getYOffset()==0) {
|
||||
return new SolutionHistogram(-15000, -8600, 16);
|
||||
}
|
||||
// das passst wohl nicht für Multimodales... Also nochmal für 30D.
|
||||
else {
|
||||
return new SolutionHistogram(0, 6400, 16);
|
||||
}
|
||||
}
|
||||
if (getProblemDimension() <= 5) {
|
||||
double lower = getYOffset()-((getProblemDimension()-1)*getDefaultRange());
|
||||
return new SolutionHistogram(lower, lower+160, 16);
|
||||
} else if (getProblemDimension() < 15) {
|
||||
return new SolutionHistogram(getYOffset()-5000, getYOffset()-3400, 16);
|
||||
} else {
|
||||
return new SolutionHistogram(getYOffset()-15000, getYOffset()-13400, 16);
|
||||
if (getYOffset() == 0) {
|
||||
return new SolutionHistogram(-15000, -8600, 16);
|
||||
}
|
||||
}
|
||||
// das passst wohl nicht für Multimodales... Also nochmal für 30D.
|
||||
else {
|
||||
return new SolutionHistogram(0, 6400, 16);
|
||||
}
|
||||
}
|
||||
if (getProblemDimension() <= 5) {
|
||||
double lower = getYOffset() - ((getProblemDimension() - 1) * getDefaultRange());
|
||||
return new SolutionHistogram(lower, lower + 160, 16);
|
||||
} else if (getProblemDimension() < 15) {
|
||||
return new SolutionHistogram(getYOffset() - 5000, getYOffset() - 3400, 16);
|
||||
} else {
|
||||
return new SolutionHistogram(getYOffset() - 15000, getYOffset() - 13400, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,8 +44,8 @@ public class F21Problem extends AbstractProblemDouble implements InterfaceMultim
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
Random rnd = new Random(rndSeed);
|
||||
heights=new double[getProblemDimension()];
|
||||
peaks=new double[getProblemDimension()][];
|
||||
|
@ -17,7 +17,7 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
|
||||
|
||||
|
||||
public F2Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F2Problem(F2Problem b) {
|
||||
super(b);
|
||||
@ -42,14 +42,14 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
double xi, xii;
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
xi=x[i]-m_XOffset;
|
||||
xii=x[i+1]-m_XOffset;
|
||||
xi=x[i]- xOffset;
|
||||
xii=x[i+1]- xOffset;
|
||||
result[0] += (100*(xii-xi*xi)*(xii-xi*xi)+(xi-1)*(xi-1));
|
||||
}
|
||||
if (m_YOffset==0 && (result[0]<=0)) {
|
||||
if (yOffset ==0 && (result[0]<=0)) {
|
||||
result[0]=Math.sqrt(Double.MIN_VALUE);
|
||||
} // guard for plots in log scale
|
||||
return result;
|
||||
@ -63,8 +63,8 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
|
||||
double xi, xii;
|
||||
|
||||
for (int i = 0; i < dim-1; i++) {
|
||||
xi=x[i]-m_XOffset;
|
||||
xii=x[i+1]-m_XOffset;
|
||||
xi=x[i]- xOffset;
|
||||
xii=x[i+1]- xOffset;
|
||||
|
||||
result[i] += 400*xi*(xi*xi-xii) + 2*xi-2;
|
||||
result[i+1] += -200 * (xi*xi - xii);
|
||||
@ -81,10 +81,10 @@ public class F2Problem extends AbstractProblemDoubleOffset implements InterfaceL
|
||||
result += "F2 Generalized Rosenbrock function:\n";
|
||||
result += "This problem has a deceptive optimum at (0,0,..), the true optimum is at (1,1,1,..).\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import eva2.optimization.individuals.ESIndividualDoubleData;
|
||||
public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Serializable {
|
||||
|
||||
public F3Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F3Problem(F3Problem b) {
|
||||
super(b);
|
||||
@ -34,9 +34,9 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset+6*x.length;
|
||||
result[0] = yOffset +6*x.length;
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
result[0] += Math.floor(x[i]- this.m_XOffset);
|
||||
result[0] += Math.floor(x[i]- this.xOffset);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -50,10 +50,10 @@ public class F3Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
result += "F3 Step function:\n";
|
||||
result += "This problem is discontinuos.\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,9 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
result[0] += (i+1)*Math.pow((x[i]-m_XOffset), 4);
|
||||
result[0] += (i+1)*Math.pow((x[i]- xOffset), 4);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -51,10 +51,10 @@ public class F4Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
result += "F4 Quadratic Function with noise:\n";
|
||||
result += "This problem is noisey.\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
double tmp;
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
tmp = 0;
|
||||
for (int j = 0; j <= i; j++) {
|
||||
tmp += x[j]-m_XOffset;
|
||||
tmp += x[j]- xOffset;
|
||||
}
|
||||
result[0] += Math.pow(tmp, 2);
|
||||
}
|
||||
@ -56,10 +56,10 @@ public class F5Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
result += "F5 Schwefel's Function:\n";
|
||||
result += "This problem is unimodal.\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
|
||||
private transient GradientDescentAlgorithm localSearchOptimizer=null;
|
||||
|
||||
public F6Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F6Problem(F6Problem b) {
|
||||
super(b);
|
||||
@ -45,9 +45,9 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = x.length * this.m_A + m_YOffset;
|
||||
result[0] = x.length * this.m_A + yOffset;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
double xi = x[i]-m_XOffset;
|
||||
double xi = x[i]- xOffset;
|
||||
result[0] += Math.pow(xi, 2) - this.m_A * Math.cos(this.m_Omega*xi);
|
||||
}
|
||||
return result;
|
||||
@ -59,7 +59,7 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
|
||||
double[] result = new double[x.length];
|
||||
for (int j=0; j<x.length; j++) {
|
||||
result[j]=0;
|
||||
double xj = x[j]-m_XOffset;
|
||||
double xj = x[j]- xOffset;
|
||||
result[j] += 2*xj + this.m_Omega * this.m_A * Math.sin(this.m_Omega*xj);
|
||||
}
|
||||
return result;
|
||||
@ -73,10 +73,10 @@ implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, Inte
|
||||
|
||||
result += "F6 Generalized Rastrigin's Function:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
tag[0] = new Tag(0, "Function Calls");
|
||||
tag[1] = new Tag(1, "Generation");
|
||||
this.m_TimeIntervalType = new SelectedTag(0, tag);
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F7Problem(F7Problem b) {
|
||||
super(b);
|
||||
@ -74,14 +74,14 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
if ((Math.floor(this.m_CurrentTimeStamp / this.m_t)%2) == 0) {
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
result[0] += Math.pow(x[i]-m_XOffset, 2);
|
||||
result[0] += Math.pow(x[i]- xOffset, 2);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < x.length-1; i++) {
|
||||
result[0] += Math.pow(x[i]-m_XOffset-this.m_Change, 2);
|
||||
result[0] += Math.pow(x[i]- xOffset -this.m_Change, 2);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -95,10 +95,10 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
|
||||
|
||||
result += "F7 Sphere Model, changing Environemt:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -64,13 +64,13 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
double sum1 = 0, sum2 = 0, exp1, exp2;
|
||||
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
double xi = x[i]-m_XOffset;
|
||||
double xi = x[i]- xOffset;
|
||||
sum1 += (xi)*(xi);
|
||||
sum2 += Math.cos(c * (xi));
|
||||
}
|
||||
exp1 = -b*Math.sqrt(sum1/(double)this.m_ProblemDimension);
|
||||
exp2 = sum2/(double)this.m_ProblemDimension;
|
||||
result[0] = m_YOffset + a + Math.E - a * Math.exp(exp1)- Math.exp(exp2);
|
||||
exp1 = -b*Math.sqrt(sum1/(double)this.problemDimension);
|
||||
exp2 = sum2/(double)this.problemDimension;
|
||||
result[0] = yOffset + a + Math.E - a * Math.exp(exp1)- Math.exp(exp2);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -84,17 +84,17 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
result += "F8 Ackley's function.\n";
|
||||
result += "This problem is multimodal.\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
super.initProblem();
|
||||
public void initializeProblem() {
|
||||
super.initializeProblem();
|
||||
initListOfOptima();
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
// double sum1=0, sum2=0;
|
||||
// double[] derivs = new double[x.length];
|
||||
// x = rotateMaybe(x);
|
||||
// double dim = (double)this.m_ProblemDimension;
|
||||
// double dim = (double)this.problemDimension;
|
||||
//
|
||||
// for (int i = 0; i < x.length; i++) {
|
||||
// double xi = x[i]-m_XOffSet;
|
||||
@ -174,7 +174,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
public String[] getAdditionalDataHeader() {
|
||||
String[] superHd = super.getAdditionalDataHeader();
|
||||
return ToolBox.appendArrays(new String[]{"numOptimaFound","maxPeakRatio"}, superHd);
|
||||
// return "#Optima found \tMaximum Peak Ratio \t" + super.getAdditionalDataHeader(pop);
|
||||
// return "#Optima found \tMaximum Peak Ratio \t" + super.getAdditionalDataHeader(population);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -227,9 +227,9 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
addOptimum(pos);
|
||||
}
|
||||
} }
|
||||
// System.out.println("Inited " + m_ListOfOptima.size() + " optima, measures: " + BeanInspector.toString(m_ListOfOptima.getPopulationMeasures(new PhenotypeMetric())));
|
||||
// System.out.println("Inited " + m_ListOfOptima.size() + " optima, measures: " + BeanInspector.toString(m_ListOfOptima.getPopulationMeasures(new EuclideanMetric())));
|
||||
// System.out.println(m_ListOfOptima.getStringRepresentation());
|
||||
// System.out.println("Inited " + listOfOptima.size() + " optima, measures: " + BeanInspector.toString(listOfOptima.getPopulationMeasures(new PhenotypeMetric())));
|
||||
// System.out.println("Inited " + listOfOptima.size() + " optima, measures: " + BeanInspector.toString(listOfOptima.getPopulationMeasures(new EuclideanMetric())));
|
||||
// System.out.println(listOfOptima.getStringRepresentation());
|
||||
state_initializing_optima=false;
|
||||
}
|
||||
}
|
||||
@ -279,14 +279,14 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// if (m_ListOfOptima.isEmpty()) return true;
|
||||
// if (listOfOptima.isEmpty()) return true;
|
||||
// else {
|
||||
// // test for correctness of the second optimum - if its gradient is nonzero, reinit optima
|
||||
// AbstractEAIndividual testIndy = m_ListOfOptima.getEAIndividual(1);
|
||||
// AbstractEAIndividual testIndy = listOfOptima.getEAIndividual(1);
|
||||
// double grad[] = this.getFirstOrderGradients(testIndy.getDoublePosition());
|
||||
// for (int i=0; i<grad.length; i++) {
|
||||
// if (Math.abs(grad[i])>1e-20) {
|
||||
// m_ListOfOptima.clear();
|
||||
// listOfOptima.clear();
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
@ -300,14 +300,14 @@ public class F8Problem extends AbstractProblemDoubleOffset
|
||||
}
|
||||
|
||||
// private double[] refineSolution(double[] pos) {
|
||||
// Population pop = new Population();
|
||||
// Population population = new Population();
|
||||
// InterfaceDataTypeDouble tmpIndy;
|
||||
// tmpIndy = (InterfaceDataTypeDouble)((AbstractEAIndividual)this.m_Template).clone();
|
||||
// tmpIndy = (InterfaceDataTypeDouble)((AbstractEAIndividual)this.template).clone();
|
||||
// tmpIndy.SetDoubleGenotype(pos);
|
||||
// ((AbstractEAIndividual)tmpIndy).SetFitness(eval(pos));
|
||||
// pop.add(tmpIndy);
|
||||
// population.add(tmpIndy);
|
||||
// FitnessConvergenceTerminator convTerm = new FitnessConvergenceTerminator(1e-15, 10, false, true);
|
||||
// int calls = PostProcess.processWithGDA(pop, this, convTerm, 0, 0.0000000000000001, 0.01);
|
||||
// return ((InterfaceDataTypeDouble)pop.getBestEAIndividual()).getDoubleData();
|
||||
// int calls = PostProcess.processWithGDA(population, this, convTerm, 0, 0.0000000000000001, 0.01);
|
||||
// return ((InterfaceDataTypeDouble)population.getBestEAIndividual()).getDoubleData();
|
||||
// }
|
||||
}
|
@ -5,7 +5,7 @@ import eva2.optimization.individuals.ESIndividualDoubleData;
|
||||
public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Serializable {
|
||||
|
||||
public F9Problem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
}
|
||||
public F9Problem(F9Problem b) {
|
||||
super(b);
|
||||
@ -27,9 +27,9 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
public double[] eval(double[] x) {
|
||||
x = rotateMaybe(x);
|
||||
double[] result = new double[1];
|
||||
result[0] = m_YOffset;
|
||||
result[0] = yOffset;
|
||||
for (int i = 0; i < x.length; i++) {
|
||||
result[0] += (i+1)*Math.pow(x[i]-m_XOffset, 2);
|
||||
result[0] += (i+1)*Math.pow(x[i]- xOffset, 2);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -42,10 +42,10 @@ public class F9Problem extends AbstractProblemDoubleOffset implements java.io.Se
|
||||
|
||||
result += "F9 Weighted Sphere Model:\n";
|
||||
result += "Parameters:\n";
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Dimension : " + this.problemDimension +"\n";
|
||||
result += "Noise level : " + this.getNoise() + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
|
||||
@Override
|
||||
public void updateView(Population pop, boolean showAllIfPossible) {
|
||||
if (showAllIfPossible) {
|
||||
// indiesToPaint=pop;
|
||||
// indiesToPaint=population;
|
||||
for (int i=0; i<pop.size(); i++) {
|
||||
MyLensViewer newView=new MyLensViewer(m_LensProblem);
|
||||
|
||||
@ -231,15 +231,15 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
private boolean m_UseMaterialConst = false;
|
||||
|
||||
public FLensProblem() {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
if (this.m_Show) {
|
||||
this.initProblemFrame();
|
||||
}
|
||||
}
|
||||
public FLensProblem(FLensProblem b) {
|
||||
//AbstractOptimizationProblem
|
||||
if (b.m_Template != null) {
|
||||
this.m_Template = (AbstractEAIndividual)((AbstractEAIndividual)b.m_Template).clone();
|
||||
if (b.template != null) {
|
||||
this.template = (AbstractEAIndividual)((AbstractEAIndividual)b.template).clone();
|
||||
}
|
||||
//FLensProblem
|
||||
if (b.m_OverallBest != null) {
|
||||
@ -299,7 +299,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
/** This method inits the Problem to log multiruns
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
this.m_OverallBest = null;
|
||||
if (this.m_Show) {
|
||||
this.initProblemFrame();
|
||||
@ -310,18 +310,18 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
this.m_OverallBest = null;
|
||||
((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
// set the range
|
||||
double[][] range = new double[this.m_ProblemDimension][2];
|
||||
for (int i = 0; i < range.length; i++) {
|
||||
range[i][0] = 0.1;
|
||||
range[i][1] = 5.0;
|
||||
}
|
||||
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(range);
|
||||
((InterfaceDataTypeDouble)this.template).SetDoubleRange(range);
|
||||
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
if (this.m_Show) {
|
||||
this.initProblemFrame();
|
||||
}
|
||||
@ -384,7 +384,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
// // The fitness is the sum over all segments of the deviation from the center
|
||||
// // of focus of a beam running through a segment.
|
||||
// for (int i = 1; i < x.length; i++)
|
||||
// fitness = fitness + Math.pow(m_Radius - m_SegmentHight / 2 - m_SegmentHight * (i - 1) - m_FocalLength / m_SegmentHight * (m_Epsilon - 1) * (x[i] - x[i-1]),2);
|
||||
// fitness = fitness + Math.pow(m_Radius - m_SegmentHight / 2 - m_SegmentHight * (i - 1) - m_FocalLength / m_SegmentHight * (epsilon - 1) * (x[i] - x[i-1]),2);
|
||||
|
||||
// Here the thickness of the middle segment of the lens is added to the fitness
|
||||
// to permit the optimization to reduce the overall thickness of the lens
|
||||
@ -451,7 +451,7 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Noise level : " + this.m_Noise + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -593,10 +593,10 @@ implements InterfaceOptimizationProblem, InterfaceHasSolutionViewer, java.io.Ser
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeDouble indy) {
|
||||
this.m_Template = (AbstractEAIndividual)indy;
|
||||
this.template = (AbstractEAIndividual)indy;
|
||||
}
|
||||
public InterfaceDataTypeDouble getEAIndividual() {
|
||||
return (InterfaceDataTypeDouble)this.m_Template;
|
||||
return (InterfaceDataTypeDouble)this.template;
|
||||
}
|
||||
|
||||
/** This method allows you to set the EA individual type
|
||||
|
@ -13,10 +13,10 @@ import java.io.Serializable;
|
||||
public class FM0Problem extends AbstractMultiModalProblemKnown implements InterfaceOptimizationProblem, Interface2DBorderProblem, InterfaceMultimodalProblemKnown, Serializable {
|
||||
|
||||
public FM0Problem() {
|
||||
this.m_ProblemDimension = 2;
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.problemDimension = 2;
|
||||
this.template = new ESIndividualDoubleData();
|
||||
// this.m_Extrema = new double[2];
|
||||
// this.m_Range = new double [this.m_ProblemDimension][2];
|
||||
// this.m_Range = new double [this.problemDimension][2];
|
||||
// this.m_Range[0][0] = -2.0;
|
||||
// this.m_Range[0][1] = 2.0;
|
||||
// this.m_Range[1][0] = -2.8;
|
||||
|
@ -59,7 +59,7 @@ public class GPFunctionProblem extends AbstractProblemDouble implements Interfac
|
||||
*/
|
||||
public GPFunctionProblem(InterfaceProgram gpProb, GPArea area, int pDim, double scStart, double scLim) {
|
||||
dim = pDim;
|
||||
((ESIndividualDoubleData)m_Template).setDoubleDataLength(dim);
|
||||
((ESIndividualDoubleData) template).setDoubleDataLength(dim);
|
||||
gpProblem = gpProb;
|
||||
gpArea = area;
|
||||
scalingStart=scStart;
|
||||
@ -102,7 +102,7 @@ public class GPFunctionProblem extends AbstractProblemDouble implements Interfac
|
||||
*/
|
||||
public void setProblemDimension(int newDim) {
|
||||
dim = newDim;
|
||||
((ESIndividualDoubleData)m_Template).setDoubleDataLength(dim);
|
||||
((ESIndividualDoubleData) template).setDoubleDataLength(dim);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ public interface InterfaceOptimizationProblem extends InterfaceAdditionalPopulat
|
||||
|
||||
/** This method inits the Problem to log multiruns
|
||||
*/
|
||||
public void initProblem();
|
||||
public void initializeProblem();
|
||||
|
||||
/** This method will report whether or not this optimization problem is truly
|
||||
* multi-objective
|
||||
@ -34,7 +34,7 @@ public interface InterfaceOptimizationProblem extends InterfaceAdditionalPopulat
|
||||
/** This method inits a given population
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
public void initPopulation(Population population);
|
||||
public void initializePopulation(Population population);
|
||||
|
||||
/** This method evaluates a given population and set the fitness values
|
||||
* accordingly
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,15 +60,15 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
private boolean m_Show = false;
|
||||
|
||||
public PSymbolicRegression() {
|
||||
this.m_Template = new GPIndividualProgramData();
|
||||
this.initProblem();
|
||||
this.template = new GPIndividualProgramData();
|
||||
this.initializeProblem();
|
||||
this.compileArea();
|
||||
}
|
||||
|
||||
public PSymbolicRegression(PSymbolicRegression b) {
|
||||
//AbstractOptimizationProblem
|
||||
if (b.m_Template != null) {
|
||||
this.m_Template = (AbstractEAIndividual)((AbstractEAIndividual)b.m_Template).clone();
|
||||
if (b.template != null) {
|
||||
this.template = (AbstractEAIndividual)((AbstractEAIndividual)b.template).clone();
|
||||
}
|
||||
//F1Problem
|
||||
if (b.m_OverallBest != null) {
|
||||
@ -113,7 +113,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
/** This method inits the Problem to log multiruns
|
||||
*/
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
if (m_TargetFunction == null) {
|
||||
m_TargetFunction = new RFKoza_GPI_7_3();
|
||||
}
|
||||
@ -164,7 +164,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
initPopulation(population, this, m_UseInnerConst, m_NumberOfConstants);
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
*/
|
||||
public void setNumberOfConstants(int b) {
|
||||
this.m_NumberOfConstants = b;
|
||||
this.initProblem();
|
||||
this.initializeProblem();
|
||||
m_GPArea.clear();
|
||||
this.compileArea();
|
||||
}
|
||||
@ -472,13 +472,13 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
this.m_GPArea = i;
|
||||
GPArea tmpArea[] = new GPArea[1];
|
||||
tmpArea[0] = this.m_GPArea;
|
||||
((InterfaceDataTypeProgram)this.m_Template).setProgramDataLength(1);
|
||||
((InterfaceDataTypeProgram)this.m_Template).SetFunctionArea(tmpArea);
|
||||
((InterfaceDataTypeProgram)this.template).setProgramDataLength(1);
|
||||
((InterfaceDataTypeProgram)this.template).SetFunctionArea(tmpArea);
|
||||
}
|
||||
@Override
|
||||
public GPArea getArea() {
|
||||
if (m_GPArea==null) {
|
||||
initProblem();
|
||||
initializeProblem();
|
||||
}
|
||||
return this.m_GPArea;
|
||||
}
|
||||
@ -514,7 +514,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
}
|
||||
public InterfaceRegressionFunction getTargetFunction() {
|
||||
if (m_TargetFunction==null) {
|
||||
initProblem();
|
||||
initializeProblem();
|
||||
}
|
||||
return this.m_TargetFunction;
|
||||
}
|
||||
@ -526,10 +526,10 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setGPIndividual(InterfaceDataTypeProgram indy) {
|
||||
this.m_Template = (AbstractEAIndividual) indy;
|
||||
this.template = (AbstractEAIndividual) indy;
|
||||
}
|
||||
public InterfaceDataTypeProgram getGPIndividual() {
|
||||
return (InterfaceDataTypeProgram)this.m_Template;
|
||||
return (InterfaceDataTypeProgram)this.template;
|
||||
}
|
||||
public String GPIndividualTipText() {
|
||||
return "Modify the properties of the template GP individual such as maximum tree depth etc.";
|
||||
|
@ -104,32 +104,32 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
initTemplate();
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initProblem() {
|
||||
public void initializeProblem() {
|
||||
bestIndy = null;
|
||||
initTemplate();
|
||||
setSimpleProblem(getSimpleProblem()); // possibly create plot
|
||||
BeanInspector.callIfAvailable(simProb, "initProblem", null); // possibly call initProblem of subproblem
|
||||
BeanInspector.callIfAvailable(simProb, "initializeProblem", null); // possibly call initializeProblem of subproblem
|
||||
}
|
||||
|
||||
protected void initTemplate() {
|
||||
if (resetTemplate) {
|
||||
if (simProb instanceof SimpleProblemDouble) {
|
||||
this.m_Template = new ESIndividualDoubleData();
|
||||
this.template = new ESIndividualDoubleData();
|
||||
} else if (simProb instanceof SimpleProblemBinary) {
|
||||
this.m_Template = new GAIndividualBinaryData();
|
||||
this.template = new GAIndividualBinaryData();
|
||||
}
|
||||
}
|
||||
if (m_Template instanceof InterfaceDataTypeDouble) {
|
||||
((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(simProb.getProblemDimension());
|
||||
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(makeRange());
|
||||
} else if (m_Template instanceof InterfaceDataTypeBinary) {
|
||||
((InterfaceDataTypeBinary)this.m_Template).setBinaryDataLength(simProb.getProblemDimension());
|
||||
if (template instanceof InterfaceDataTypeDouble) {
|
||||
((InterfaceDataTypeDouble)this.template).setDoubleDataLength(simProb.getProblemDimension());
|
||||
((InterfaceDataTypeDouble)this.template).SetDoubleRange(makeRange());
|
||||
} else if (template instanceof InterfaceDataTypeBinary) {
|
||||
((InterfaceDataTypeBinary)this.template).setBinaryDataLength(simProb.getProblemDimension());
|
||||
} else {
|
||||
System.err.println("Individual type not valid!");
|
||||
}
|
||||
@ -245,7 +245,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
|
||||
public void setIndividualTemplate(AbstractEAIndividual indy) {
|
||||
resetTemplate = false;
|
||||
m_Template = indy;
|
||||
template = indy;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,8 +41,8 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
|
||||
|
||||
public TF1Problem(TF1Problem b) {
|
||||
//AbstractOptimizationProblem
|
||||
if (b.m_Template != null) {
|
||||
this.m_Template = (AbstractEAIndividual)((AbstractEAIndividual)b.m_Template).clone();
|
||||
if (b.template != null) {
|
||||
this.template = (AbstractEAIndividual)((AbstractEAIndividual)b.template).clone();
|
||||
}
|
||||
//AbstractMultiObjectiveOptimizationProblem
|
||||
if (b.m_MOSOConverter != null) {
|
||||
@ -88,15 +88,15 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
|
||||
* @param population The populations that is to be inited
|
||||
*/
|
||||
@Override
|
||||
public void initPopulation(Population population) {
|
||||
public void initializePopulation(Population population) {
|
||||
this.m_ParetoFront = new Population();
|
||||
|
||||
double[][] newRange = makeRange();
|
||||
|
||||
((InterfaceDataTypeDouble)this.m_Template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.m_Template).SetDoubleRange(newRange);
|
||||
((InterfaceDataTypeDouble)this.template).setDoubleDataLength(this.m_ProblemDimension);
|
||||
((InterfaceDataTypeDouble)this.template).SetDoubleRange(newRange);
|
||||
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, m_Template, this);
|
||||
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
|
||||
}
|
||||
|
||||
protected double[][] makeRange() {
|
||||
@ -210,7 +210,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
|
||||
result += "Dimension : " + this.m_ProblemDimension +"\n";
|
||||
result += "Noise level : " + this.m_Noise + "\n";
|
||||
result += "Solution representation:\n";
|
||||
//result += this.m_Template.getSolutionRepresentationFor();
|
||||
//result += this.template.getSolutionRepresentationFor();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -342,10 +342,10 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
|
||||
* @param indy The EAIndividual type
|
||||
*/
|
||||
public void setEAIndividual(InterfaceDataTypeDouble indy) {
|
||||
this.m_Template = (AbstractEAIndividual) indy;
|
||||
this.template = (AbstractEAIndividual) indy;
|
||||
}
|
||||
public InterfaceDataTypeDouble getEAIndividual() {
|
||||
return (InterfaceDataTypeDouble)this.m_Template;
|
||||
return (InterfaceDataTypeDouble)this.template;
|
||||
}
|
||||
|
||||
/** This method allows you to set a Multiobjective to
|
||||
|
@ -93,7 +93,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
|
||||
*/
|
||||
public ANPSO() {
|
||||
// NichePSO.stdNPSO(anpso, problem, randSeed, evalCnt);
|
||||
// NichePSO.stdNPSO((ANPSO)this, (AbstractOptimizationProblem)this.m_Problem, 0, 1000);
|
||||
// NichePSO.stdNPSO((ANPSO)this, (AbstractOptimizationProblem)this.problem, 0, 1000);
|
||||
|
||||
/////////// from NichePSO
|
||||
// super.initMainSwarm(); // not really necessary if init is called before optimization but this way init doesnt change the parameters of a newly constructed object
|
||||
@ -302,7 +302,7 @@ public class ANPSO extends NichePSO implements InterfaceOptimizer, InterfaceAddi
|
||||
//// for (int i=0; i<distances.size(); i++) {
|
||||
//// var += Math.pow(distances.get(i)-avg, 2);
|
||||
//// }
|
||||
//// System.out.println("gen " + pop.getGeneration() + " dim " + ((AbstractProblemDouble)m_Problem).getProblemDimension() +" avg " + avg + " variance " + var);
|
||||
//// System.out.println("gen " + pop.getGeneration() + " dim " + ((AbstractProblemDouble)problem).getProblemDimension() +" avg " + avg + " variance " + var);
|
||||
//// }
|
||||
// return avg;
|
||||
// }
|
||||
|
@ -244,7 +244,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
|
||||
@Override
|
||||
public void init() {
|
||||
defaultInit();
|
||||
this.problem.initPopulation(this.population);
|
||||
this.problem.initializePopulation(this.population);
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
|
@ -32,31 +32,31 @@ import java.util.BitSet;
|
||||
*/
|
||||
public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.Serializable {
|
||||
|
||||
private double m_InitialDifferenceThreshold = 0.25;
|
||||
private int m_DifferenceThreshold;
|
||||
private double m_DivergenceRate = 0.35;
|
||||
private boolean m_UseElitism = true;
|
||||
private int m_NumberOfPartners = 1;
|
||||
private Population m_Population = new Population();
|
||||
private InterfaceOptimizationProblem m_Problem = new B1Problem();
|
||||
private InterfaceSelection m_RecombSelectionOperator = new SelectRandom();
|
||||
private InterfaceSelection m_PopulSelectionOperator = new SelectBestSingle();
|
||||
transient private String m_Identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener m_Listener;
|
||||
private double initialDifferenceThreshold = 0.25;
|
||||
private int differenceThreshold;
|
||||
private double divergenceRate = 0.35;
|
||||
private boolean useElitism = true;
|
||||
private int numberOfPartners = 1;
|
||||
private Population population = new Population();
|
||||
private InterfaceOptimizationProblem optimizationProblem = new B1Problem();
|
||||
private InterfaceSelection recombSelectionOperator = new SelectRandom();
|
||||
private InterfaceSelection populationSelectionOperator = new SelectBestSingle();
|
||||
transient private String identifier = "";
|
||||
transient private InterfacePopulationChangedEventListener interfacePopulationChangedEventListener;
|
||||
|
||||
public CHCAdaptiveSearchAlgorithm() {
|
||||
}
|
||||
|
||||
public CHCAdaptiveSearchAlgorithm(CHCAdaptiveSearchAlgorithm a) {
|
||||
this.m_Population = (Population) a.m_Population.clone();
|
||||
this.m_Problem = (InterfaceOptimizationProblem) a.m_Problem.clone();
|
||||
this.m_InitialDifferenceThreshold = a.m_InitialDifferenceThreshold;
|
||||
this.m_DifferenceThreshold = a.m_DifferenceThreshold;
|
||||
this.m_DivergenceRate = a.m_DivergenceRate;
|
||||
this.m_NumberOfPartners = a.m_NumberOfPartners;
|
||||
this.m_UseElitism = a.m_UseElitism;
|
||||
this.m_RecombSelectionOperator = (InterfaceSelection) a.m_RecombSelectionOperator.clone();
|
||||
this.m_PopulSelectionOperator = (InterfaceSelection) a.m_PopulSelectionOperator.clone();
|
||||
this.population = (Population) a.population.clone();
|
||||
this.optimizationProblem = (InterfaceOptimizationProblem) a.optimizationProblem.clone();
|
||||
this.initialDifferenceThreshold = a.initialDifferenceThreshold;
|
||||
this.differenceThreshold = a.differenceThreshold;
|
||||
this.divergenceRate = a.divergenceRate;
|
||||
this.numberOfPartners = a.numberOfPartners;
|
||||
this.useElitism = a.useElitism;
|
||||
this.recombSelectionOperator = (InterfaceSelection) a.recombSelectionOperator.clone();
|
||||
this.populationSelectionOperator = (InterfaceSelection) a.populationSelectionOperator.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -66,15 +66,15 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
AbstractEAIndividual tmpIndy = ((AbstractEAIndividual) (this.m_Population.get(0)));
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
AbstractEAIndividual tmpIndy = ((AbstractEAIndividual) (this.population.get(0)));
|
||||
if (tmpIndy instanceof InterfaceGAIndividual) {
|
||||
this.m_DifferenceThreshold = (int) (((InterfaceGAIndividual) tmpIndy).getGenotypeLength() * this.m_InitialDifferenceThreshold);
|
||||
this.differenceThreshold = (int) (((InterfaceGAIndividual) tmpIndy).getGenotypeLength() * this.initialDifferenceThreshold);
|
||||
} else {
|
||||
System.out.println("Problem does not apply InterfaceGAIndividual, which is the only individual type valid for CHC!");
|
||||
}
|
||||
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
|
||||
@ -86,19 +86,19 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
*/
|
||||
@Override
|
||||
public void initByPopulation(Population pop, boolean reset) {
|
||||
this.m_Population = (Population) pop.clone();
|
||||
this.population = (Population) pop.clone();
|
||||
if (reset) {
|
||||
this.m_Population.init();
|
||||
this.population.init();
|
||||
}
|
||||
AbstractEAIndividual tmpIndy = ((AbstractEAIndividual) (this.m_Population.get(0)));
|
||||
AbstractEAIndividual tmpIndy = ((AbstractEAIndividual) (this.population.get(0)));
|
||||
if (tmpIndy instanceof InterfaceGAIndividual) {
|
||||
this.m_DifferenceThreshold = (int) (((InterfaceGAIndividual) tmpIndy).getGenotypeLength() * this.m_InitialDifferenceThreshold);
|
||||
this.differenceThreshold = (int) (((InterfaceGAIndividual) tmpIndy).getGenotypeLength() * this.initialDifferenceThreshold);
|
||||
} else {
|
||||
System.out.println("Problem does not apply InterfaceGAIndividual, which is the only individual type valid for CHC!");
|
||||
}
|
||||
|
||||
if (reset) {
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
* @param population The population that is to be evaluated
|
||||
*/
|
||||
private void evaluatePopulation(Population population) {
|
||||
this.m_Problem.evaluate(population);
|
||||
this.optimizationProblem.evaluate(population);
|
||||
population.incrGeneration();
|
||||
}
|
||||
|
||||
@ -118,16 +118,16 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
* population of evaluated individuals.
|
||||
*/
|
||||
private Population generateChildren() {
|
||||
Population result = this.m_Population.cloneWithoutInds(), parents, partners;
|
||||
Population result = this.population.cloneWithoutInds(), parents, partners;
|
||||
AbstractEAIndividual[] offSprings;
|
||||
AbstractEAIndividual tmpIndy;
|
||||
|
||||
result.clear();
|
||||
// this.m_NormationOperator.computeSelectionProbability(this.m_Population, "Fitness");
|
||||
//System.out.println("Population:"+this.m_Population.getSolutionRepresentationFor());
|
||||
this.m_PopulSelectionOperator.prepareSelection(this.m_Population);
|
||||
this.m_RecombSelectionOperator.prepareSelection(this.m_Population);
|
||||
parents = this.m_PopulSelectionOperator.selectFrom(this.m_Population, this.m_Population.getTargetSize());
|
||||
// this.m_NormationOperator.computeSelectionProbability(this.population, "Fitness");
|
||||
//System.out.println("Population:"+this.population.getSolutionRepresentationFor());
|
||||
this.populationSelectionOperator.prepareSelection(this.population);
|
||||
this.recombSelectionOperator.prepareSelection(this.population);
|
||||
parents = this.populationSelectionOperator.selectFrom(this.population, this.population.getTargetSize());
|
||||
//System.out.println("Parents:"+parents.getSolutionRepresentationFor());
|
||||
|
||||
for (int i = 0; i < parents.size(); i++) {
|
||||
@ -135,12 +135,12 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
if (tmpIndy == null) {
|
||||
System.out.println("Individual null " + i);
|
||||
}
|
||||
if (this.m_Population == null) {
|
||||
if (this.population == null) {
|
||||
System.out.println("population null " + i);
|
||||
}
|
||||
|
||||
partners = this.m_RecombSelectionOperator.findPartnerFor(tmpIndy, this.m_Population, this.m_NumberOfPartners);
|
||||
if (this.computeHammingDistance(tmpIndy, partners) > this.m_DifferenceThreshold) {
|
||||
partners = this.recombSelectionOperator.findPartnerFor(tmpIndy, this.population, this.numberOfPartners);
|
||||
if (this.computeHammingDistance(tmpIndy, partners) > this.differenceThreshold) {
|
||||
offSprings = tmpIndy.mateWith(partners);
|
||||
for (int j = 0; j < offSprings.length; j++) {
|
||||
offSprings[j].mutate();
|
||||
@ -182,17 +182,17 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
* mutation rate.
|
||||
*/
|
||||
private void diverge() {
|
||||
AbstractEAIndividual best = this.m_Population.getBestEAIndividual();
|
||||
AbstractEAIndividual best = this.population.getBestEAIndividual();
|
||||
InterfaceGAIndividual mutant;
|
||||
BitSet tmpBitSet;
|
||||
|
||||
this.m_Population.clear();
|
||||
this.m_Population.add(best);
|
||||
for (int i = 1; i < this.m_Population.getTargetSize(); i++) {
|
||||
this.population.clear();
|
||||
this.population.add(best);
|
||||
for (int i = 1; i < this.population.getTargetSize(); i++) {
|
||||
mutant = (InterfaceGAIndividual) best.clone();
|
||||
tmpBitSet = mutant.getBGenotype();
|
||||
for (int j = 0; j < mutant.getGenotypeLength(); j++) {
|
||||
if (RNG.flipCoin(this.m_DivergenceRate)) {
|
||||
if (RNG.flipCoin(this.divergenceRate)) {
|
||||
if (tmpBitSet.get(j)) {
|
||||
tmpBitSet.clear(j);
|
||||
} else {
|
||||
@ -201,13 +201,13 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
}
|
||||
}
|
||||
mutant.SetBGenotype(tmpBitSet);
|
||||
this.m_Population.add(mutant);
|
||||
this.population.add(mutant);
|
||||
}
|
||||
if (best instanceof InterfaceGAIndividual) {
|
||||
this.m_DifferenceThreshold = (int) (this.m_DivergenceRate * (1 - this.m_DivergenceRate) * ((InterfaceGAIndividual) best).getGenotypeLength());
|
||||
this.differenceThreshold = (int) (this.divergenceRate * (1 - this.divergenceRate) * ((InterfaceGAIndividual) best).getGenotypeLength());
|
||||
|
||||
}
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.evaluatePopulation(this.population);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -215,39 +215,39 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
Population nextGeneration, tmp;
|
||||
//AbstractEAIndividual elite;
|
||||
|
||||
if (this.m_DifferenceThreshold < 0) {
|
||||
if (this.differenceThreshold < 0) {
|
||||
this.diverge();
|
||||
} else {
|
||||
nextGeneration = this.generateChildren();
|
||||
if (nextGeneration.size() == 0) {
|
||||
this.m_DifferenceThreshold--;
|
||||
this.differenceThreshold--;
|
||||
} else {
|
||||
this.evaluatePopulation(nextGeneration);
|
||||
if (nextGeneration.getWorstEAIndividual().getFitness(0) > this.m_Population.getBestEAIndividual().getFitness(0)) {
|
||||
this.m_DifferenceThreshold--;
|
||||
if (nextGeneration.getWorstEAIndividual().getFitness(0) > this.population.getBestEAIndividual().getFitness(0)) {
|
||||
this.differenceThreshold--;
|
||||
}
|
||||
}
|
||||
nextGeneration.addPopulation(this.m_Population);
|
||||
nextGeneration.addPopulation(this.population);
|
||||
// this.m_NormationOperator.computeSelectionProbability(nextGeneration, "Fitness");
|
||||
this.m_PopulSelectionOperator.prepareSelection(this.m_Population);
|
||||
tmp = this.m_PopulSelectionOperator.selectFrom(nextGeneration, this.m_Population.getTargetSize());
|
||||
this.populationSelectionOperator.prepareSelection(this.population);
|
||||
tmp = this.populationSelectionOperator.selectFrom(nextGeneration, this.population.getTargetSize());
|
||||
nextGeneration.clear();
|
||||
nextGeneration.addPopulation(tmp);
|
||||
this.m_Population = nextGeneration;
|
||||
this.population = nextGeneration;
|
||||
}
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||
this.m_Listener = ea;
|
||||
this.interfacePopulationChangedEventListener = ea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removePopulationChangedEventListener(
|
||||
InterfacePopulationChangedEventListener ea) {
|
||||
if (m_Listener == ea) {
|
||||
m_Listener = null;
|
||||
if (interfacePopulationChangedEventListener == ea) {
|
||||
interfacePopulationChangedEventListener = null;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@ -258,8 +258,8 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
* Something has changed
|
||||
*/
|
||||
protected void firePropertyChangedEvent(String name) {
|
||||
if (this.m_Listener != null) {
|
||||
this.m_Listener.registerPopulationStateChanged(this, name);
|
||||
if (this.interfacePopulationChangedEventListener != null) {
|
||||
this.interfacePopulationChangedEventListener.registerPopulationStateChanged(this, name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,12 +270,12 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
*/
|
||||
@Override
|
||||
public void setProblem(InterfaceOptimizationProblem problem) {
|
||||
this.m_Problem = problem;
|
||||
this.optimizationProblem = problem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InterfaceOptimizationProblem getProblem() {
|
||||
return this.m_Problem;
|
||||
return this.optimizationProblem;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -289,8 +289,8 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
String result = "";
|
||||
result += "CHC Adaptive Search Algorithm:\n";
|
||||
result += "Optimization Problem: ";
|
||||
result += this.m_Problem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.m_Population.getStringRepresentation();
|
||||
result += this.optimizationProblem.getStringRepresentationForProblem(this) + "\n";
|
||||
result += this.population.getStringRepresentation();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -301,12 +301,12 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
*/
|
||||
@Override
|
||||
public void setIdentifier(String name) {
|
||||
this.m_Identifier = name;
|
||||
this.identifier = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdentifier() {
|
||||
return this.m_Identifier;
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -341,12 +341,12 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
*/
|
||||
@Override
|
||||
public Population getPopulation() {
|
||||
return this.m_Population;
|
||||
return this.population;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPopulation(Population pop) {
|
||||
this.m_Population = pop;
|
||||
this.population = pop;
|
||||
}
|
||||
|
||||
public String populationTipText() {
|
||||
@ -376,11 +376,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
* @param elitism
|
||||
*/
|
||||
public void setElitism(boolean elitism) {
|
||||
this.m_UseElitism = elitism;
|
||||
this.useElitism = elitism;
|
||||
}
|
||||
|
||||
public boolean getElitism() {
|
||||
return this.m_UseElitism;
|
||||
return this.useElitism;
|
||||
}
|
||||
|
||||
public String elitismTipText() {
|
||||
@ -396,11 +396,11 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
||||
if (partners < 0) {
|
||||
partners = 0;
|
||||
}
|
||||
this.m_NumberOfPartners = partners;
|
||||
this.numberOfPartners = partners;
|
||||
}
|
||||
|
||||
public int getNumberOfPartners() {
|
||||
return this.m_NumberOfPartners;
|
||||
return this.numberOfPartners;
|
||||
}
|
||||
|
||||
public String numberOfPartnersTipText() {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -147,7 +147,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
||||
archive = new Population();
|
||||
hideHideable();
|
||||
m_Population.setTargetSize(initialPopSize);
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
m_Population.addPopulationChangedEventListener(null); // noone will be notified directly on pop changes
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
@ -200,7 +200,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
||||
System.out.println("evalCycle: " + hcEvalCycle + ", evals now: " + evalsNow);
|
||||
}
|
||||
popD = PostProcess.clusterLocalSearch(localSearchMethod, m_Population, (AbstractOptimizationProblem) m_Problem, sigmaClust, evalsNow, 0.5, mutator);
|
||||
// (m_Population, (AbstractOptimizationProblem)m_Problem, sigmaClust, hcEvalCycle - (m_Population.getFunctionCalls() % hcEvalCycle), 0.5);
|
||||
// (m_Population, (AbstractOptimizationProblem)problem, sigmaClust, hcEvalCycle - (m_Population.getFunctionCalls() % hcEvalCycle), 0.5);
|
||||
if (popD.head().getFunctionCalls() == funCallsBefore) {
|
||||
System.err.println("Bad case, increasing allowed evaluations!");
|
||||
evalsNow = Math.max(evalsNow++, (int) (evalsNow * 1.2));
|
||||
@ -235,7 +235,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
||||
Population tmpPop = new Population();
|
||||
tmpPop.addPopulationChangedEventListener(null);
|
||||
tmpPop.setTargetSize(initialPopSize);
|
||||
this.m_Problem.initPopulation(tmpPop);
|
||||
this.m_Problem.initializePopulation(tmpPop);
|
||||
tmpPop.setSameParams(m_Population);
|
||||
tmpPop.setTargetSize(initialPopSize);
|
||||
this.m_Problem.evaluate(tmpPop);
|
||||
|
@ -99,7 +99,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
// children = new Population(m_Population.size());
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
@ -201,7 +201,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
private double[] fetchDeltaCurrentRandom(Population pop, InterfaceDataTypeDouble indy) {
|
||||
double[] x1, x2;
|
||||
double[] result;
|
||||
boolean isEmpty;
|
||||
boolean isEmpty;
|
||||
int iterations = 0;
|
||||
|
||||
|
||||
@ -520,7 +520,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
// AbstractEAIndividual indy = null, orig;
|
||||
int parentIndex;
|
||||
// required for dynamic problems especially
|
||||
// m_Problem.evaluatePopulationStart(m_Population);
|
||||
// problem.evaluatePopulationStart(m_Population);
|
||||
if (children == null) {
|
||||
children = new Population(m_Population.size());
|
||||
} else {
|
||||
@ -657,7 +657,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
// if (children==null) children = new Population(m_Population.size());
|
||||
// for (int i = 0; i < this.m_Population.size(); i++) {
|
||||
// indy = this.generateNewIndividual(this.m_Population);
|
||||
// this.m_Problem.evaluate(indy);
|
||||
// this.problem.evaluate(indy);
|
||||
// this.m_Population.incrFunctionCalls();
|
||||
// children.add(indy);
|
||||
// }
|
||||
@ -671,7 +671,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
// } else { // duel with random one
|
||||
// index = RNG.randomInt(0, this.m_Population.size()-1);
|
||||
// org = (AbstractEAIndividual)this.m_Population.get(index);
|
||||
// // if (envHasChanged) this.m_Problem.evaluate(org);
|
||||
// // if (envHasChanged) this.problem.evaluate(org);
|
||||
// if (indy.isDominatingDebConstraints(org)) {
|
||||
// this.m_Population.replaceIndividualAt(index, indy);
|
||||
// }
|
||||
@ -681,7 +681,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
//////// this was the original version
|
||||
// for (int i = 0; i < this.m_Population.size(); i++) {
|
||||
// indy = this.generateNewIndividual(this.m_Population);
|
||||
// this.m_Problem.evaluate(indy);
|
||||
// this.problem.evaluate(indy);
|
||||
// this.m_Population.incrFunctionCalls();
|
||||
// index = RNG.randomInt(0, this.m_Population.size()-1);
|
||||
// org = (AbstractEAIndividual)this.m_Population.get(index);
|
||||
|
@ -254,52 +254,6 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization
|
||||
return rand;
|
||||
}
|
||||
|
||||
/** This method will update a given individual
|
||||
* according to the PSO method
|
||||
* @param index The individual to update.
|
||||
* @param pop The current population.
|
||||
* @param best The best individual found so far.
|
||||
*/
|
||||
// protected void updateIndividual(int index, Population pop, AbstractEAIndividual best) {
|
||||
// AbstractEAIndividual indy = (AbstractEAIndividual)pop.get(index);
|
||||
// if (indy instanceof InterfaceESIndividual) {
|
||||
// InterfaceESIndividual endy = (InterfaceESIndividual) indy;
|
||||
//
|
||||
// if (isParticleType(indy, resetType)) {
|
||||
// resetIndividual(indy);
|
||||
// } else {
|
||||
// indy.SetData(partTypeKey, defaultType); // reset in case it was quantum
|
||||
//
|
||||
// double[] personalBestPos = (double[]) indy.getData(partBestPosKey);
|
||||
// double[] velocity = (double[]) indy.getData(partVelKey);
|
||||
// double[] curPosition = endy.getDGenotype();
|
||||
// double[][] range = endy.getDoubleRange();
|
||||
//
|
||||
// // search for the local best position
|
||||
// double[] neighbourBestPos = findNeighbourhoodOptimum(index, pop, best);
|
||||
//
|
||||
// // now update the velocity
|
||||
// double[] curVelocity = updateVelocity(index, velocity, personalBestPos, curPosition, neighbourBestPos, range);
|
||||
//
|
||||
// //System.out.println("localBestPos is " + localBestPosition[0] + "/" + localBestPosition[1]);
|
||||
//
|
||||
// // check the speed limit!
|
||||
// if (checkSpeedLimit) enforceSpeedLimit(curVelocity, range, getSpeedLimit(index, pop.size()));
|
||||
//
|
||||
// // enforce range constraints if necessary
|
||||
// if (m_CheckConstraints) ensureConstraints(curPosition, curVelocity, range);
|
||||
//
|
||||
// plotIndy(curPosition, curVelocity, (Integer)indy.getData(indexKey));
|
||||
// // finally update the position
|
||||
// updatePosition(indy, curVelocity, curPosition, range);
|
||||
//
|
||||
// resetFitness(indy);
|
||||
// }
|
||||
// } else {
|
||||
// System.err.println("Could not perform PSO update, because individual is not instance of InterfaceESIndividual!");
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
protected double[] updateVelocity(int index, double[] lastVelocity, double[] bestPosition, double[] curPosition, double[] localBestPos, double[][] range) {
|
||||
if (envHasChanged) {
|
||||
@ -337,10 +291,10 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization
|
||||
}
|
||||
|
||||
protected double getProblemSpecificAttraction(int i, double chi) {
|
||||
// if (m_Problem instanceof DynLocalizationProblem) {
|
||||
// if (problem instanceof DynLocalizationProblem) {
|
||||
// // TODO test this!
|
||||
// //hier weiter
|
||||
// double[] att = ((DynLocalizationProblem)m_Problem).getProblemSpecificAttractor();
|
||||
// double[] att = ((DynLocalizationProblem)problem).getProblemSpecificAttractor();
|
||||
// return (this.phi3 * chi * RNG.randomDouble(0, 1.))*att[i];
|
||||
// } else
|
||||
return 0;
|
||||
@ -363,7 +317,6 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization
|
||||
* Get the speed limit of an individual (respecting highEnergyRatio, so some individuals may be accelerated).
|
||||
*
|
||||
* @param index the individuals index
|
||||
* @param popSize the size of the population
|
||||
* @return the speed limit of the individual
|
||||
*/
|
||||
@Override
|
||||
@ -420,7 +373,7 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization
|
||||
* according to the PSO method
|
||||
* @param index The individual to update.
|
||||
* @param pop The current population.
|
||||
* @param best The best individual found so far.
|
||||
* @param indy The best individual found so far.
|
||||
*/
|
||||
@Override
|
||||
protected void updateIndividual(int index, AbstractEAIndividual indy, Population pop) {
|
||||
@ -465,8 +418,8 @@ public class DynamicParticleSwarmOptimization extends ParticleSwarmOptimization
|
||||
if (doSpeedAdaptation) {
|
||||
adaptTrackingSpeed(((InterfaceDataTypeDouble)population.get(0)).getDoubleRange());
|
||||
}
|
||||
// if (m_Problem instanceof DynLocalizationProblem) {
|
||||
// ((DynLocalizationProblem)m_Problem).adaptPSOByPopulation(population, this);
|
||||
// if (problem instanceof DynLocalizationProblem) {
|
||||
// ((DynLocalizationProblem)problem).adaptPSOByPopulation(population, this);
|
||||
// }
|
||||
}
|
||||
|
||||
|
@ -583,7 +583,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
|
||||
loners.removeMembers(luckyLosers, true);
|
||||
// fill up with random indies
|
||||
// Population randomNewIndies = new Population(lambdaPerPeak - selected.size());
|
||||
// problem.initPopulation(randomNewIndies); // function calls??
|
||||
// problem.initializePopulation(randomNewIndies); // function calls??
|
||||
// selected.addAll(randomNewIndies);
|
||||
}
|
||||
}
|
||||
@ -767,7 +767,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
|
||||
*/
|
||||
private Population initRandomPeakPop(int cntPerNewSpecies) {
|
||||
Population newPop = new Population(cntPerNewSpecies);
|
||||
problem.initPopulation(newPop);
|
||||
problem.initializePopulation(newPop);
|
||||
newPop.putData(EvolutionStrategies.esLambdaParam, getLambdaPerPeak());
|
||||
newPop.putData(EvolutionStrategies.esMuParam, getMuPerPeak());
|
||||
newPop.setMaxHistoryLength(haltingWindowLen);
|
||||
@ -780,7 +780,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
|
||||
private void generateEvalImmigrants(int cnt) {
|
||||
if (cnt > 0) {
|
||||
randomNewIndies = new Population(cnt);
|
||||
problem.initPopulation(randomNewIndies);
|
||||
problem.initializePopulation(randomNewIndies);
|
||||
problem.evaluate(randomNewIndies);
|
||||
population.incrFunctionCallsBy(cnt);
|
||||
if (TRACE) {
|
||||
|
@ -95,7 +95,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
|
||||
checkPopulationConstraints();
|
||||
population.putData(esMuParam, getMu());
|
||||
population.putData(esLambdaParam, getLambda());
|
||||
this.optimizationProblem.initPopulation(this.population);
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
this.evaluatePopulation(this.population);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
||||
bestList.add(best);
|
||||
best = null;
|
||||
Population newPop = getPopulation().cloneWithoutInds();
|
||||
getProblem().initPopulation(newPop); // this is where the reinit event of Pop is called, meaning that the rank-mu-cma matrix is reinitialized as well
|
||||
getProblem().initializePopulation(newPop); // this is where the reinit event of Pop is called, meaning that the rank-mu-cma matrix is reinitialized as well
|
||||
double[] badFit = getPopulation().getBestFitness().clone();
|
||||
Arrays.fill(badFit, Double.MAX_VALUE);
|
||||
newPop.setAllFitnessValues(badFit);
|
||||
|
@ -49,7 +49,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.evaluatePopulation(this.m_Population);
|
||||
this.m_PopulationSize = this.m_Population.size();
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
|
@ -57,7 +57,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
this.m_CurrentFloodPeak = this.m_InitialFloodPeak;
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
|
@ -57,7 +57,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
this.optimizationProblem.initPopulation(this.population);
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
@ -71,7 +71,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
||||
public void initByPopulation(Population pop, boolean reset) {
|
||||
this.population = (Population) pop.clone();
|
||||
if (reset) {
|
||||
this.optimizationProblem.initPopulation(population);
|
||||
this.optimizationProblem.initializePopulation(population);
|
||||
this.population.init();
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
|
@ -108,7 +108,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser
|
||||
public void init() {
|
||||
//System.out.println("init() called ");
|
||||
// indyhash = new Hashtable();
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser
|
||||
|
||||
((InterfaceDataTypeDouble) indy).SetDoubleGenotype(params);
|
||||
|
||||
} // end if ((this.m_Problem instanceof InterfaceFirstOrderDerivableProblem) && (indy instanceof InterfaceDataTypeDouble)) {
|
||||
} // end if ((this.problem instanceof InterfaceFirstOrderDerivableProblem) && (indy instanceof InterfaceDataTypeDouble)) {
|
||||
else {
|
||||
String msg = "Warning, problem of type InterfaceFirstOrderDerivableProblem and template of type InterfaceDataTypeDouble is required for " + this.getClass();
|
||||
EVAERROR.errorMsgOnce(msg);
|
||||
|
@ -53,7 +53,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
this.m_Problem.initPopulation(this.m_Population);
|
||||
this.m_Problem.initializePopulation(this.m_Population);
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
||||
}
|
||||
@ -104,7 +104,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
||||
// indy1 = (AbstractEAIndividual) this.m_Population.get(i);
|
||||
// indy2 = (AbstractEAIndividual)(indy1).clone();
|
||||
// indy2.mutate();
|
||||
// this.m_Problem.evaluate((AbstractEAIndividual) indy2);
|
||||
// this.problem.evaluate((AbstractEAIndividual) indy2);
|
||||
// //indy2.SetFitness(0, indy2.evaulateAsMiniBits());
|
||||
// this.m_Population.incrFunctionCalls();
|
||||
// //if (indy2.getFitness(0) < indy1.getFitness(0)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user