diff --git a/src/eva2/optimization/operator/archiving/ArchivingSPEAII.java b/src/eva2/optimization/operator/archiving/ArchivingSPEAII.java
index 4673874f..5c7e9766 100644
--- a/src/eva2/optimization/operator/archiving/ArchivingSPEAII.java
+++ b/src/eva2/optimization/operator/archiving/ArchivingSPEAII.java
@@ -288,7 +288,7 @@ public class ArchivingSPEAII extends AbstractArchiving implements java.io.Serial
// result[i] = Double.POSITIVE_INFINITY;
// for (int j = 0; j < result.length; j++) {
// if (i != j) {
-// tmpD = this.m_Metric.distance((AbstractEAIndividual)pop.get(i), (AbstractEAIndividual)pop.get(j));
+// tmpD = this.distanceMetric.distance((AbstractEAIndividual)pop.get(i), (AbstractEAIndividual)pop.get(j));
// if (tmpD < result[i]) result[i] = tmpD;
// }
// }
diff --git a/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java b/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
index 3e2e6520..fabfbfe2 100644
--- a/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
+++ b/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
@@ -210,7 +210,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
// */
// public boolean belongsToSpecies(AbstractEAIndividual indy, Population species, Population pop) {
// if (this.m_TestConvergingSpeciesOnBestOnly) {
-// if (this.m_Metric.distance(indy, species.getBestEAIndividual()) < this.m_ClusterDistance) return true;
+// if (this.distanceMetric.distance(indy, species.getBestEAIndividual()) < this.m_ClusterDistance) return true;
// else return false;
// } else {
// Population tmpPop = (Population)species.clone();
diff --git a/src/eva2/optimization/operator/migration/MOClusteringSeparation.java b/src/eva2/optimization/operator/migration/MOClusteringSeparation.java
index e42f7a47..6814c193 100644
--- a/src/eva2/optimization/operator/migration/MOClusteringSeparation.java
+++ b/src/eva2/optimization/operator/migration/MOClusteringSeparation.java
@@ -186,7 +186,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria
if (prob instanceof AbstractMultiObjectiveOptimizationProblem) {
// set the boundaries to perform the constrained
// domain principle introduced by Deb et al.
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.clear();
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.clear();
double[] myClass = c[i];
double[][] myOtherClass = new double[c.length - 1][];
int index = 0;
@@ -198,7 +198,7 @@ public class MOClusteringSeparation implements InterfaceMigration, java.io.Seria
index++;
}
ConstBelongsToDifferentClass b = new ConstBelongsToDifferentClass(myClass, myOtherClass, this.m_KMeans.getUseSearchSpace());
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(b);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(b);
// if (this.debug) {
// String out = "";
// out += i+ ". MyClass: {";
diff --git a/src/eva2/optimization/operator/migration/MOConeSeparation.java b/src/eva2/optimization/operator/migration/MOConeSeparation.java
index 401fcd9b..70d49fdd 100644
--- a/src/eva2/optimization/operator/migration/MOConeSeparation.java
+++ b/src/eva2/optimization/operator/migration/MOConeSeparation.java
@@ -272,18 +272,18 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
if (prob instanceof AbstractMultiObjectiveOptimizationProblem) {
// set the boundaries to perform the constrained
// domain principle introduced by Deb et al.
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.clear();
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.clear();
if (i > 0) {
// add the lower boundary
ConstObjectivesInEqualityBiggerThanLinear b = new ConstObjectivesInEqualityBiggerThanLinear(boundaries[i - 1][0], boundaries[i - 1][1]);
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(b);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(b);
}
if (i < islands.length - 1) {
// add the upper boundary
ConstObjectivesInEqualityLesserThanLinear b = new ConstObjectivesInEqualityLesserThanLinear(boundaries[i][0], boundaries[i][1]);
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(b);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(b);
}
islands[i].setProblem(prob);
}
@@ -380,11 +380,11 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
if (prob instanceof AbstractMultiObjectiveOptimizationProblem) {
// set the boundaries to perform the constrained
// domain principle introduced by Deb et al.
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.clear();
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.clear();
ConstObjectivesInEqualitySmallerThanSurface sts = new ConstObjectivesInEqualitySmallerThanSurface(curBoundingPlane[0], curBoundingPlane[1]);
ConstObjectivesInEqualityBiggerThanSurface bts = new ConstObjectivesInEqualityBiggerThanSurface(lastBoundingPlane[0], lastBoundingPlane[1]);
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(sts);
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(bts);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(sts);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(bts);
}
islands[i].setProblem(prob);
// if (true) {
@@ -393,7 +393,7 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
// for (int j = 0; j < newIPOP[i].size(); j++) {
// if(((AbstractEAIndividual)newIPOP[i].get(j)).areaConst4ParallelViolated) {
// System.out.print(j+", ");
-// ((AbstractEAIndividual)newIPOP[i].get(j)).checkAreaConst4Parallelization(((AbstractMultiObjectiveOptimizationProblem)prob).m_AreaConst4Parallelization);
+// ((AbstractEAIndividual)newIPOP[i].get(j)).checkAreaConst4Parallelization(((AbstractMultiObjectiveOptimizationProblem)prob).areaConst4Parallelization);
// }
// }
// System.out.println("");
@@ -421,11 +421,11 @@ public class MOConeSeparation implements InterfaceMigration, java.io.Serializabl
// if (prob instanceof AbstractMultiObjectiveOptimizationProblem) {
// // set the boundaries to perform the constrained
// // domain principle introduced by Deb et al.
-// ((AbstractMultiObjectiveOptimizationProblem)prob).m_AreaConst4Parallelization.clear();
+// ((AbstractMultiObjectiveOptimizationProblem)prob).areaConst4Parallelization.clear();
// ConstObjectivesInEqualitySmallerThanSurface sts = new ConstObjectivesInEqualitySmallerThanSurface(curBoundingPlane[0], curBoundingPlane[1]);
// ConstObjectivesInEqualityBiggerThanSurface bts = new ConstObjectivesInEqualityBiggerThanSurface(lastBoundingPlane[0], lastBoundingPlane[1]);
-// ((AbstractMultiObjectiveOptimizationProblem)prob).m_AreaConst4Parallelization.add(sts);
-// ((AbstractMultiObjectiveOptimizationProblem)prob).m_AreaConst4Parallelization.add(bts);
+// ((AbstractMultiObjectiveOptimizationProblem)prob).areaConst4Parallelization.add(sts);
+// ((AbstractMultiObjectiveOptimizationProblem)prob).areaConst4Parallelization.add(bts);
// }
// islands[last].SetProblem(prob);
// }
diff --git a/src/eva2/optimization/operator/migration/MOXMeansSeparation.java b/src/eva2/optimization/operator/migration/MOXMeansSeparation.java
index d61a009a..e17dc337 100644
--- a/src/eva2/optimization/operator/migration/MOXMeansSeparation.java
+++ b/src/eva2/optimization/operator/migration/MOXMeansSeparation.java
@@ -188,7 +188,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa
if (prob instanceof AbstractMultiObjectiveOptimizationProblem) {
// set the boundaries to perform the constrained
// domain principle introduced by Deb et al.
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.clear();
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.clear();
double[] myClass = c[i];
double[][] myOtherClass = new double[c.length - 1][];
int index = 0;
@@ -200,7 +200,7 @@ public class MOXMeansSeparation implements InterfaceMigration, java.io.Serializa
index++;
}
ConstBelongsToDifferentClass b = new ConstBelongsToDifferentClass(myClass, myOtherClass, this.m_XMeans.getUseSearchSpace());
- ((AbstractMultiObjectiveOptimizationProblem) prob).m_AreaConst4Parallelization.add(b);
+ ((AbstractMultiObjectiveOptimizationProblem) prob).areaConst4Parallelization.add(b);
// if (this.debug) {
// String out = "";
// out += i+ ". MyClass: {";
diff --git a/src/eva2/optimization/problems/AbstractDynTransProblem.java b/src/eva2/optimization/problems/AbstractDynTransProblem.java
index 822aa84b..3b77733a 100644
--- a/src/eva2/optimization/problems/AbstractDynTransProblem.java
+++ b/src/eva2/optimization/problems/AbstractDynTransProblem.java
@@ -64,9 +64,6 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz
// myplot.addGraph(0, 1);
myplot.jump();
} else {
- if (TRACE) {
- System.out.println("creating myplot instance");
- }
double[] tmpD = new double[2];
tmpD[0] = 0;
tmpD[1] = 0;
@@ -135,12 +132,9 @@ public abstract class AbstractDynTransProblem extends AbstractSynchronousOptimiz
*/
@Override
public void initPopulationAt(Population population, double time) {
- if (TRACE) {
- System.out.println("DynTransProblem at " + this + " initPop, problem is " + getProblem());
- }
getProblem().initializePopulation(population);
- for (int i = 0; i < population.size(); i++) {
- ((AbstractEAIndividual) population.get(i)).setAge(0);
+ for (Object individuum : population) {
+ ((AbstractEAIndividual) individuum).setAge(0);
}
}
diff --git a/src/eva2/optimization/problems/AbstractDynamicOptimizationProblem.java b/src/eva2/optimization/problems/AbstractDynamicOptimizationProblem.java
index 7d01bbe5..49e38572 100644
--- a/src/eva2/optimization/problems/AbstractDynamicOptimizationProblem.java
+++ b/src/eva2/optimization/problems/AbstractDynamicOptimizationProblem.java
@@ -10,10 +10,6 @@ import eva2.optimization.population.Population;
* changes in the problem environment (the target function). The latter may be measured in absolute
* function evaluations or relative to the population size. The necessary transmutations are to be
* implemented, however.
- *
- * User: MK
- * Date: 19.12.2006
- * Time: 11:02:12
*/
public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimizationProblem implements java.io.Serializable {
@@ -47,10 +43,6 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
* Switch controling extra problem visualization
*/
private boolean bExtraPlot;
- /**
- * Debug switch
- */
- protected boolean TRACE;
/**
* the plot instance for problem data visualization
*/
@@ -62,7 +54,6 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
public AbstractDynamicOptimizationProblem() {
//System.out.println("AbstractDynamicOptimizationProblem()");
bExtraPlot = false;
- TRACE = false;
myplot = null;
idealInd = null;
// initialize(0, 1., 0.1);
@@ -169,9 +160,6 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
*/
public void setSeverity(double sev) {
severity = sev;
- if (TRACE) {
- System.out.println("severity to " + sev);
- }
}
/**
@@ -228,9 +216,6 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
protected void incProblemTime(double dt) {
currentProblemTime += dt;
resetProblem(dt);
- if (TRACE) {
- System.out.println("new problem time is " + currentProblemTime);
- }
}
/**
@@ -344,9 +329,6 @@ public abstract class AbstractDynamicOptimizationProblem extends AbstractOptimiz
}
private void makePlot() {
- if (TRACE) {
- System.out.println("creating myplot instance");
- }
double[] tmpD = new double[2];
tmpD[0] = 0;
tmpD[1] = 0;
diff --git a/src/eva2/optimization/problems/AbstractMultiModalProblemKnown.java b/src/eva2/optimization/problems/AbstractMultiModalProblemKnown.java
index 7ed80409..89edf25d 100644
--- a/src/eva2/optimization/problems/AbstractMultiModalProblemKnown.java
+++ b/src/eva2/optimization/problems/AbstractMultiModalProblemKnown.java
@@ -16,7 +16,7 @@ import java.util.List;
public abstract class AbstractMultiModalProblemKnown extends AbstractProblemDouble
implements Interface2DBorderProblem, InterfaceMultimodalProblemKnown {
- protected static InterfaceDistanceMetric m_Metric = new PhenotypeMetric();
+ protected static InterfaceDistanceMetric distanceMetric = new PhenotypeMetric();
private double globalOptimum = 0;
protected Population listOfOptima;
protected double epsilon = 0.05;
diff --git a/src/eva2/optimization/problems/AbstractMultiObjectiveOptimizationProblem.java b/src/eva2/optimization/problems/AbstractMultiObjectiveOptimizationProblem.java
index 6686c9f8..2f3d80da 100644
--- a/src/eva2/optimization/problems/AbstractMultiObjectiveOptimizationProblem.java
+++ b/src/eva2/optimization/problems/AbstractMultiObjectiveOptimizationProblem.java
@@ -25,11 +25,7 @@ import java.util.Vector;
import java.util.concurrent.Semaphore;
/**
- * Created by IntelliJ IDEA.
- * User: streiche
- * Date: 15.04.2004
- * Time: 13:32:08
- * To change this template use File | Settings | File Templates.
+ *
*/
public abstract class AbstractMultiObjectiveOptimizationProblem extends AbstractOptimizationProblem {
@@ -47,14 +43,14 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
AbstractEAIndividual ind;
Vector resultrep;
Population pop;
- Semaphore m_Semaphore = null;
+ Semaphore semaphore = null;
public MultiObjectiveEvalThread(AbstractMultiObjectiveOptimizationProblem prob, AbstractEAIndividual ind, Vector resultrep, Population pop, Semaphore sema) {
this.ind = ind;
this.prob = prob;
this.resultrep = resultrep;
this.pop = pop;
- this.m_Semaphore = sema;
+ this.semaphore = sema;
}
@Override
@@ -66,47 +62,47 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
fitness = ind.getFitness();
// check and update border if necessary
- if (m_Border == null) {
- prob.m_Border = new double[fitness.length][2];
- } else if (fitness.length != prob.m_Border.length) {
- //System.out.println("AbstractMOOptimizationProblem: Warning fitness.length("+fitness.length+") doesn't fit border.length("+this.m_Border.length+")");
+ if (border == null) {
+ prob.border = new double[fitness.length][2];
+ } else if (fitness.length != prob.border.length) {
+ //System.out.println("AbstractMOOptimizationProblem: Warning fitness.length("+fitness.length+") doesn't fit border.length("+this.border.length+")");
//System.out.println("Resetting the border!");
- prob.m_Border = new double[fitness.length][2];
+ prob.border = new double[fitness.length][2];
}
for (int j = 0; j < fitness.length; j++) {
-// if ((this.m_Border[j][0] > fitness[j]) || (this.m_Border[j][1] < fitness[j])) {
+// if ((this.border[j][0] > fitness[j]) || (this.border[j][1] < fitness[j])) {
// System.out.println("border... " + j);
-// System.out.println(this.m_Border[j][0]+" > "+fitness[j]);
-// System.out.println(this.m_Border[j][1]+" < "+fitness[j]);
+// System.out.println(this.border[j][0]+" > "+fitness[j]);
+// System.out.println(this.border[j][1]+" < "+fitness[j]);
// }
- prob.m_Border[j][0] = Math.min(prob.m_Border[j][0], fitness[j]);
- prob.m_Border[j][1] = Math.max(prob.m_Border[j][1], fitness[j]);
+ prob.border[j][0] = Math.min(prob.border[j][0], fitness[j]);
+ prob.border[j][1] = Math.max(prob.border[j][1], fitness[j]);
}
pop.incrFunctionCalls();
- m_Semaphore.release();
+ semaphore.release();
}
}
- protected InterfaceMOSOConverter m_MOSOConverter = new MOSONoConvert();
- protected InterfaceParetoFrontMetric m_Metric = new MetricS();
- transient protected Population m_ParetoFront = new Population();
- public ArrayList m_AreaConst4Parallelization = new ArrayList();
- protected int m_OutputDimension = 2;
- double m_defaultBorderLow = 0;
- double m_defaultBorderHigh = 5;
+ protected InterfaceMOSOConverter mosoConverter = new MOSONoConvert();
+ protected InterfaceParetoFrontMetric metric = new MetricS();
+ transient protected Population paretoFront = new Population();
+ public ArrayList areaConst4Parallelization = new ArrayList();
+ protected int outputDimension = 2;
+ double defaultBorderLow = 0;
+ double defaultBorderHigh = 5;
- transient protected double[][] m_Border;
- transient protected Plot m_Plot;
- transient protected JFrame m_Result;
- protected transient boolean m_Show = false;
+ transient protected double[][] border;
+ transient protected Plot plot;
+ transient protected JFrame resultFrame;
+ protected transient boolean show = false;
public AbstractMultiObjectiveOptimizationProblem(double borderHigh) {
super();
- m_defaultBorderHigh = borderHigh;
+ defaultBorderHigh = borderHigh;
this.template = new ESIndividualDoubleData();
makeBorder();
- if (this.m_Show) {
+ if (this.show) {
this.initProblemFrame();
}
}
@@ -121,17 +117,17 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @param b True if the pareto-front is to be shown.
*/
public void setShowParetoFront(boolean b) {
- this.m_Show = b;
- if (this.m_Show) {
+ this.show = b;
+ if (this.show) {
this.initProblemFrame();
- } else if (this.m_Plot != null) {
- this.m_Plot.dispose();
- this.m_Plot = null;
+ } else if (this.plot != null) {
+ this.plot.dispose();
+ this.plot = null;
}
}
public boolean isShowParetoFront() {
- return this.m_Show;
+ return this.show;
}
public String showParetoFrontTipText() {
@@ -155,28 +151,28 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
@Override
public void initializeProblem() {
makeBorder();
- this.m_ParetoFront = new Population();
- if (this.m_Show) {
+ this.paretoFront = new Population();
+ if (this.show) {
this.initProblemFrame();
}
}
protected void makeBorder() {
- if (this.m_Border == null) {
- this.m_Border = new double[m_OutputDimension][2];
+ if (this.border == null) {
+ this.border = new double[outputDimension][2];
}
- for (int i = 0; i < this.m_Border.length; i++) {
- this.m_Border[i][0] = getLowerBorder(i);
- this.m_Border[i][1] = getUpperBorder(i);
+ for (int i = 0; i < this.border.length; i++) {
+ this.border[i][0] = getLowerBorder(i);
+ this.border[i][1] = getUpperBorder(i);
}
}
protected double getUpperBorder(int i) {
- return m_defaultBorderHigh;
+ return defaultBorderHigh;
}
protected double getLowerBorder(int i) {
- return m_defaultBorderLow;
+ return defaultBorderLow;
}
/**
@@ -212,13 +208,13 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* This caused a lot of trouble for the DeNovo Approach of MOCCO
*/
public void resetParetoFront() {
- this.m_ParetoFront = new Population();
+ this.paretoFront = new Population();
}
@Override
public void evaluatePopulationStart(Population population) {
super.evaluatePopulationStart(population);
- if (this.m_Show && (this.m_Plot == null)) {
+ if (this.show && (this.plot == null)) {
this.initProblemFrame();
}
}
@@ -233,21 +229,21 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
AbstractEAIndividual tmpIndy = (AbstractEAIndividual) population.get(i);
fitness = tmpIndy.getFitness();
// check and update border if necessary
- if (m_Border == null) {
- this.m_Border = new double[fitness.length][2];
- } else if (fitness.length != this.m_Border.length) {
- //System.out.println("AbstractMOOptimizationProblem: Warning fitness.length("+fitness.length+") doesn't fit border.length("+this.m_Border.length+")");
+ if (border == null) {
+ this.border = new double[fitness.length][2];
+ } else if (fitness.length != this.border.length) {
+ //System.out.println("AbstractMOOptimizationProblem: Warning fitness.length("+fitness.length+") doesn't fit border.length("+this.border.length+")");
//System.out.println("Resetting the border!");
- this.m_Border = new double[fitness.length][2];
+ this.border = new double[fitness.length][2];
}
for (int j = 0; j < fitness.length; j++) {
-// if ((this.m_Border[j][0] > fitness[j]) || (this.m_Border[j][1] < fitness[j])) {
+// if ((this.border[j][0] > fitness[j]) || (this.border[j][1] < fitness[j])) {
// System.out.println("border... " + j);
-// System.out.println(this.m_Border[j][0]+" > "+fitness[j]);
-// System.out.println(this.m_Border[j][1]+" < "+fitness[j]);
+// System.out.println(this.border[j][0]+" > "+fitness[j]);
+// System.out.println(this.border[j][1]+" < "+fitness[j]);
// }
- this.m_Border[j][0] = Math.min(this.m_Border[j][0], fitness[j]);
- this.m_Border[j][1] = Math.max(this.m_Border[j][1], fitness[j]);
+ this.border[j][0] = Math.min(this.border[j][0], fitness[j]);
+ this.border[j][1] = Math.max(this.border[j][1], fitness[j]);
}
}
@@ -260,16 +256,16 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// could be pretty many
// currently the problem should be multi-criteria
- logPopToParetoFront(m_ParetoFront, population);
+ logPopToParetoFront(paretoFront, population);
// Sometimes you want to transform a multiobjective optimization problem
// into a single objective one, this way single objective optimization
// algorithms can be applied more easily
- this.m_MOSOConverter.convertMultiObjective2SingleObjective(population);
+ this.mosoConverter.convertMultiObjective2SingleObjective(population);
- if (this.m_Show) {
- if (m_Plot.isValid()) {
- AbstractMultiObjectiveOptimizationProblem.drawProblem(population, m_Plot, this);
+ if (this.show) {
+ if (plot.isValid()) {
+ AbstractMultiObjectiveOptimizationProblem.drawProblem(population, plot, this);
}
}
}
@@ -307,12 +303,12 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
double[] tmpD = new double[2];
tmpD[0] = 0;
tmpD[1] = 0;
- if (this.m_Plot == null) {
- m_Plot = new Plot("Multiobjective Optimization", "Y1", "Y2", tmpD, tmpD);
+ if (this.plot == null) {
+ plot = new Plot("Multiobjective Optimization", "Y1", "Y2", tmpD, tmpD);
}
// plot init stuff
- this.initAdditionalData(this.m_Plot, 10);
+ this.initAdditionalData(this.plot, 10);
}
/**
@@ -388,7 +384,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// MOOpt was converted into a SOOpt
if (AbstractMultiObjectiveOptimizationProblem.isPopulationMultiObjective(p)) {
// in this case i have to use my local archive
- tmpPop = moProblem.m_ParetoFront;
+ tmpPop = moProblem.paretoFront;
} else {
// in this case i use the population of the optimizer
// and eventually the population.archive if there is one
@@ -427,8 +423,8 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
}
plot.setUnconnectedPoint(tmpFitness[0], tmpFitness[1], index);
}
- plot.setUnconnectedPoint(this.m_Border[0][1], this.m_Border[1][1], index);
- plot.setUnconnectedPoint(this.m_Border[0][0], this.m_Border[1][0], index);
+ plot.setUnconnectedPoint(this.border[0][1], this.border[1][1], index);
+ plot.setUnconnectedPoint(this.border[0][0], this.border[1][0], index);
}
/**
@@ -526,8 +522,8 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
return new Double(this.calculateMetric(pop));
} else {
// in this case the local Pareto-Front could be multi-objective
- if (AbstractMultiObjectiveOptimizationProblem.isPopulationMultiObjective(this.m_ParetoFront)) {
- return new Double(this.calculateMetric(this.m_ParetoFront));
+ if (AbstractMultiObjectiveOptimizationProblem.isPopulationMultiObjective(this.paretoFront)) {
+ return new Double(this.calculateMetric(this.paretoFront));
} else {
return new Double(pop.getBestEAIndividual().getFitness(0));
}
@@ -540,7 +536,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @return the local Pareto-front log
*/
public Population getLocalParetoFront() {
- return this.m_ParetoFront;
+ return this.paretoFront;
}
@Override
@@ -552,7 +548,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
@Override
public Object[] getAdditionalDataValue(PopulationInterface pop) {
Object[] result = new Object[2];
- if (m_MOSOConverter != null && !(m_MOSOConverter instanceof MOSONoConvert)) {
+ if (mosoConverter != null && !(mosoConverter instanceof MOSONoConvert)) {
result[0] = Double.NaN;
result[1] = Double.NaN;
} else {
@@ -591,7 +587,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
if (pop == null || (pop.size() == 0)) {
return Double.NaN;
}
- return this.m_Metric.calculateMetricOn(pop, this);
+ return this.metric.calculateMetricOn(pop, this);
}
/**
@@ -600,7 +596,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @return The objective space range
*/
public double[][] getObjectiveSpaceRange() {
- return this.m_Border;
+ return this.border;
}
/**
@@ -609,7 +605,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @return The output dimension
*/
public int getOutputDimension() {
- return this.m_OutputDimension;
+ return this.outputDimension;
}
// /** This method will calculate the s-Metric if an archive population is present.
@@ -619,8 +615,8 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// public double tcalculateSMetric(Population population) {
// double result = 0;
//
-// ((SMetric)this.m_Metric).setObjectiveSpaceRange(this.m_Border);
-// result = this.m_Metric.calculateMetricOn(population);
+// ((SMetric)this.distanceMetric).setObjectiveSpaceRange(this.border);
+// result = this.distanceMetric.calculateMetricOn(population);
//
// return result;
// }
@@ -632,7 +628,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// public double calculateRelativeSMetric(Population population, double[][] ref) {
// double result = 0;
// SMetricWithReference tmpMetric = new SMetricWithReference();
-// tmpMetric.setObjectiveSpaceRange(this.m_Border);
+// tmpMetric.setObjectiveSpaceRange(this.border);
// tmpMetric.setReferenceFront(ref);
// result = tmpMetric.calculateMetricOn(population);
// return result;
@@ -645,12 +641,12 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @param b The new MO2SO converter.
*/
public void setMOSOConverter(InterfaceMOSOConverter b) {
- this.m_MOSOConverter = b;
- this.m_MOSOConverter.setOutputDimension(this.m_OutputDimension);
+ this.mosoConverter = b;
+ this.mosoConverter.setOutputDimension(this.outputDimension);
}
public InterfaceMOSOConverter getMOSOConverter() {
- return this.m_MOSOConverter;
+ return this.mosoConverter;
}
public String mOSOConverterTipText() {
@@ -663,11 +659,11 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @param b The new metric.
*/
public void setMetric(InterfaceParetoFrontMetric b) {
- this.m_Metric = b;
+ this.metric = b;
}
public InterfaceParetoFrontMetric getMetric() {
- return this.m_Metric;
+ return this.metric;
}
public String metricTipText() {
diff --git a/src/eva2/optimization/problems/AbstractOptimizationProblem.java b/src/eva2/optimization/problems/AbstractOptimizationProblem.java
index 74bdb968..8fa65dd5 100644
--- a/src/eva2/optimization/problems/AbstractOptimizationProblem.java
+++ b/src/eva2/optimization/problems/AbstractOptimizationProblem.java
@@ -34,11 +34,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
/**
- * Created by IntelliJ IDEA.
- * User: streiche
- * Date: 29.08.2003
- * Time: 13:40:12
- * To change this template use Options | File Templates.
+ *
*/
public abstract class AbstractOptimizationProblem implements InterfaceOptimizationProblem, Serializable {
class EvalThread extends Thread {
diff --git a/src/eva2/optimization/problems/AbstractParallelOptimizationProblem.java b/src/eva2/optimization/problems/AbstractParallelOptimizationProblem.java
index 1e39d3b0..df42d439 100644
--- a/src/eva2/optimization/problems/AbstractParallelOptimizationProblem.java
+++ b/src/eva2/optimization/problems/AbstractParallelOptimizationProblem.java
@@ -2,44 +2,15 @@ package eva2.optimization.problems;
/**
* This class is under construction.
- *
- * Created by IntelliJ IDEA.
- * User: streiche
- * Date: 17.12.2004
- * Time: 14:43:35
- * To change this template use File | Settings | File Templates.
*/
public abstract class AbstractParallelOptimizationProblem extends AbstractOptimizationProblem {
-
- // private PropertyRemoteServers m_Servers = new PropertyRemoteServers();
- private int m_LocalCPUs = 4;
- private boolean m_Parallelize = false;
- private AbstractOptimizationProblem[] m_Slaves;
+ private int localCPUs = 4;
+ private boolean parallelize = false;
@Override
public void initializeProblem() {
- /* if (this.m_Parallelize) {
- // this is running on remote maschines
- String[] nodesList = this.m_Servers.getCheckedServerNodes();
- if ((nodesList == null) || (nodesList.length == 0)) {
- return;
- }
- this.m_Slaves = new AbstractOptimizationProblem[nodesList.length];
- for (int i = 0; i < nodesList.length; i++) {
- this.m_Slaves[i] = (AbstractOptimizationProblem) RMIProxyRemoteThread.newInstance(this, nodesList[i]);
- }
- } else {
- // this is running on the local machine
- this.m_Slaves = new AbstractOptimizationProblem[this.m_LocalCPUs];
- for (int i = 0; i < this.m_LocalCPUs; i++) {
- this.m_Slaves[i] = (AbstractOptimizationProblem) this.clone();
- }
- }*/
}
-/**********************************************************************************************************************
- * These are for GUI
- */
/**
* This method returns a global info string
*
@@ -66,42 +37,28 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi
* @return The current optimzation mode
*/
public boolean getParallelize() {
- return this.m_Parallelize;
+ return this.parallelize;
}
public void setParallelize(boolean b) {
- this.m_Parallelize = b;
+ this.parallelize = b;
}
public String parallelizeTipText() {
return "Toggle between parallel and serial implementation.";
}
- /** This method allows you to managae the available servers
- * @return The current servers
- */
- /* public PropertyRemoteServers getServers() {
- return this.m_Servers;
- }
- public void setServers(PropertyRemoteServers b){
- this.m_Servers = b;
- }
- public String serversTipText() {
- return "Choose and manage the servers (only active in parallelized mode).";
- }
-*/
-
/**
* This method allows you to set the number of processors in local mode
*
* @param n Number of processors.
*/
public void setNumberLocalCPUs(int n) {
- this.m_LocalCPUs = n;
+ this.localCPUs = n;
}
public int getNumberLocalCPUs() {
- return this.m_LocalCPUs;
+ return this.localCPUs;
}
public String numberLocalCPUsTipText() {
diff --git a/src/eva2/optimization/problems/AbstractProblemInteger.java b/src/eva2/optimization/problems/AbstractProblemInteger.java
index 50205fa5..b2394de5 100644
--- a/src/eva2/optimization/problems/AbstractProblemInteger.java
+++ b/src/eva2/optimization/problems/AbstractProblemInteger.java
@@ -11,8 +11,8 @@ import eva2.optimization.strategies.InterfaceOptimizer;
*/
public abstract class AbstractProblemInteger extends AbstractOptimizationProblem implements java.io.Serializable {
- protected AbstractEAIndividual m_OverallBest = null;
- protected int m_ProblemDimension = 10;
+ protected AbstractEAIndividual bestIndividuum = null;
+ protected int problemDimension = 10;
public AbstractProblemInteger() {
initTemplate();
@@ -31,22 +31,22 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
if (o.template != null) {
template = (AbstractEAIndividual) o.template.clone();
}
- if (o.m_OverallBest != null) {
- m_OverallBest = (AbstractEAIndividual) ((AbstractEAIndividual) o.m_OverallBest).clone();
+ if (o.bestIndividuum != null) {
+ bestIndividuum = (AbstractEAIndividual) ((AbstractEAIndividual) o.bestIndividuum).clone();
}
- this.m_ProblemDimension = o.m_ProblemDimension;
+ this.problemDimension = o.problemDimension;
}
@Override
public void initializeProblem() {
initTemplate();
- this.m_OverallBest = null;
+ this.bestIndividuum = null;
}
@Override
public void initializePopulation(Population population) {
- this.m_OverallBest = null;
- ((InterfaceDataTypeInteger) this.template).setIntegerDataLength(this.m_ProblemDimension);
+ this.bestIndividuum = null;
+ ((InterfaceDataTypeInteger) this.template).setIntegerDataLength(this.problemDimension);
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
}
@@ -64,8 +64,8 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
// set the fitness of the individual
individual.SetFitness(i, fitness[i]);
}
- if ((this.m_OverallBest == null) || (this.m_OverallBest.getFitness(0) > individual.getFitness(0))) {
- this.m_OverallBest = (AbstractEAIndividual) individual.clone();
+ if ((this.bestIndividuum == null) || (this.bestIndividuum.getFitness(0) > individual.getFitness(0))) {
+ this.bestIndividuum = (AbstractEAIndividual) individual.clone();
}
}
@@ -120,11 +120,11 @@ public abstract class AbstractProblemInteger extends AbstractOptimizationProblem
* @param n The problem dimension
*/
public void setProblemDimension(int n) {
- this.m_ProblemDimension = n;
+ this.problemDimension = n;
}
public int getProblemDimension() {
- return this.m_ProblemDimension;
+ return this.problemDimension;
}
public String problemDimensionTipText() {
diff --git a/src/eva2/optimization/problems/B1Problem.java b/src/eva2/optimization/problems/B1Problem.java
index 230d3c29..62a22ab7 100644
--- a/src/eva2/optimization/problems/B1Problem.java
+++ b/src/eva2/optimization/problems/B1Problem.java
@@ -16,7 +16,7 @@ import java.util.BitSet;
*/
@Description("The task in this problem is to maximize the number of false bits in a BitSet.")
public class B1Problem extends AbstractProblemBinary implements java.io.Serializable {
- public int m_ProblemDimension = 30;
+ public int problemDimension = 30;
public B1Problem() {
super();
@@ -26,7 +26,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
public B1Problem(B1Problem b) {
super.cloneObjects(b);
- this.m_ProblemDimension = b.m_ProblemDimension;
+ this.problemDimension = b.problemDimension;
}
/**
@@ -73,7 +73,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
this.evaluate(individual);
String result = "Minimize Number of Bits problem:\n";
result += individual.getStringRepresentation() + "\n";
- result += "Scores " + (this.m_ProblemDimension - individual.getFitness(0)) + " zero bits!";
+ result += "Scores " + (this.problemDimension - individual.getFitness(0)) + " zero bits!";
return result;
}
@@ -90,7 +90,7 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
result += "Minimize Bits Problem:\n";
result += "The task is to reduce the number of TRUE Bits in the given bit string.\n";
result += "Parameters:\n";
- result += "Number of Bits: " + this.m_ProblemDimension + "\n";
+ result += "Number of Bits: " + this.problemDimension + "\n";
result += "Solution representation:\n";
//result += this.template.getSolutionRepresentationFor();
return result;
@@ -116,12 +116,12 @@ public class B1Problem extends AbstractProblemBinary implements java.io.Serializ
* @param dim The problem dimension.
*/
public void setProblemDimension(int dim) {
- this.m_ProblemDimension = dim;
+ this.problemDimension = dim;
}
@Override
public int getProblemDimension() {
- return this.m_ProblemDimension;
+ return this.problemDimension;
}
public String multiRunsTipText() {
diff --git a/src/eva2/optimization/problems/BKnapsackProblem.java b/src/eva2/optimization/problems/BKnapsackProblem.java
index 4a778e85..2b3db71b 100644
--- a/src/eva2/optimization/problems/BKnapsackProblem.java
+++ b/src/eva2/optimization/problems/BKnapsackProblem.java
@@ -15,11 +15,11 @@ import java.util.BitSet;
@Description("Maximize the value of the knapsack without exceeding the weight limit")
public class BKnapsackProblem extends AbstractProblemBinary implements java.io.Serializable {
- private int m_Limit = 5000;
- private double m_Punish = 2.0;
- private double m_LocalSearch = 0.0;
- private boolean m_Lamarckism = false;
- private double m_ProblemSpecificInit = 0.0;
+ private int limit = 5000;
+ private double punish = 2.0;
+ private double localSearch = 0.0;
+ private boolean lamarckism = false;
+ private double problemSpecificInit = 0.0;
static final int[][] items = {
{334, -328},
{303, -291},
@@ -130,10 +130,10 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
//AbstractOptimizationProblem
cloneObjects(b);
// BKnapsackProblem
- this.m_Limit = b.m_Limit;
- this.m_Punish = b.m_Punish;
- this.m_LocalSearch = b.m_LocalSearch;
- this.m_Lamarckism = b.m_Lamarckism;
+ this.limit = b.limit;
+ this.punish = b.punish;
+ this.localSearch = b.localSearch;
+ this.lamarckism = b.lamarckism;
}
@Override
@@ -161,7 +161,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
protected void initIndy(int k, AbstractEAIndividual indy) {
indy.init(this);
- if (RNG.flipCoin(this.m_ProblemSpecificInit)) {
+ if (RNG.flipCoin(this.problemSpecificInit)) {
BitSet tmpSet = new BitSet();
tmpSet.clear();
@@ -184,7 +184,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
tmpBitSet = ((InterfaceDataTypeBinary) individual).getBinaryData();
result = this.eval(tmpBitSet);
- if (RNG.flipCoin(this.m_LocalSearch)) {
+ if (RNG.flipCoin(this.localSearch)) {
// first remove surplus assets
while (result[1] > 0) {
// search for an element to replace
@@ -232,7 +232,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
}
for (int i = 0; i < items.length; i++) {
- if (items[i][0] < this.m_Limit - weight) {
+ if (items[i][0] < this.limit - weight) {
// possible candidate
if (stronger < 0) {
stronger = i;
@@ -249,7 +249,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
result = this.eval(tmpBitSet);
}
- if (this.m_Lamarckism) {
+ if (this.lamarckism) {
((InterfaceDataTypeBinary) individual).setBinaryGenotype(tmpBitSet);
}
}
@@ -285,8 +285,8 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
}
}
// write the solution
- result[1] = Math.max(0, result[1] - this.m_Limit);
- result[0] = (this.m_Punish * result[1]) + result[2];
+ result[1] = Math.max(0, result[1] - this.limit);
+ result[0] = (this.punish * result[1]) + result[2];
return result;
}
@@ -330,7 +330,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
result.append("Knapsack Problem:\n");
result.append("The task is to find a packing for a knapsack with limited size(");
- result.append(this.m_Limit);
+ result.append(this.limit);
result.append(") and maximal value.\n");
result.append("The default setting with limit=5000 allows a knapsack with value 5100. Note: value reads negative.");
result.append("Available items {(weight/value),...}: {");
@@ -344,7 +344,7 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
result.append("}\n");
result.append("Parameters:\n");
result.append("Punish rate: ");
- result.append(this.m_Punish);
+ result.append(this.punish);
result.append("\n");
result.append("Solution representation:\n");
//result += this.template.getSolutionRepresentationFor();
@@ -369,11 +369,11 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
* @param punish The number of multiruns that are to be performed
*/
public void setPunishment(double punish) {
- this.m_Punish = punish;
+ this.punish = punish;
}
public double getPunishment() {
- return this.m_Punish;
+ return this.punish;
}
public String punishmentTipText() {
@@ -405,11 +405,11 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
* @param b gives the chance of problemspecific initialization.
*/
public void setProblemSpecificInit(double b) {
- this.m_ProblemSpecificInit = b;
+ this.problemSpecificInit = b;
}
public double getProblemSpecificInit() {
- return this.m_ProblemSpecificInit;
+ return this.problemSpecificInit;
}
public String problemSpecificInitTipText() {
@@ -424,11 +424,11 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
* @param b gives the chance of problemspecific local search.
*/
public void setLocalSearch(double b) {
- this.m_LocalSearch = b;
+ this.localSearch = b;
}
public double getLocalSearch() {
- return this.m_LocalSearch;
+ return this.localSearch;
}
public String localSearchTipText() {
@@ -441,11 +441,11 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
* @param b toggles lamarckism.
*/
public void setLamarckism(boolean b) {
- this.m_Lamarckism = b;
+ this.lamarckism = b;
}
public boolean getLamarckism() {
- return this.m_Lamarckism;
+ return this.lamarckism;
}
public String lamarckismTipText() {
@@ -453,11 +453,11 @@ public class BKnapsackProblem extends AbstractProblemBinary implements java.io.S
}
public int getWeightLimit() {
- return m_Limit;
+ return limit;
}
public void setWeightLimit(int mLimit) {
- m_Limit = mLimit;
+ limit = mLimit;
}
public String weightLimitTipText() {
diff --git a/src/eva2/optimization/problems/ExternalRuntimeProblem.java b/src/eva2/optimization/problems/ExternalRuntimeProblem.java
index 447d7ede..5c3d19df 100644
--- a/src/eva2/optimization/problems/ExternalRuntimeProblem.java
+++ b/src/eva2/optimization/problems/ExternalRuntimeProblem.java
@@ -23,14 +23,14 @@ import java.util.List;
public class ExternalRuntimeProblem extends AbstractOptimizationProblem
implements Interface2DBorderProblem, InterfaceProblemDouble, InterfaceHasInitRange {
- protected AbstractEAIndividual m_OverallBest = null;
- protected int m_ProblemDimension = 10;
- protected String m_Command = "";
- protected String m_WorkingDir = "";
- PropertyDoubleArray m_Range = new PropertyDoubleArray(m_ProblemDimension, 2, -10, 10);
- PropertyDoubleArray m_initRange = new PropertyDoubleArray(m_ProblemDimension, 2, -10, 10);
+ protected AbstractEAIndividual bestIndividuum = null;
+ protected int problemDimension = 10;
+ protected String command = "";
+ protected String workingDir = "";
+ PropertyDoubleArray range = new PropertyDoubleArray(problemDimension, 2, -10, 10);
+ PropertyDoubleArray initializationRange = new PropertyDoubleArray(problemDimension, 2, -10, 10);
private String additionalArg = "";
- protected InterfaceMOSOConverter m_MosoConverter = new MOSONoConvert();
+ protected InterfaceMOSOConverter mosoConverter = new MOSONoConvert();
// Private Subclass to redirect Streams within an extra Thread to avoid dead
// locks
@@ -70,7 +70,7 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
public ExternalRuntimeProblem() {
this.template = new ESIndividualDoubleData();
- ((ESIndividualDoubleData) this.template).setDoubleDataLength(m_ProblemDimension);
+ ((ESIndividualDoubleData) this.template).setDoubleDataLength(problemDimension);
((ESIndividualDoubleData) this.template).setDoubleRange(makeRange());
}
@@ -80,27 +80,27 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
this.template = (AbstractEAIndividual) ((AbstractEAIndividual) b.template).clone();
}
//ExternalRuntimeProblem
- if (b.m_OverallBest != null) {
- this.m_OverallBest = (AbstractEAIndividual) ((AbstractEAIndividual) b.m_OverallBest).clone();
+ if (b.bestIndividuum != null) {
+ this.bestIndividuum = (AbstractEAIndividual) ((AbstractEAIndividual) b.bestIndividuum).clone();
}
- this.m_ProblemDimension = b.m_ProblemDimension;
- this.m_Command = b.m_Command;
- if (b.m_Range != null) {
- this.m_Range = (PropertyDoubleArray) b.m_Range.clone();
+ this.problemDimension = b.problemDimension;
+ this.command = b.command;
+ if (b.range != null) {
+ this.range = (PropertyDoubleArray) b.range.clone();
} else {
- this.m_Range = null;
+ this.range = null;
}
- if (b.m_initRange != null) {
- this.m_initRange = (PropertyDoubleArray) b.m_initRange.clone();
+ if (b.initializationRange != null) {
+ this.initializationRange = (PropertyDoubleArray) b.initializationRange.clone();
} else {
- this.m_initRange = null;
+ this.initializationRange = null;
}
- if (b.m_MosoConverter != null) {
- this.m_MosoConverter = (InterfaceMOSOConverter) b.m_MosoConverter.clone();
+ if (b.mosoConverter != null) {
+ this.mosoConverter = (InterfaceMOSOConverter) b.mosoConverter.clone();
} else {
- this.m_MosoConverter = null;
+ this.mosoConverter = null;
}
- this.m_WorkingDir = b.m_WorkingDir;
+ this.workingDir = b.workingDir;
}
/**
@@ -118,21 +118,21 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
*/
@Override
public void initializeProblem() {
- this.m_OverallBest = null;
- File f = new File(m_Command);
+ this.bestIndividuum = null;
+ File f = new File(command);
if (f.exists()) {
- m_Command = f.getAbsolutePath();
+ command = f.getAbsolutePath();
} else {
String sep = System.getProperty("file.separator");
- if (m_WorkingDir.endsWith(sep)) {
- f = new File(m_WorkingDir + m_Command);
+ if (workingDir.endsWith(sep)) {
+ f = new File(workingDir + command);
} else {
- f = new File(m_WorkingDir + sep + m_Command);
+ f = new File(workingDir + sep + command);
}
if (f.exists()) {
- m_Command = f.getAbsolutePath();
+ command = f.getAbsolutePath();
} else {
- System.err.println("Warning, " + this.getClass() + " could not find command " + m_Command + " in " + m_WorkingDir);
+ System.err.println("Warning, " + this.getClass() + " could not find command " + command + " in " + workingDir);
}
}
}
@@ -144,9 +144,9 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
*/
@Override
public void initializePopulation(Population population) {
- this.m_OverallBest = null;
+ this.bestIndividuum = null;
- ((InterfaceDataTypeDouble) this.template).setDoubleDataLength(this.m_ProblemDimension);
+ ((InterfaceDataTypeDouble) this.template).setDoubleDataLength(this.problemDimension);
((InterfaceDataTypeDouble) this.template).setDoubleRange(makeRange());
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
@@ -154,13 +154,13 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
@Override
public double[][] makeRange() {
- if (m_Range == null) {
+ if (range == null) {
System.err.println("Warning, range not set in ExternalRuntimeProblem.makeRange!");
}
- if (m_Range.getNumRows() != getProblemDimension()) {
+ if (range.getNumRows() != getProblemDimension()) {
System.err.println("Warning, problem dimension and range dimension dont match in ExternalRuntimeProblem.makeRange!");
}
- return m_Range.getDoubleArrayShallow().clone();
+ return range.getDoubleArrayShallow().clone();
}
public void setRange(double[][] range) {
@@ -174,14 +174,14 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
* @param range
*/
public void setRange(PropertyDoubleArray range) {
- if (range.getNumRows() < this.m_ProblemDimension) {
- System.err.println("Warning, expected range of dimension " + m_ProblemDimension + " in setRange!");
+ if (range.getNumRows() < this.problemDimension) {
+ System.err.println("Warning, expected range of dimension " + problemDimension + " in setRange!");
}
- m_Range.setDoubleArray(range.getDoubleArrayShallow());
+ this.range.setDoubleArray(range.getDoubleArrayShallow());
}
public PropertyDoubleArray getRange() {
- return m_Range;
+ return range;
}
public String rangeTipText() {
@@ -190,12 +190,12 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
@Override
public double getRangeLowerBound(int dim) {
- return m_Range.getValue(dim, 0);
+ return range.getValue(dim, 0);
}
@Override
public double getRangeUpperBound(int dim) {
- return m_Range.getValue(dim, 1);
+ return range.getValue(dim, 1);
}
@@ -217,16 +217,16 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
// if (this.m_UseTestConstraint) {
// if (x[0] < 1) individual.addConstraintViolation(1-x[0]);
// }
- if ((this.m_OverallBest == null) || (this.m_OverallBest.getFitness(0) > individual.getFitness(0))) {
- this.m_OverallBest = (AbstractEAIndividual) individual.clone();
+ if ((this.bestIndividuum == null) || (this.bestIndividuum.getFitness(0) > individual.getFitness(0))) {
+ this.bestIndividuum = (AbstractEAIndividual) individual.clone();
}
}
@Override
public void evaluatePopulationEnd(Population population) {
super.evaluatePopulationEnd(population);
- if (m_MosoConverter != null) {
- m_MosoConverter.convertMultiObjective2SingleObjective(population);
+ if (mosoConverter != null) {
+ mosoConverter.convertMultiObjective2SingleObjective(population);
}
}
@@ -292,22 +292,22 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
ArrayList fitList = new ArrayList();
List parameters = new ArrayList();
- parameters.add(this.m_Command);
+ parameters.add(this.command);
if (additionalArg != null && (additionalArg.length() > 0)) {
parameters.add(additionalArg);
}
- for (int i = 0; i < this.m_ProblemDimension; i++) {
+ for (int i = 0; i < this.problemDimension; i++) {
String p = prepareParameter(x, i);
parameters.add(p);
}
- List res = runProcess(parameters, m_WorkingDir);
+ List res = runProcess(parameters, workingDir);
try {
for (String str : res) {
fitList.add(new Double(str));
}
} catch (NumberFormatException e) {
- System.err.println("Error: " + m_Command + " delivered malformatted output for " + BeanInspector.toString(x));
+ System.err.println("Error: " + command + " delivered malformatted output for " + BeanInspector.toString(x));
e.printStackTrace();
}
double[] fit = new double[fitList.size()];
@@ -341,7 +341,7 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
sb.append("External Runtime Problem:\n");
sb.append("Here the individual codes a vector of real number x is to be minimized on a user given external problem.\nParameters:\n");
sb.append("Dimension : ");
- sb.append(this.m_ProblemDimension);
+ sb.append(this.problemDimension);
return sb.toString();
}
@@ -368,14 +368,14 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
* @param t Length of the x vector that is to be optimized
*/
public void setProblemDimension(int t) {
- this.m_ProblemDimension = t;
- this.m_Range.adaptRowCount(t);
- this.m_initRange.adaptRowCount(t);
+ this.problemDimension = t;
+ this.range.adaptRowCount(t);
+ this.initializationRange.adaptRowCount(t);
}
@Override
public int getProblemDimension() {
- return this.m_ProblemDimension;
+ return this.problemDimension;
}
public String problemDimensionTipText() {
@@ -388,11 +388,11 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
* @param t Length of the x vector at is to be optimized
*/
public void setCommand(String t) {
- this.m_Command = t;
+ this.command = t;
}
public String getCommand() {
- return this.m_Command;
+ return this.command;
}
public String commandTipText() {
@@ -405,11 +405,11 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
* @param t working directory
*/
public void setWorkingDirectory(String t) {
- this.m_WorkingDir = t;
+ this.workingDir = t;
}
public String getWorkingDirectory() {
- return this.m_WorkingDir;
+ return this.workingDir;
}
public String workingDirectoryTipText() {
@@ -417,11 +417,11 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
}
public InterfaceMOSOConverter getMosoConverter() {
- return m_MosoConverter;
+ return mosoConverter;
}
public void setMosoConverter(InterfaceMOSOConverter mMosoConverter) {
- m_MosoConverter = mMosoConverter;
+ mosoConverter = mMosoConverter;
}
public String mosoConverterTipText() {
@@ -472,13 +472,13 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
// @Override
@Override
public Object getInitRange() {
- if (m_initRange == null) {
- if (m_Range == null) {
+ if (initializationRange == null) {
+ if (range == null) {
System.err.println("Warning, neither range nor initRange has been set in ExternalRuntimeProblem!");
}
- return m_Range.getDoubleArrayShallow();
+ return range.getDoubleArrayShallow();
} else {
- return m_initRange.getDoubleArrayShallow();
+ return initializationRange.getDoubleArrayShallow();
}
}
@@ -488,14 +488,14 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
}
public void setInitialRange(PropertyDoubleArray range) {
- if (range.getNumRows() < this.m_ProblemDimension) {
- System.err.println("Warning, expected range of dimension " + m_ProblemDimension + " in setInitRange!");
+ if (range.getNumRows() < this.problemDimension) {
+ System.err.println("Warning, expected range of dimension " + problemDimension + " in setInitRange!");
}
- m_initRange = new PropertyDoubleArray(range);
+ initializationRange = new PropertyDoubleArray(range);
}
public PropertyDoubleArray getInitialRange() {
- return m_initRange;
+ return initializationRange;
}
public String initialRangeTipText() {
diff --git a/src/eva2/optimization/problems/F10Problem.java b/src/eva2/optimization/problems/F10Problem.java
index b550d97e..5bee6c4b 100644
--- a/src/eva2/optimization/problems/F10Problem.java
+++ b/src/eva2/optimization/problems/F10Problem.java
@@ -9,9 +9,9 @@ import eva2.util.annotation.Description;
@Description("Weierstrass-Mandelbrot Fractal Function")
public class F10Problem extends AbstractProblemDoubleOffset implements InterfaceMultimodalProblem, java.io.Serializable {
- private double m_D = 1.5;
- private double m_b = 2.3;
- private int m_Iterations = 20;
+ private double d = 1.5;
+ private double b = 2.3;
+ private int iterations = 20;
public F10Problem() {
this.template = new ESIndividualDoubleData();
@@ -19,9 +19,9 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
public F10Problem(F10Problem b) {
super(b);
- this.m_D = b.m_D;
- this.m_b = b.m_b;
- this.m_Iterations = b.m_Iterations;
+ this.d = b.d;
+ this.b = b.b;
+ this.iterations = b.iterations;
}
/**
@@ -48,7 +48,7 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
result[0] = yOffset;
for (int i = 0; i < x.length - 1; i++) {
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;
+ result[0] += ((this.calculateC(xi)) / (c1 * Math.pow(Math.abs(xi), 2 - this.d))) + Math.pow(xi, 2) - 1;
}
return result;
}
@@ -56,8 +56,8 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
private double calculateC(double x) {
double result = 0;
- for (int i = -this.m_Iterations; i < this.m_Iterations + 1; i++) {
- result += (1 - Math.cos(Math.pow(this.m_b, i) * x)) / (Math.pow(this.m_b, (2 - this.m_D) * i));
+ for (int i = -this.iterations; i < this.iterations + 1; i++) {
+ result += (1 - Math.cos(Math.pow(this.b, i) * x)) / (Math.pow(this.b, (2 - this.d) * i));
}
return result;
@@ -103,11 +103,11 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
if (d > 2) {
d = 2;
}
- this.m_D = d;
+ this.d = d;
}
public double getD() {
- return this.m_D;
+ return this.d;
}
public String dTipText() {
@@ -123,11 +123,11 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
if (b < 1.000001) {
b = 1.000001;
}
- this.m_b = b;
+ this.b = b;
}
public double getb() {
- return this.m_b;
+ return this.b;
}
public String bTipText() {
@@ -143,11 +143,11 @@ public class F10Problem extends AbstractProblemDoubleOffset implements Interface
if (iters < 2) {
iters = 2;
}
- this.m_Iterations = iters;
+ this.iterations = iters;
}
public int getIterations() {
- return this.m_Iterations;
+ return this.iterations;
}
public String iterationsTipText() {
diff --git a/src/eva2/optimization/problems/F11Problem.java b/src/eva2/optimization/problems/F11Problem.java
index 0ffa7fbf..83c12c5a 100644
--- a/src/eva2/optimization/problems/F11Problem.java
+++ b/src/eva2/optimization/problems/F11Problem.java
@@ -9,7 +9,7 @@ import eva2.util.annotation.Description;
@Description("Griewank Function")
public class F11Problem extends AbstractProblemDoubleOffset implements InterfaceMultimodalProblem, java.io.Serializable {
- private double m_D = 4000;
+ private double d = 4000;
public F11Problem() {
this.problemDimension = 10;
@@ -19,7 +19,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
public F11Problem(F11Problem b) {
super(b);
- this.m_D = b.m_D;
+ this.d = b.d;
}
/**
@@ -48,7 +48,7 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
result[0] += Math.pow(xi, 2);
tmpProd *= Math.cos((xi) / Math.sqrt(i + 1));
}
- result[0] = ((result[0] / this.m_D) - tmpProd + 1) + yOffset;
+ result[0] = ((result[0] / this.d) - tmpProd + 1) + yOffset;
return result;
}
@@ -88,11 +88,11 @@ public class F11Problem extends AbstractProblemDoubleOffset implements Interface
public void setD(double d) {
// if (d < 1) d = 1;// how can this be limited to [1,2] if 4000 is default?
// if (d > 2) d = 2;// MK FIXED: this obviously was a copy-paste error from F10
- this.m_D = d;
+ this.d = d;
}
public double getD() {
- return this.m_D;
+ return this.d;
}
public String dTipText() {
diff --git a/src/eva2/optimization/problems/F6Problem.java b/src/eva2/optimization/problems/F6Problem.java
index 159fbed1..0d0050e2 100644
--- a/src/eva2/optimization/problems/F6Problem.java
+++ b/src/eva2/optimization/problems/F6Problem.java
@@ -14,8 +14,8 @@ import java.io.Serializable;
@Description("Generalized Rastrigin's function.")
public class F6Problem extends AbstractProblemDoubleOffset
implements InterfaceMultimodalProblem, InterfaceFirstOrderDerivableProblem, InterfaceLocalSearchable, Serializable, InterfaceInterestingHistogram {
- private double m_A = 10;
- private double m_Omega = 2 * Math.PI;
+ private double a = 10;
+ private double omega = 2 * Math.PI;
private transient GradientDescentAlgorithm localSearchOptimizer = null;
public F6Problem() {
@@ -24,8 +24,8 @@ public class F6Problem extends AbstractProblemDoubleOffset
public F6Problem(F6Problem b) {
super(b);
- this.m_A = b.m_A;
- this.m_Omega = b.m_Omega;
+ this.a = b.a;
+ this.omega = b.omega;
}
public F6Problem(int dim) {
@@ -52,10 +52,10 @@ public class F6Problem extends AbstractProblemDoubleOffset
public double[] evaluate(double[] x) {
x = rotateMaybe(x);
double[] result = new double[1];
- result[0] = x.length * this.m_A + yOffset;
+ result[0] = x.length * this.a + yOffset;
for (int i = 0; i < x.length; i++) {
double xi = x[i] - xOffset;
- result[0] += Math.pow(xi, 2) - this.m_A * Math.cos(this.m_Omega * xi);
+ result[0] += Math.pow(xi, 2) - this.a * Math.cos(this.omega * xi);
}
return result;
}
@@ -67,7 +67,7 @@ public class F6Problem extends AbstractProblemDoubleOffset
for (int j = 0; j < x.length; j++) {
result[j] = 0;
double xj = x[j] - xOffset;
- result[j] += 2 * xj + this.m_Omega * this.m_A * Math.sin(this.m_Omega * xj);
+ result[j] += 2 * xj + this.omega * this.a * Math.sin(this.omega * xj);
}
return result;
}
@@ -106,11 +106,11 @@ public class F6Problem extends AbstractProblemDoubleOffset
* @param a The offset for the decision variables.
*/
public void setA(double a) {
- this.m_A = a;
+ this.a = a;
}
public double getA() {
- return this.m_A;
+ return this.a;
}
public String aTipText() {
@@ -124,11 +124,11 @@ public class F6Problem extends AbstractProblemDoubleOffset
* @param Omega The offset for the objective value.
*/
public void setOmega(double Omega) {
- this.m_Omega = Omega;
+ this.omega = Omega;
}
public double getOmega() {
- return this.m_Omega;
+ return this.omega;
}
public String omegaTipText() {
diff --git a/src/eva2/optimization/problems/F7Problem.java b/src/eva2/optimization/problems/F7Problem.java
index 648b3e07..fe6903c3 100644
--- a/src/eva2/optimization/problems/F7Problem.java
+++ b/src/eva2/optimization/problems/F7Problem.java
@@ -15,24 +15,24 @@ import java.io.Serializable;
@Description("Sphere Model, changing Environment.")
public class F7Problem extends AbstractProblemDoubleOffset implements Serializable {
- private double m_t = 250;
- private double m_Change = 4;
- protected SelectedTag m_TimeIntervalType;
- private int m_CurrentTimeStamp;
+ private double t = 250;
+ private double change = 4;
+ protected SelectedTag timeIntervalType;
+ private int currentTimeStamp;
public F7Problem() {
Tag[] tag = new Tag[2];
tag[0] = new Tag(0, "Function Calls");
tag[1] = new Tag(1, "Generation");
- this.m_TimeIntervalType = new SelectedTag(0, tag);
+ this.timeIntervalType = new SelectedTag(0, tag);
this.template = new ESIndividualDoubleData();
}
public F7Problem(F7Problem b) {
super(b);
- this.m_Change = b.m_Change;
- this.m_t = b.m_t;
- this.m_TimeIntervalType = (SelectedTag) b.m_TimeIntervalType.clone();
+ this.change = b.change;
+ this.t = b.t;
+ this.timeIntervalType = (SelectedTag) b.timeIntervalType.clone();
}
/**
@@ -59,10 +59,10 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
for (int i = 0; i < population.size(); i++) {
tmpIndy = (AbstractEAIndividual) population.get(i);
tmpIndy.resetConstraintViolation();
- if (this.m_TimeIntervalType.getSelectedTag().getID() == 0) {
- this.m_CurrentTimeStamp = population.getFunctionCalls();
+ if (this.timeIntervalType.getSelectedTag().getID() == 0) {
+ this.currentTimeStamp = population.getFunctionCalls();
} else {
- this.m_CurrentTimeStamp = population.getGeneration();
+ this.currentTimeStamp = population.getGeneration();
}
this.evaluate(tmpIndy);
population.incrFunctionCalls();
@@ -81,13 +81,13 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
x = rotateMaybe(x);
double[] result = new double[1];
result[0] = yOffset;
- if ((Math.floor(this.m_CurrentTimeStamp / this.m_t) % 2) == 0) {
+ if ((Math.floor(this.currentTimeStamp / this.t) % 2) == 0) {
for (int i = 0; i < x.length - 1; i++) {
result[0] += Math.pow(x[i] - xOffset, 2);
}
} else {
for (int i = 0; i < x.length - 1; i++) {
- result[0] += Math.pow(x[i] - xOffset - this.m_Change, 2);
+ result[0] += Math.pow(x[i] - xOffset - this.change, 2);
}
}
return result;
@@ -130,11 +130,11 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
if (d < 1) {
d = 1;
}
- this.m_t = d;
+ this.t = d;
}
public double gett() {
- return this.m_t;
+ return this.t;
}
public String tTipText() {
@@ -147,11 +147,11 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
* @param d The mutation operator.
*/
public void setChange(double d) {
- this.m_Change = d;
+ this.change = d;
}
public double getChange() {
- return this.m_Change;
+ return this.change;
}
public String changeTipText() {
@@ -164,11 +164,11 @@ public class F7Problem extends AbstractProblemDoubleOffset implements Serializab
* @param d The mutation operator.
*/
public void setTimeIntervalType(SelectedTag d) {
- this.m_TimeIntervalType = d;
+ this.timeIntervalType = d;
}
public SelectedTag getTimeIntervalType() {
- return this.m_TimeIntervalType;
+ return this.timeIntervalType;
}
public String timeIntervalTypeTipText() {
diff --git a/src/eva2/optimization/problems/F8Problem.java b/src/eva2/optimization/problems/F8Problem.java
index c4a5f237..49ea3382 100644
--- a/src/eva2/optimization/problems/F8Problem.java
+++ b/src/eva2/optimization/problems/F8Problem.java
@@ -20,8 +20,8 @@ public class F8Problem extends AbstractProblemDoubleOffset
implements InterfaceInterestingHistogram, InterfaceMultimodalProblem, //InterfaceFirstOrderDerivableProblem,
InterfaceMultimodalProblemKnown, java.io.Serializable {
- transient protected Population m_ListOfOptima = null;
- private static transient boolean state_initializing_optima = false;
+ transient protected Population listOfOptima = null;
+ private static transient boolean stateInitializingOptima = false;
private double a = 20;
private double b = 0.2;
private double c = 2 * Math.PI;
@@ -133,7 +133,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
@Override
public double getMaximumPeakRatio(Population pop) {
- return AbstractMultiModalProblemKnown.getMaximumPeakRatioMinimization(m_ListOfOptima, pop, getDefaultAccuracy(), 0, 5);
+ return AbstractMultiModalProblemKnown.getMaximumPeakRatioMinimization(listOfOptima, pop, getDefaultAccuracy(), 0, 5);
}
@Override
@@ -143,7 +143,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
@Override
public Population getRealOptima() {
- return m_ListOfOptima;
+ return listOfOptima;
}
@Override
@@ -172,8 +172,8 @@ public class F8Problem extends AbstractProblemDoubleOffset
@Override
public void initListOfOptima() {
if (listOfOptimaNeedsUpdate()) {
- state_initializing_optima = true;
- m_ListOfOptima = new Population();
+ stateInitializingOptima = true;
+ listOfOptima = new Population();
// ingeniously avoid recursive calls during refinement!
double[] pos = new double[getProblemDimension()];
Arrays.fill(pos, getXOffset());
@@ -192,7 +192,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
// ab dim 18/20 oder so finde ich plötzlich keine optima bei x[i]<1 mehr???
dir = inverseRotateMaybe(dir);
pos = refineSolution(this, pos, dir, 0.0005, 1e-20, 0);
- if (EuclideanMetric.euclideanDistance(pos, m_ListOfOptima.getEAIndividual(0).getDoublePosition()) < 0.5) {
+ if (EuclideanMetric.euclideanDistance(pos, listOfOptima.getEAIndividual(0).getDoublePosition()) < 0.5) {
System.err.println("Warning, possibly converged to a wrong optimum in F8Problem.initListOfOptima!");
}
pos = rotateMaybe(pos);
@@ -204,7 +204,7 @@ public class F8Problem extends AbstractProblemDoubleOffset
}
}
}
- state_initializing_optima = false;
+ stateInitializingOptima = false;
}
}
@@ -237,13 +237,13 @@ public class F8Problem extends AbstractProblemDoubleOffset
}
private boolean listOfOptimaNeedsUpdate() {
- if (state_initializing_optima) {
+ if (stateInitializingOptima) {
return false;
} // avoid recursive call during refining with GDA
- if (m_ListOfOptima == null || (m_ListOfOptima.size() != (1 + 2 * getProblemDimension()))) {
+ if (listOfOptima == null || (listOfOptima.size() != (1 + 2 * getProblemDimension()))) {
return true;
} else { // the number of optima is corret - now check different offset or rotation by comparing one fitness value
- AbstractEAIndividual indy = m_ListOfOptima.getEAIndividual(1);
+ AbstractEAIndividual indy = listOfOptima.getEAIndividual(1);
double[] curFit = evaluate(indy.getDoublePosition());
if (Math.abs(Mathematics.dist(curFit, indy.getFitness(), 2)) > 1e-10) {
return true;
@@ -254,6 +254,6 @@ public class F8Problem extends AbstractProblemDoubleOffset
}
private void addOptimum(double[] pos) {
- AbstractProblemDouble.addUnrotatedOptimum(m_ListOfOptima, this, pos);
+ AbstractProblemDouble.addUnrotatedOptimum(listOfOptima, this, pos);
}
}
\ No newline at end of file
diff --git a/src/eva2/optimization/problems/FLensProblem.java b/src/eva2/optimization/problems/FLensProblem.java
index 17e60478..6bf235e1 100644
--- a/src/eva2/optimization/problems/FLensProblem.java
+++ b/src/eva2/optimization/problems/FLensProblem.java
@@ -23,8 +23,8 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
Population indiesToPaint = new Population();
// private double[] m_BestVariables;
// private double m_BestFitness;
- private int m_Height, m_Width;
- FLensProblem m_LensProblem;
+ private int theHeight, theWidth;
+ FLensProblem lensProblem;
public MyLensViewer(FLensProblem f) {
initView(f);
@@ -36,13 +36,11 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
@Override
public void initView(AbstractOptimizationProblem prob) {
- this.m_LensProblem = (FLensProblem) prob;
+ this.lensProblem = (FLensProblem) prob;
}
@Override
public void resetView() {
-// this.m_BestFitness = Double.POSITIVE_INFINITY;
-// this.m_BestVariables = new double[10];
ESIndividualDoubleData dummy = new ESIndividualDoubleData();
dummy.setFitness(new double[]{Double.POSITIVE_INFINITY});
indiesToPaint = new Population();
@@ -68,8 +66,8 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
}
// Create a buffered image in which to draw
// try {
-// this.m_Height = (int)g.getClipBounds().getHeight();
-// this.m_Width = (int)g.getClipBounds().getWidth();
+// this.theHeight = (int)g.getClipBounds().getHeight();
+// this.theWidth = (int)g.getClipBounds().getWidth();
// this.m_CenterX = (int)g.getClipBounds().getCenterX();
// this.m_CenterY = (int)g.getClipBounds().getCenterY();
// } catch (java.lang.NullPointerException npe) {
@@ -77,34 +75,34 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
// }
// This might cure the eternal display problems: just ignore clipping and leave it up to swing
Dimension winDim = getSize();
- m_Height = winDim.height;
- m_Width = winDim.width;
-// m_CenterX = m_Width/2;
-// m_CenterY = m_Height/2;
+ theHeight = winDim.height;
+ theWidth = winDim.width;
+// m_CenterX = theWidth/2;
+// m_CenterY = theHeight/2;
-// if (this.m_Height == 0) this.m_Height = 250;
-// if (this.m_Width == 0) this.m_Width = 350;
-// System.out.println(" h w cx cy " + m_Height + " " + m_Width + " " + m_CenterX + " " + m_CenterY );
- bufferedImage = new BufferedImage(this.m_Width, this.m_Height, BufferedImage.TYPE_INT_RGB);
+// if (this.theHeight == 0) this.theHeight = 250;
+// if (this.theWidth == 0) this.theWidth = 350;
+// System.out.println(" h w cx cy " + theHeight + " " + theWidth + " " + m_CenterX + " " + m_CenterY );
+ bufferedImage = new BufferedImage(this.theWidth, this.theHeight, BufferedImage.TYPE_INT_RGB);
// Create a graphics contents on the buffered image
Graphics2D g2D = bufferedImage.createGraphics();
g2D.setPaint(Color.white);
- tmpShape = new Rectangle(0, 0, this.m_Width, this.m_Height);
+ tmpShape = new Rectangle(0, 0, this.theWidth, this.theHeight);
g2D.fill(tmpShape);
// now start to plot some interesting stuff
//draw the mid line
g2D.setPaint(Color.black);
- g2D.drawLine(0, this.m_Height / 2, this.m_Width, this.m_Height / 2);
+ g2D.drawLine(0, this.theHeight / 2, this.theWidth, this.theHeight / 2);
centerLens = 5 + 50;
- centerScreen = centerLens + (int) this.m_LensProblem.focalLength * 10;
- segment = 10 * (int) this.m_LensProblem.radius * 2 / (this.m_LensProblem.problemDimension - 1);
+ centerScreen = centerLens + (int) this.lensProblem.focalLength * 10;
+ segment = 10 * (int) this.lensProblem.radius * 2 / (this.lensProblem.problemDimension - 1);
g2D.setStroke(dashStroke);
- g2D.drawLine(centerLens, this.m_Height / 2 + (int) this.m_LensProblem.radius * 10, centerLens, this.m_Height / 2 - (int) this.m_LensProblem.radius * 10);
- g2D.drawLine(centerScreen, this.m_Height / 2 + (int) this.m_LensProblem.radius * 10 + 10, centerScreen, this.m_Height / 2 - (int) this.m_LensProblem.radius * 10 - 10);
+ g2D.drawLine(centerLens, this.theHeight / 2 + (int) this.lensProblem.radius * 10, centerLens, this.theHeight / 2 - (int) this.lensProblem.radius * 10);
+ g2D.drawLine(centerScreen, this.theHeight / 2 + (int) this.lensProblem.radius * 10 + 10, centerScreen, this.theHeight / 2 - (int) this.lensProblem.radius * 10 - 10);
g2D.setStroke(ds);
// System.out.println("indies to paint: " + indiesToPaint.size());
- paintLens(m_LensProblem.problemDimension, m_Height, m_LensProblem.radius, mag, centerLens, centerScreen, segment, g2D);
+ paintLens(lensProblem.problemDimension, theHeight, lensProblem.radius, mag, centerLens, centerScreen, segment, g2D);
// Now put everything on the screen
g.drawImage(bufferedImage, 0, 0, this);
}
@@ -112,13 +110,13 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
private void paintLens(int dim, int height, double radius, int mag, int centerLens, int centerScreen, int segment, Graphics2D g2D) {
for (int i = 0; i < indiesToPaint.size(); i++) {
AbstractEAIndividual indy = indiesToPaint.getEAIndividual(i);
- paintLens(indy.getDoublePosition(), m_LensProblem.testLens(indy.getDoublePosition()), indy.getFitness(0), dim, height, radius, mag, centerLens, centerScreen, segment, g2D);
+ paintLens(indy.getDoublePosition(), lensProblem.testLens(indy.getDoublePosition()), indy.getFitness(0), dim, height, radius, mag, centerLens, centerScreen, segment, g2D);
}
}
private void paintLens(AbstractEAIndividual indy, int dim, int height, double radius, int mag, int centerLens, int centerScreen, int segment, Graphics2D g2D) {
if (indy != null) {
- paintLens(indy.getDoublePosition(), m_LensProblem.testLens(indy.getDoublePosition()), indy.getFitness(0), dim, height, radius, mag, centerLens, centerScreen, segment, g2D);
+ paintLens(indy.getDoublePosition(), lensProblem.testLens(indy.getDoublePosition()), indy.getFitness(0), dim, height, radius, mag, centerLens, centerScreen, segment, g2D);
}
}
@@ -145,12 +143,12 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
g2D.drawLine(centerLens, currentXPos + segment / 2, centerScreen, height / 2 + (int) (dots[i - 1] * mag));
currentXPos += segment;
-// tmpShape = new Rectangle(currentPos-width/2, this.m_Height/2, width, (int)(variables[i]*10));
+// tmpShape = new Rectangle(currentPos-width/2, this.theHeight/2, width, (int)(variables[i]*10));
// g2D.setPaint(Color.red);
// g2D.fill(tmpShape);
// g2D.setPaint(Color.black);
// g2D.draw(tmpShape);
-// g2D.drawLine(currentPos, this.m_Height/2+5, currentPos, this.m_Height/2-5);
+// g2D.drawLine(currentPos, this.theHeight/2+5, currentPos, this.theHeight/2-5);
}
}
@@ -164,7 +162,7 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
if (showAllIfPossible) {
// indiesToPaint=population;
for (int i = 0; i < pop.size(); i++) {
- MyLensViewer newView = new MyLensViewer(m_LensProblem);
+ MyLensViewer newView = new MyLensViewer(lensProblem);
Population newPop = new Population();
newPop.add(pop.getEAIndividual(i));
@@ -208,7 +206,7 @@ public class FLensProblem extends AbstractOptimizationProblem
protected double noise = 0.0;
protected double xOffset = 0.0;
protected double yOffset = 0.0;
- transient protected boolean m_Show = false;
+ transient protected boolean show = false;
//protected int sleepTime = 0;
transient private JFrame problemFrame;
@@ -220,7 +218,7 @@ public class FLensProblem extends AbstractOptimizationProblem
public FLensProblem() {
this.template = new ESIndividualDoubleData();
- if (this.m_Show) {
+ if (this.show) {
this.initProblemFrame();
}
}
@@ -294,7 +292,7 @@ public class FLensProblem extends AbstractOptimizationProblem
@Override
public void initializeProblem() {
this.overallBest = null;
- if (this.m_Show) {
+ if (this.show) {
this.initProblemFrame();
}
}
@@ -317,14 +315,14 @@ public class FLensProblem extends AbstractOptimizationProblem
((InterfaceDataTypeDouble) this.template).setDoubleRange(range);
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
- if (this.m_Show) {
+ if (this.show) {
this.initProblemFrame();
}
}
@Override
public void evaluatePopulationEnd(Population pop) {
- if (this.m_Show) {
+ if (this.show) {
this.updateProblemFrame(pop);
}
}
@@ -402,13 +400,13 @@ public class FLensProblem extends AbstractOptimizationProblem
* @return double[]
*/
public double[] testLens(double[] x) {
- double m_SegmentHight = 2 * radius / (x.length - 1);
+ double segmentHeight = 2 * radius / (x.length - 1);
double[] result = new double[x.length - 1];
// Computation of fitness. Uses an approximation for very thin lenses.
// 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++) {
- result[i - 1] = radius - m_SegmentHight / 2 - m_SegmentHight * (i - 1) - focalLength / m_SegmentHight * (epsilon - 1) * (x[i] - x[i - 1]);
+ result[i - 1] = radius - segmentHeight / 2 - segmentHeight * (i - 1) - focalLength / segmentHeight * (epsilon - 1) * (x[i] - x[i - 1]);
}
return result;
}
@@ -581,8 +579,8 @@ public class FLensProblem extends AbstractOptimizationProblem
* @param show Whether to show the result or not
*/
public void setShow(boolean show) {
- this.m_Show = show;
- if (this.m_Show) {
+ this.show = show;
+ if (this.show) {
this.initProblemFrame();
} else {
this.disposeProblemFrame();
@@ -590,7 +588,7 @@ public class FLensProblem extends AbstractOptimizationProblem
}
public boolean getShow() {
- return this.m_Show;
+ return this.show;
}
public String showTipText() {
diff --git a/src/eva2/optimization/problems/I1Problem.java b/src/eva2/optimization/problems/I1Problem.java
index 43eabe1c..0c4e29ea 100644
--- a/src/eva2/optimization/problems/I1Problem.java
+++ b/src/eva2/optimization/problems/I1Problem.java
@@ -57,7 +57,7 @@ public class I1Problem extends AbstractProblemInteger implements java.io.Seriali
result += "I1 Problem:\n";
result += "Here the individual codes a vector of int numbers x and F1(x)= x^2 is to be minimized.\n";
result += "Parameters:\n";
- result += "Dimension : " + this.m_ProblemDimension + "\n";
+ result += "Dimension : " + this.problemDimension + "\n";
result += "Solution representation:\n";
return result;
}
diff --git a/src/eva2/optimization/problems/PSymbolicRegression.java b/src/eva2/optimization/problems/PSymbolicRegression.java
index 72178f25..b19765f4 100644
--- a/src/eva2/optimization/problems/PSymbolicRegression.java
+++ b/src/eva2/optimization/problems/PSymbolicRegression.java
@@ -20,22 +20,22 @@ import java.io.Serializable;
@Description("The task is to infer the equation of a system that can only be observed at a number of checkpoints.")
public class PSymbolicRegression extends AbstractOptimizationProblem implements InterfaceProgramProblem, InterfaceAdditionalPopulationInformer, Serializable {
- private double[] m_X = new double[1];
- private int m_NumberOfConstants = 3;
- private double m_LowerBound = -1;
- private double m_UpperBound = 1;
- private int m_NumberOfCheckPoints = 20;
- transient private InterfaceRegressionFunction m_TargetFunction = new RFKoza_GPI_7_3();
- private double[] m_C = new double[m_NumberOfConstants];
- private boolean m_UseInnerConst = false;
- private boolean m_UseLocalHillClimbing = false;
- private GPArea m_GPArea = new GPArea();
- protected AbstractEAIndividual m_OverallBest = null;
- protected double m_Noise = 0.0;
+ private double[] x = new double[1];
+ private int numberOfConstants = 3;
+ private double lowerBound = -1;
+ private double upperBound = 1;
+ private int numberOfCheckPoints = 20;
+ transient private InterfaceRegressionFunction targetFunction = new RFKoza_GPI_7_3();
+ private double[] constants = new double[numberOfConstants];
+ private boolean useInnerConst = false;
+ private boolean useLocalHillClimbing = false;
+ private GPArea gpArea = new GPArea();
+ protected AbstractEAIndividual overallBestIndividuum = null;
+ protected double noise = 0.0;
// This is graphics stuff
- transient private Plot m_Plot;
- private boolean m_Show = false;
+ transient private Plot plot;
+ private boolean show = false;
public PSymbolicRegression() {
this.template = new GPIndividualProgramData();
@@ -49,35 +49,35 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
this.template = (AbstractEAIndividual) ((AbstractEAIndividual) b.template).clone();
}
//F1Problem
- if (b.m_OverallBest != null) {
- this.m_OverallBest = (AbstractEAIndividual) ((AbstractEAIndividual) b.m_OverallBest).clone();
+ if (b.overallBestIndividuum != null) {
+ this.overallBestIndividuum = (AbstractEAIndividual) ((AbstractEAIndividual) b.overallBestIndividuum).clone();
}
- if (b.m_GPArea != null) {
- this.m_GPArea = (GPArea) b.m_GPArea.clone();
+ if (b.gpArea != null) {
+ this.gpArea = (GPArea) b.gpArea.clone();
}
- if (b.m_TargetFunction != null) {
- this.m_TargetFunction = (InterfaceRegressionFunction) b.m_TargetFunction.clone();
+ if (b.targetFunction != null) {
+ this.targetFunction = (InterfaceRegressionFunction) b.targetFunction.clone();
}
- if (b.m_X != null) {
- this.m_X = new double[b.m_X.length];
- for (int i = 0; i < this.m_X.length; i++) {
- this.m_X[i] = b.m_X[i];
+ if (b.x != null) {
+ this.x = new double[b.x.length];
+ for (int i = 0; i < this.x.length; i++) {
+ this.x[i] = b.x[i];
}
}
- if (b.m_C != null) {
- this.m_C = new double[b.m_C.length];
- for (int i = 0; i < this.m_C.length; i++) {
- this.m_C[i] = b.m_C[i];
+ if (b.constants != null) {
+ this.constants = new double[b.constants.length];
+ for (int i = 0; i < this.constants.length; i++) {
+ this.constants[i] = b.constants[i];
}
}
- this.m_Noise = b.m_Noise;
- this.m_UseInnerConst = b.m_UseInnerConst;
- this.m_UseLocalHillClimbing = b.m_UseLocalHillClimbing;
- this.m_NumberOfConstants = b.m_NumberOfConstants;
- this.m_LowerBound = b.m_LowerBound;
- this.m_UpperBound = b.m_UpperBound;
- this.m_NumberOfCheckPoints = b.m_NumberOfCheckPoints;
- this.m_LowerBound = b.m_LowerBound;
+ this.noise = b.noise;
+ this.useInnerConst = b.useInnerConst;
+ this.useLocalHillClimbing = b.useLocalHillClimbing;
+ this.numberOfConstants = b.numberOfConstants;
+ this.lowerBound = b.lowerBound;
+ this.upperBound = b.upperBound;
+ this.numberOfCheckPoints = b.numberOfCheckPoints;
+ this.lowerBound = b.lowerBound;
}
/**
@@ -95,13 +95,13 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
*/
@Override
public void initializeProblem() {
- if (m_TargetFunction == null) {
- m_TargetFunction = new RFKoza_GPI_7_3();
+ if (targetFunction == null) {
+ targetFunction = new RFKoza_GPI_7_3();
}
- this.m_OverallBest = null;
- this.m_C = new double[this.m_NumberOfConstants];
- for (int i = 0; i < this.m_C.length; i++) {
- this.m_C[i] = RNG.randomDouble(-10, 10);
+ this.overallBestIndividuum = null;
+ this.constants = new double[this.numberOfConstants];
+ for (int i = 0; i < this.constants.length; i++) {
+ this.constants[i] = RNG.randomDouble(-10, 10);
}
}
@@ -111,34 +111,34 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
*/
private void compileArea() {
// unfortunately this must be cloned or the GUI wont update.
- GPArea oldArea = m_GPArea;
- m_GPArea = new GPArea();
+ GPArea oldArea = gpArea;
+ gpArea = new GPArea();
- if (m_GPArea.isEmpty()) {
- this.m_GPArea.add2CompleteList(new GPNodeOne());
- this.m_GPArea.add2CompleteList(new GPNodePi(), false);
- this.m_GPArea.add2CompleteList(new GPNodeAdd());
- this.m_GPArea.add2CompleteList(new GPNodeSub());
- this.m_GPArea.add2CompleteList(new GPNodeDiv());
- this.m_GPArea.add2CompleteList(new GPNodeMult());
- this.m_GPArea.add2CompleteList(new GPNodeAbs(), false);
- this.m_GPArea.add2CompleteList(new GPNodeSin(), false);
- this.m_GPArea.add2CompleteList(new GPNodeCos(), false);
- this.m_GPArea.add2CompleteList(new GPNodeExp(), false);
- this.m_GPArea.add2CompleteList(new GPNodeSqrt(), false);
- this.m_GPArea.add2CompleteList(new GPNodePow2(), false);
- this.m_GPArea.add2CompleteList(new GPNodePow3(), false);
- for (int i = 0; i < this.m_X.length; i++) {
- this.m_GPArea.add2CompleteList(new GPNodeInput("X" + i));
+ if (gpArea.isEmpty()) {
+ this.gpArea.add2CompleteList(new GPNodeOne());
+ this.gpArea.add2CompleteList(new GPNodePi(), false);
+ this.gpArea.add2CompleteList(new GPNodeAdd());
+ this.gpArea.add2CompleteList(new GPNodeSub());
+ this.gpArea.add2CompleteList(new GPNodeDiv());
+ this.gpArea.add2CompleteList(new GPNodeMult());
+ this.gpArea.add2CompleteList(new GPNodeAbs(), false);
+ this.gpArea.add2CompleteList(new GPNodeSin(), false);
+ this.gpArea.add2CompleteList(new GPNodeCos(), false);
+ this.gpArea.add2CompleteList(new GPNodeExp(), false);
+ this.gpArea.add2CompleteList(new GPNodeSqrt(), false);
+ this.gpArea.add2CompleteList(new GPNodePow2(), false);
+ this.gpArea.add2CompleteList(new GPNodePow3(), false);
+ for (int i = 0; i < this.x.length; i++) {
+ this.gpArea.add2CompleteList(new GPNodeInput("X" + i));
}
- for (int i = 0; i < this.m_C.length; i++) {
- this.m_GPArea.add2CompleteList(new GPNodeInput("C" + i), false);
+ for (int i = 0; i < this.constants.length; i++) {
+ this.gpArea.add2CompleteList(new GPNodeInput("C" + i), false);
}
}
- if ((oldArea != null) && (oldArea.getBlackList() != null) && (oldArea.getBlackList().size() == m_GPArea.getBlackList().size())) {
- m_GPArea.SetBlackList(oldArea.getBlackList());
+ if ((oldArea != null) && (oldArea.getBlackList() != null) && (oldArea.getBlackList().size() == gpArea.getBlackList().size())) {
+ gpArea.SetBlackList(oldArea.getBlackList());
}
- this.m_GPArea.compileReducedList();
+ this.gpArea.compileReducedList();
}
/**
@@ -148,7 +148,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
*/
@Override
public void initializePopulation(Population population) {
- initPopulation(population, this, m_UseInnerConst, m_NumberOfConstants);
+ initPopulation(population, this, useInnerConst, numberOfConstants);
}
/**
@@ -174,8 +174,8 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* This method init the enviroment panel if necessary.
*/
private void initEnvironmentPanel() {
- if (this.m_Plot == null) {
- this.m_Plot = new Plot("Symbolic Regression", "x", "y", true);
+ if (this.plot == null) {
+ this.plot = new Plot("Symbolic Regression", "x", "y", true);
}
}
@@ -193,7 +193,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
for (int i = 0; i < population.size(); i++) {
tmpIndy = (AbstractEAIndividual) population.get(i);
tmpIndy.resetConstraintViolation();
- if ((this.m_UseLocalHillClimbing) && (tmpIndy instanceof GAPIndividualProgramData)) {
+ if ((this.useLocalHillClimbing) && (tmpIndy instanceof GAPIndividualProgramData)) {
AbstractEAIndividual tmpBestConst = (AbstractEAIndividual) ((GAPIndividualProgramData) tmpIndy).getNumbers();
AbstractEAIndividual tmpConst;
this.evaluate(tmpIndy);
@@ -213,7 +213,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
((GAPIndividualProgramData) tmpIndy).setNumbers((InterfaceDataTypeDouble) tmpBestConst);
tmpIndy.SetFitness(0, tmpBestConst.getFitness(0));
} else {
- if (m_UseLocalHillClimbing) {
+ if (useLocalHillClimbing) {
EVAERROR.errorMsgOnce("Error: local hill climbing only works on GAPIndividualProgramData individuals!");
}
this.evaluate(tmpIndy);
@@ -237,40 +237,40 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
tmpIndy = (InterfaceDataTypeProgram) individual;
program = tmpIndy.getProgramData()[0];
- if ((tmpIndy instanceof GAPIndividualProgramData) && (this.m_UseInnerConst)) {
- this.m_C = ((GAPIndividualProgramData) tmpIndy).getDoubleData();
+ if ((tmpIndy instanceof GAPIndividualProgramData) && (this.useInnerConst)) {
+ this.constants = ((GAPIndividualProgramData) tmpIndy).getDoubleData();
}
fitness = 0;
- for (int j = 0; j < this.m_NumberOfCheckPoints; j++) {
- setCheckPoint(m_X, j);
+ for (int j = 0; j < this.numberOfCheckPoints; j++) {
+ setCheckPoint(x, j);
tmpValue = ((Double) program.evaluate(this)).doubleValue();
- fitness += Math.pow((this.m_TargetFunction.evaluateFunction(this.m_X) - ((Double) program.evaluate(this)).doubleValue()), 2);
+ fitness += Math.pow((this.targetFunction.evaluateFunction(this.x) - ((Double) program.evaluate(this)).doubleValue()), 2);
}
- fitness /= (double) this.m_NumberOfCheckPoints;
+ fitness /= (double) this.numberOfCheckPoints;
// add noise to the fitness
- fitness += RNG.gaussianDouble(this.m_Noise);
+ fitness += RNG.gaussianDouble(this.noise);
// set the fitness of the individual
individual.SetFitness(0, fitness);
- if ((this.m_Plot != null) && (this.m_Plot.getFunctionArea().getContainerSize() == 0)) {
- this.m_OverallBest = null;
+ if ((this.plot != null) && (this.plot.getFunctionArea().getContainerSize() == 0)) {
+ this.overallBestIndividuum = null;
}
- if ((this.m_OverallBest == null) || (this.m_OverallBest.getFitness(0) > individual.getFitness(0))) {
- this.m_OverallBest = (AbstractEAIndividual) individual.clone();
- if (this.m_Show) {
- if (m_Plot == null) {
+ if ((this.overallBestIndividuum == null) || (this.overallBestIndividuum.getFitness(0) > individual.getFitness(0))) {
+ this.overallBestIndividuum = (AbstractEAIndividual) individual.clone();
+ if (this.show) {
+ if (plot == null) {
this.initEnvironmentPanel();
}
- this.m_Plot.clearAll();
- program = ((InterfaceDataTypeProgram) this.m_OverallBest).getProgramData()[0];
- for (int i = 0; i < this.m_NumberOfCheckPoints; i++) {
- setCheckPoint(m_X, i);
+ this.plot.clearAll();
+ program = ((InterfaceDataTypeProgram) this.overallBestIndividuum).getProgramData()[0];
+ for (int i = 0; i < this.numberOfCheckPoints; i++) {
+ setCheckPoint(x, i);
tmpValue = ((Double) program.evaluate(this)).doubleValue();
- this.m_Plot.setConnectedPoint(this.m_X[0], tmpValue, 0);
- tmpValue = this.m_TargetFunction.evaluateFunction(this.m_X);
- this.m_Plot.setConnectedPoint(this.m_X[0], tmpValue, 1);
- this.m_Plot.setInfoString(1, program.getStringRepresentation(), 1.0f);
+ this.plot.setConnectedPoint(this.x[0], tmpValue, 0);
+ tmpValue = this.targetFunction.evaluateFunction(this.x);
+ this.plot.setConnectedPoint(this.x[0], tmpValue, 1);
+ this.plot.setInfoString(1, program.getStringRepresentation(), 1.0f);
}
}
}
@@ -284,7 +284,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
*/
private void setCheckPoint(double[] x, int j) {
for (int i = 0; i < x.length; i++) {
- x[i] = this.m_LowerBound + (j * (this.m_UpperBound - this.m_LowerBound) / (this.m_NumberOfCheckPoints - 1));
+ x[i] = this.lowerBound + (j * (this.upperBound - this.lowerBound) / (this.numberOfCheckPoints - 1));
}
}
@@ -312,8 +312,8 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
*/
@Override
public Object getSensorValue(String sensor) {
- return PSymbolicRegression.getSensorValue(sensor, m_X, m_C);
-// for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]);
+ return PSymbolicRegression.getSensorValue(sensor, x, constants);
+// for (int i = 0; i < this.x.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.x[i]);
// for (int i = 0; i < this.c.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.c[i]);
// return new Double(0);
}
@@ -350,7 +350,7 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
} else {
return new Double(0);
}
-// for (int i = 0; i < this.m_X.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.m_X[i]);
+// for (int i = 0; i < this.x.length; i++) if (sensor.equalsIgnoreCase("X"+i)) return new Double(this.x[i]);
// for (int i = 0; i < this.c.length; i++) if (sensor.equalsIgnoreCase("C"+i)) return new Double(this.c[i]);
// return new Double(0);
}
@@ -390,11 +390,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
if (noise < 0) {
noise = 0;
}
- this.m_Noise = noise;
+ this.noise = noise;
}
public double getNoise() {
- return this.m_Noise;
+ return this.noise;
}
public String noiseTipText() {
@@ -407,11 +407,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param b The flag to use inner constants.
*/
public void setUseInnerConst(boolean b) {
- this.m_UseInnerConst = b;
+ this.useInnerConst = b;
}
public boolean getUseInnerConst() {
- return this.m_UseInnerConst;
+ return this.useInnerConst;
}
public String useInnerConstTipText() {
@@ -424,11 +424,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param b The flag to use local hill climbing for inner constants.
*/
public void setUseLocalHillClimbing(boolean b) {
- this.m_UseLocalHillClimbing = b;
+ this.useLocalHillClimbing = b;
}
public boolean getUseLocalHillClimbing() {
- return this.m_UseLocalHillClimbing;
+ return this.useLocalHillClimbing;
}
public String useLocalHillClimbingTipText() {
@@ -441,14 +441,14 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param b The new number of ephremial constants.
*/
public void setNumberOfConstants(int b) {
- this.m_NumberOfConstants = b;
+ this.numberOfConstants = b;
this.initializeProblem();
- m_GPArea.clear();
+ gpArea.clear();
this.compileArea();
}
public int getNumberOfConstants() {
- return this.m_NumberOfConstants;
+ return this.numberOfConstants;
}
public String numberOfConstantsTipText() {
@@ -464,11 +464,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
if (b < 0) {
b = 1;
}
- this.m_NumberOfCheckPoints = b;
+ this.numberOfCheckPoints = b;
}
public int getNumberOfCheckPoints() {
- return this.m_NumberOfCheckPoints;
+ return this.numberOfCheckPoints;
}
public String numberOfCheckPointsTipText() {
@@ -481,19 +481,19 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param i Number of maximal steps.
*/
public void setArea(GPArea i) {
- this.m_GPArea = i;
+ this.gpArea = i;
GPArea tmpArea[] = new GPArea[1];
- tmpArea[0] = this.m_GPArea;
+ tmpArea[0] = this.gpArea;
((InterfaceDataTypeProgram) this.template).setProgramDataLength(1);
((InterfaceDataTypeProgram) this.template).SetFunctionArea(tmpArea);
}
@Override
public GPArea getArea() {
- if (m_GPArea == null) {
+ if (gpArea == null) {
initializeProblem();
}
- return this.m_GPArea;
+ return this.gpArea;
}
public String areaTipText() {
@@ -506,17 +506,17 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param b True if the path is to be shown.
*/
public void setShowResult(boolean b) {
- this.m_Show = b;
- if (this.m_Show) {
+ this.show = b;
+ if (this.show) {
this.initEnvironmentPanel();
- } else if (this.m_Plot != null) {
- this.m_Plot.dispose();
- this.m_Plot = null;
+ } else if (this.plot != null) {
+ this.plot.dispose();
+ this.plot = null;
}
}
public boolean getShowResult() {
- return this.m_Show;
+ return this.show;
}
public String showResultTipText() {
@@ -529,14 +529,14 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
* @param b The target function.
*/
public void setTargetFunction(InterfaceRegressionFunction b) {
- this.m_TargetFunction = b;
+ this.targetFunction = b;
}
public InterfaceRegressionFunction getTargetFunction() {
- if (m_TargetFunction == null) {
+ if (targetFunction == null) {
initializeProblem();
}
- return this.m_TargetFunction;
+ return this.targetFunction;
}
public String targetFunctionTipText() {
@@ -561,11 +561,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
}
public double getLowerBound() {
- return m_LowerBound;
+ return lowerBound;
}
public void setLowerBound(double mLowerBound) {
- m_LowerBound = mLowerBound;
+ lowerBound = mLowerBound;
}
public String lowerBoundTipText() {
@@ -573,11 +573,11 @@ public class PSymbolicRegression extends AbstractOptimizationProblem implements
}
public double getUpperBound() {
- return m_UpperBound;
+ return upperBound;
}
public void setUpperBound(double mUpperBound) {
- m_UpperBound = mUpperBound;
+ upperBound = mUpperBound;
}
public String upperBoundTipText() {
diff --git a/src/eva2/optimization/problems/TF1Problem.java b/src/eva2/optimization/problems/TF1Problem.java
index 121a590e..4539db7b 100644
--- a/src/eva2/optimization/problems/TF1Problem.java
+++ b/src/eva2/optimization/problems/TF1Problem.java
@@ -20,12 +20,12 @@ import java.util.ArrayList;
*/
@Description("T1 is to be minimized.")
public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implements java.io.Serializable {
- protected int m_ProblemDimension = 30;
- protected int m_OutputDimension = 2;
- protected double m_Noise = 0.0;
- protected double m_XOffSet = 0.0;
- protected double m_YOffSet = 0.0;
- protected boolean m_ApplyConstraints = false;
+ protected int problemDimension = 30;
+ protected int outputDimension = 2;
+ protected double noise = 0.0;
+ protected double xOffset = 0.0;
+ protected double yOffset = 0.0;
+ protected boolean applyConstraints = false;
// transient private GraphPointSet mySet;
@@ -43,35 +43,35 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
this.template = (AbstractEAIndividual) ((AbstractEAIndividual) b.template).clone();
}
//AbstractMultiObjectiveOptimizationProblem
- if (b.m_MOSOConverter != null) {
- this.m_MOSOConverter = (InterfaceMOSOConverter) b.m_MOSOConverter.clone();
+ if (b.mosoConverter != null) {
+ this.mosoConverter = (InterfaceMOSOConverter) b.mosoConverter.clone();
}
- if (b.m_Metric != null) {
- this.m_Metric = (InterfaceParetoFrontMetric) b.m_Metric.clone();
+ if (b.metric != null) {
+ this.metric = (InterfaceParetoFrontMetric) b.metric.clone();
}
- if (b.m_ParetoFront != null) {
- this.m_ParetoFront = (Population) b.m_ParetoFront.clone();
+ if (b.paretoFront != null) {
+ this.paretoFront = (Population) b.paretoFront.clone();
}
- if (b.m_Border != null) {
- this.m_Border = new double[b.m_Border.length][2];
- for (int i = 0; i < this.m_Border.length; i++) {
- this.m_Border[i][0] = b.m_Border[i][0];
- this.m_Border[i][1] = b.m_Border[i][1];
+ if (b.border != null) {
+ this.border = new double[b.border.length][2];
+ for (int i = 0; i < this.border.length; i++) {
+ this.border[i][0] = b.border[i][0];
+ this.border[i][1] = b.border[i][1];
}
}
- if (b.m_AreaConst4Parallelization != null) {
- this.m_AreaConst4Parallelization = new ArrayList();
- for (int i = 0; i < b.m_AreaConst4Parallelization.size(); i++) {
- this.m_AreaConst4Parallelization.add(((InterfaceConstraint) b.m_AreaConst4Parallelization.get(i)).clone());
+ if (b.areaConst4Parallelization != null) {
+ this.areaConst4Parallelization = new ArrayList();
+ for (int i = 0; i < b.areaConst4Parallelization.size(); i++) {
+ this.areaConst4Parallelization.add(((InterfaceConstraint) b.areaConst4Parallelization.get(i)).clone());
}
}
// TF1Problem
- this.m_ApplyConstraints = b.m_ApplyConstraints;
- this.m_ProblemDimension = b.m_ProblemDimension;
- this.m_OutputDimension = b.m_OutputDimension;
- this.m_Noise = b.m_Noise;
- this.m_XOffSet = b.m_XOffSet;
- this.m_YOffSet = b.m_YOffSet;
+ this.applyConstraints = b.applyConstraints;
+ this.problemDimension = b.problemDimension;
+ this.outputDimension = b.outputDimension;
+ this.noise = b.noise;
+ this.xOffset = b.xOffset;
+ this.yOffset = b.yOffset;
}
/**
@@ -91,11 +91,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
*/
@Override
public void initializePopulation(Population population) {
- this.m_ParetoFront = new Population();
+ this.paretoFront = new Population();
double[][] newRange = makeRange();
- ((InterfaceDataTypeDouble) this.template).setDoubleDataLength(this.m_ProblemDimension);
+ ((InterfaceDataTypeDouble) this.template).setDoubleDataLength(this.problemDimension);
((InterfaceDataTypeDouble) this.template).setDoubleRange(newRange);
AbstractOptimizationProblem.defaultInitPopulation(population, template, this);
@@ -106,8 +106,8 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
}
protected double[][] makeRange(double lower, double upper) {
- double[][] newRange = new double[this.m_ProblemDimension][2];
- for (int i = 0; i < this.m_ProblemDimension; i++) {
+ double[][] newRange = new double[this.problemDimension][2];
+ for (int i = 0; i < this.problemDimension; i++) {
newRange[i][0] = lower;
newRange[i][1] = upper;
}
@@ -127,17 +127,17 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
x = new double[((InterfaceDataTypeDouble) individual).getDoubleData().length];
System.arraycopy(((InterfaceDataTypeDouble) individual).getDoubleData(), 0, x, 0, x.length);
for (int i = 0; i < x.length; i++) {
- x[i] -= this.m_XOffSet;
+ x[i] -= this.xOffset;
}
fitness = this.doEvaluation(x);
for (int i = 0; i < fitness.length; i++) {
// add noise to the fitness
- fitness[i] += RNG.gaussianDouble(this.m_Noise);
- fitness[i] += this.m_YOffSet;
+ fitness[i] += RNG.gaussianDouble(this.noise);
+ fitness[i] += this.yOffset;
// set the fitness of the individual
individual.SetFitness(i, fitness[i]);
}
- if (this.m_ApplyConstraints) {
+ if (this.applyConstraints) {
if (fitness[0] > 0.5) {
individual.addConstraintViolation(fitness[0] - 0.5);
}
@@ -151,7 +151,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
individual.addConstraintViolation(x[3] - 0.1);
}
}
- individual.checkAreaConst4Parallelization(this.m_AreaConst4Parallelization);
+ individual.checkAreaConst4Parallelization(this.areaConst4Parallelization);
}
/**
@@ -203,7 +203,7 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
@Override
public void drawAdditionalData(Plot plot, Population pop, int index) {
- AbstractMultiObjectiveOptimizationProblem.drawWithConstraints(plot, pop, m_Border, index);
+ AbstractMultiObjectiveOptimizationProblem.drawWithConstraints(plot, pop, border, index);
}
/**
@@ -219,8 +219,8 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
result += "T1 Problem:\n";
result += "Here the individual codes a vector of real number x and T1(x)= x is to be minimized.\n";
result += "Parameters:\n";
- result += "Dimension : " + this.m_ProblemDimension + "\n";
- result += "Noise level : " + this.m_Noise + "\n";
+ result += "Dimension : " + this.problemDimension + "\n";
+ result += "Noise level : " + this.noise + "\n";
result += "Solution representation:\n";
//result += this.template.getSolutionRepresentationFor();
return result;
@@ -281,11 +281,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
if (noise < 0) {
noise = 0;
}
- this.m_Noise = noise;
+ this.noise = noise;
}
public double getNoise() {
- return this.m_Noise;
+ return this.noise;
}
public String noiseTipText() {
@@ -298,11 +298,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
* @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() {
@@ -316,11 +316,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
* @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() {
@@ -333,11 +333,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
* @param d The number of input dimensions
*/
public void setProblemDimension(int d) {
- this.m_ProblemDimension = d;
+ this.problemDimension = d;
}
public int getProblemDimension() {
- return this.m_ProblemDimension;
+ return this.problemDimension;
}
public String problemDimensionTipText() {
@@ -348,15 +348,15 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
// * @param a The number of objective variables
// */
// public void setOutputDimension(int a) {
-// this.m_OutputDimension = a;
-// this.m_Border = new double[this.m_OutputDimension][2];
-// for (int i = 0; i < this.m_Border.length; i++) {
-// this.m_Border[i][0] = 0;
-// this.m_Border[i][1] = 5;
+// this.outputDimension = a;
+// this.border = new double[this.outputDimension][2];
+// for (int i = 0; i < this.border.length; i++) {
+// this.border[i][0] = 0;
+// this.border[i][1] = 5;
// }
// }
// public int getOutputDimension() {
-// return this.m_OutputDimension;
+// return this.outputDimension;
// }
// public String outputDimensionTipText() {
// return "Number of objective variables.";
@@ -383,13 +383,13 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
*/
@Override
public void setMOSOConverter(InterfaceMOSOConverter b) {
- this.m_MOSOConverter = b;
- this.m_MOSOConverter.setOutputDimension(this.m_OutputDimension);
+ this.mosoConverter = b;
+ this.mosoConverter.setOutputDimension(this.outputDimension);
}
@Override
public InterfaceMOSOConverter getMOSOConverter() {
- return this.m_MOSOConverter;
+ return this.mosoConverter;
}
@Override
@@ -401,10 +401,10 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
// * @param b state.
// */
// public void setApplyConstraints(boolean b) {
-// this.m_ApplyConstraints = b;
+// this.applyConstraints = b;
// }
// public boolean getApplyConstraints() {
-// return this.m_ApplyConstraints;
+// return this.applyConstraints;
// }
// public String applyConstraintsTipText() {
// return "Toggle application of constraint (works only for T1).";
@@ -419,11 +419,11 @@ public class TF1Problem extends AbstractMultiObjectiveOptimizationProblem implem
* @param pop The pareto-front archive.
*/
public void setParetoFront(Population pop) {
- this.m_ParetoFront = pop;
+ this.paretoFront = pop;
}
public Population getParetoFront() {
- return this.m_ParetoFront;
+ return this.paretoFront;
}
public String paretoFrontTipText() {
diff --git a/src/eva2/optimization/stat/StatisticsStandalone.java b/src/eva2/optimization/stat/StatisticsStandalone.java
index 4c5bc14c..076fa0f7 100644
--- a/src/eva2/optimization/stat/StatisticsStandalone.java
+++ b/src/eva2/optimization/stat/StatisticsStandalone.java
@@ -81,7 +81,7 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
double[] specificData = pop.getSpecificData();
if (specificData != null) {
for (int i = 0; i < specificData.length; i++) {
-// ((ArrayList