More code cleanup.
This commit is contained in:
parent
daef96899a
commit
69a78d5757
@ -1002,7 +1002,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
if (firstPlot) {
|
||||
initPlots(null, null);
|
||||
// if (doTextOutput()) printToTextListener(getOutputHeader(null, null)+'\n');
|
||||
firstPlot = false;
|
||||
}
|
||||
if ((iterationCounter == 0) && printHeaderByVerbosity()) {
|
||||
|
@ -53,8 +53,6 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
|
||||
int mag = 10;
|
||||
int centerLens, centerScreen, segment;
|
||||
|
||||
// lineStroke = ds;
|
||||
// pointStroke = new BasicStroke(ds.getLineWidth(), ds.getEndCap(), ds.getLineJoin(), ds.getMiterLimit() , new float[] {1, 4}, 0);
|
||||
dashStroke = new BasicStroke(ds.getLineWidth(), ds.getEndCap(), ds.getLineJoin(), ds.getMiterLimit(), new float[]{8, 8}, 0);
|
||||
|
||||
super.paint(g);
|
||||
@ -85,7 +83,6 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
|
||||
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(lensProblem.problemDimension, theHeight, lensProblem.radius, mag, centerLens, centerScreen, segment, g2D);
|
||||
// Now put everything on the screen
|
||||
g.drawImage(bufferedImage, 0, 0, this);
|
||||
@ -127,12 +124,6 @@ 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.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.theHeight/2+5, currentPos, this.theHeight/2-5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,7 +135,6 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
|
||||
@Override
|
||||
public void updateView(Population pop, boolean showAllIfPossible) {
|
||||
if (showAllIfPossible) {
|
||||
// indiesToPaint=population;
|
||||
for (int i = 0; i < pop.size(); i++) {
|
||||
MyLensViewer newView = new MyLensViewer(lensProblem);
|
||||
|
||||
@ -157,7 +147,6 @@ class MyLensViewer extends JPanel implements InterfaceSolutionViewer {
|
||||
newFrame.pack();
|
||||
newFrame.setVisible(true);
|
||||
}
|
||||
// this.paint(this.getGraphics());
|
||||
} else {
|
||||
InterfaceDataTypeDouble best = (InterfaceDataTypeDouble) pop.getBestIndividual();
|
||||
if (indiesToPaint.size() == 0 || ((AbstractEAIndividual) best).isDominant(indiesToPaint.getBestIndividual())) {
|
||||
@ -190,7 +179,6 @@ public class FLensProblem extends AbstractOptimizationProblem
|
||||
protected double xOffset = 0.0;
|
||||
protected double yOffset = 0.0;
|
||||
transient protected boolean show = false;
|
||||
//protected int sleepTime = 0;
|
||||
|
||||
transient private JFrame problemFrame;
|
||||
transient private MyLensViewer lensViewerPanel;
|
||||
|
@ -54,7 +54,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
x = new double[((InterfaceDataTypeDouble) individual).getDoubleData().length];
|
||||
System.arraycopy(((InterfaceDataTypeDouble) individual).getDoubleData(), 0, x, 0, x.length);
|
||||
// evaluate the vector
|
||||
fitness = ((SimpleProblemDouble) simProb).eval(x);
|
||||
fitness = ((SimpleProblemDouble) simProb).evaluate(x);
|
||||
// if indicated, add Gaussian noise
|
||||
if (noise != 0) {
|
||||
RNG.addNoise(fitness, noise);
|
||||
@ -67,7 +67,7 @@ public class SimpleProblemWrapper extends AbstractOptimizationProblem {
|
||||
|
||||
tmpBitSet = ((InterfaceDataTypeBinary) individual).getBinaryData();
|
||||
// evaluate the fitness
|
||||
result = ((SimpleProblemBinary) simProb).eval(tmpBitSet);
|
||||
result = ((SimpleProblemBinary) simProb).evaluate(tmpBitSet);
|
||||
// set the fitness
|
||||
individual.setFitness(result);
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@ public interface InterfaceSimpleProblem<T> {
|
||||
* @param x a double vector to be evaluated
|
||||
* @return the fitness vector assigned to x as to the target function
|
||||
*/
|
||||
public double[] eval(T x);
|
||||
public double[] evaluate(T x);
|
||||
|
||||
/**
|
||||
* Return the problem dimension.
|
||||
|
@ -8,7 +8,7 @@ public class SimpleB1 extends SimpleProblemBinary {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] eval(BitSet b) {
|
||||
public double[] evaluate(BitSet b) {
|
||||
double[] result = new double[1];
|
||||
int fitness = 0;
|
||||
|
||||
|
@ -7,7 +7,7 @@ public class SimpleF1 extends SimpleProblemDouble {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] eval(double[] x) {
|
||||
public double[] evaluate(double[] x) {
|
||||
double res[] = new double[1];
|
||||
// this defines the dimension of the fitness vector, which should be always the same
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user