Removed unnecessary import statements.

This commit is contained in:
Andreas Dräger
2008-07-17 09:12:37 +00:00
parent 66d02fa404
commit b400dbf3f3
3 changed files with 32 additions and 28 deletions

View File

@@ -109,7 +109,7 @@ public class Plot implements PlotInterface, Serializable {
try { try {
m_Frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes)); m_Frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
} catch (java.lang.NullPointerException e) { } catch (java.lang.NullPointerException e) {
System.out.println("Could not find EvA2 icon, please move resources folder to working directory!"); System.err.println("Could not find EvA2 icon, please move resources folder to working directory!");
} }
m_ButtonPanel = new JPanel(); m_ButtonPanel = new JPanel();
@@ -142,7 +142,7 @@ public class Plot implements PlotInterface, Serializable {
m_PlotArea.exportToAscii(); m_PlotArea.exportToAscii();
} }
}); });
// JButton PrintButton = new JButton ("Print"); // JButton PrintButton = new JButton ("Print");
// PrintButton.addActionListener(new ActionListener() { // PrintButton.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) { // public void actionPerformed(ActionEvent e) {
@@ -212,7 +212,7 @@ public class Plot implements PlotInterface, Serializable {
// } // }
// } // }
// }); // });
// MK: Im not sure whether save/open ever worked... // MK: Im not sure whether save/open ever worked...
// JButton OpenButton = new JButton ("Open.."); // JButton OpenButton = new JButton ("Open..");
// OpenButton.setToolTipText("Load an old plot"); // OpenButton.setToolTipText("Load an old plot");
@@ -286,7 +286,7 @@ public class Plot implements PlotInterface, Serializable {
/** /**
* Return true if the Plot object is valid. * Return true if the Plot object is valid.
* *
* @return true if the Plot object is valid * @return true if the Plot object is valid
*/ */
public boolean isValid() { public boolean isValid() {
@@ -381,7 +381,7 @@ public class Plot implements PlotInterface, Serializable {
protected void dumpPlot() { protected void dumpPlot() {
m_PlotArea.exportToAscii(); m_PlotArea.exportToAscii();
} }
/** /**
* *
*/ */
@@ -395,7 +395,7 @@ public class Plot implements PlotInterface, Serializable {
returnVal = JOptionPane.showConfirmDialog(m_Frame, "The file "+sFile.getName()+" already exists. Overwrite?"); returnVal = JOptionPane.showConfirmDialog(m_Frame, "The file "+sFile.getName()+" already exists. Overwrite?");
if (returnVal != JOptionPane.YES_OPTION) return; if (returnVal != JOptionPane.YES_OPTION) return;
} }
if (!(m_PlotArea.exportToAscii(sFile))) { if (!(m_PlotArea.exportToAscii(sFile))) {
JOptionPane.showMessageDialog(m_Frame, JOptionPane.showMessageDialog(m_Frame,
"Couldn't write to file: " "Couldn't write to file: "
+ sFile.getName(), + sFile.getName(),

View File

@@ -19,7 +19,6 @@ import eva2.gui.BeanInspector;
import eva2.server.go.IndividualInterface; import eva2.server.go.IndividualInterface;
import eva2.server.go.InterfaceTerminator; import eva2.server.go.InterfaceTerminator;
import eva2.server.go.PopulationInterface; import eva2.server.go.PopulationInterface;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.distancemetric.PhenotypeMetric; import eva2.server.go.operators.distancemetric.PhenotypeMetric;
import eva2.server.go.populations.InterfaceSolutionSet; import eva2.server.go.populations.InterfaceSolutionSet;
import eva2.server.go.problems.InterfaceOptimizationProblem; import eva2.server.go.problems.InterfaceOptimizationProblem;
@@ -48,7 +47,7 @@ Serializable {
private String msg=""; private String msg="";
protected String tagString = "Fitness converged"; protected String tagString = "Fitness converged";
PhenotypeMetric pMetric = null; PhenotypeMetric pMetric = null;
public FitnessConvergenceTerminator() { public FitnessConvergenceTerminator() {
pMetric = new PhenotypeMetric(); pMetric = new PhenotypeMetric();
} }
@@ -62,14 +61,14 @@ Serializable {
if (bAbsolute) convergenceCondition.setSelectedTag("Absolute"); if (bAbsolute) convergenceCondition.setSelectedTag("Absolute");
else convergenceCondition.setSelectedTag("Relative"); else convergenceCondition.setSelectedTag("Relative");
} }
/** /**
* *
*/ */
public String globalInfo() { public String globalInfo() {
return "Stop if a fitness convergence criterion has been met."; return "Stop if a fitness convergence criterion has been met.";
} }
public void init(InterfaceOptimizationProblem prob) { public void init(InterfaceOptimizationProblem prob) {
if (pMetric == null) pMetric = new PhenotypeMetric(); if (pMetric == null) pMetric = new PhenotypeMetric();
firstTime = true; firstTime = true;
@@ -80,7 +79,7 @@ Serializable {
public boolean isTerminated(InterfaceSolutionSet solSet) { public boolean isTerminated(InterfaceSolutionSet solSet) {
return isTerminated(solSet.getCurrentPopulation()); return isTerminated(solSet.getCurrentPopulation());
} }
public boolean isTerminated(PopulationInterface Pop) { public boolean isTerminated(PopulationInterface Pop) {
if (!firstTime && isStillConverged(Pop.getBestIndividual())) { if (!firstTime && isStillConverged(Pop.getBestIndividual())) {
if (stagnationTimeHasPassed(Pop)) { if (stagnationTimeHasPassed(Pop)) {
@@ -98,7 +97,7 @@ Serializable {
return false; return false;
} }
} }
public String lastTerminationMessage() { public String lastTerminationMessage() {
return msg; return msg;
} }
@@ -114,19 +113,19 @@ Serializable {
else sb.append(" function calls."); else sb.append(" function calls.");
return sb.toString(); return sb.toString();
} }
protected void saveState(PopulationInterface Pop) { protected void saveState(PopulationInterface Pop) {
oldFit = Pop.getBestFitness(); oldFit = Pop.getBestFitness();
oldNorm = PhenotypeMetric.norm(oldFit); oldNorm = PhenotypeMetric.norm(oldFit);
popFitCalls = Pop.getFunctionCalls(); popFitCalls = Pop.getFunctionCalls();
popGens = Pop.getGeneration(); popGens = Pop.getGeneration();
firstTime = false; firstTime = false;
} }
/** /**
* Return true if |oldFit - curFit| < |oldFit| * thresh% (relative case) * Return true if |oldFit - curFit| < |oldFit| * thresh% (relative case)
* and if |oldFit - curFit| < thresh (absolute case). * and if |oldFit - curFit| < thresh (absolute case).
* *
* @param curFit * @param curFit
* @return * @return
*/ */
@@ -142,7 +141,7 @@ Serializable {
if (TRACE) System.out.println("isStillConverged returns " + ret + ", dist " + dist + ", old fit " + BeanInspector.toString(oldFit) + ", curFit " + BeanInspector.toString(curFit)); if (TRACE) System.out.println("isStillConverged returns " + ret + ", dist " + dist + ", old fit " + BeanInspector.toString(oldFit) + ", curFit " + BeanInspector.toString(curFit));
return ret; return ret;
} }
private boolean stagnationTimeHasPassed(PopulationInterface pop) { private boolean stagnationTimeHasPassed(PopulationInterface pop) {
if (stagnationMeasure.isSelectedString("Fitness calls")) { // by fitness calls if (stagnationMeasure.isSelectedString("Fitness calls")) { // by fitness calls
// System.out.println("stagnationTimeHasPassed returns " + ((pop.getFunctionCalls() - popFitCalls) >= m_stagTime) + " after " + (pop.getFunctionCalls() - popFitCalls)); // System.out.println("stagnationTimeHasPassed returns " + ((pop.getFunctionCalls() - popFitCalls) >= m_stagTime) + " after " + (pop.getFunctionCalls() - popFitCalls));
@@ -152,7 +151,7 @@ Serializable {
return (pop.getGeneration() - popGens) >= m_stagTime; return (pop.getGeneration() - popGens) >= m_stagTime;
} }
} }
/** /**
* *
*/ */
@@ -177,7 +176,7 @@ Serializable {
public String convergenceThresholdTipText() { public String convergenceThresholdTipText() {
return "Terminate if the fitness has not improved by this percentage / absolute value for a whole stagnation time period"; return "Terminate if the fitness has not improved by this percentage / absolute value for a whole stagnation time period";
} }
/** /**
* *
*/ */
@@ -191,7 +190,7 @@ Serializable {
public int getStagnationTime() { public int getStagnationTime() {
return m_stagTime; return m_stagTime;
} }
public String stagnationTimeTipText() { public String stagnationTimeTipText() {
return "Terminate if the population has not improved for this time"; return "Terminate if the population has not improved for this time";
} }
@@ -210,7 +209,7 @@ Serializable {
public void setStagnationMeasure(SelectedTag stagnationTimeIn) { public void setStagnationMeasure(SelectedTag stagnationTimeIn) {
this.stagnationMeasure = stagnationTimeIn; this.stagnationMeasure = stagnationTimeIn;
} }
public String stagnationMeasureTipText() { public String stagnationMeasureTipText() {
return "Stagnation time is measured in fitness calls or generations, to be selected here."; return "Stagnation time is measured in fitness calls or generations, to be selected here.";
} }
@@ -228,7 +227,7 @@ Serializable {
public void setConvergenceCondition(SelectedTag convergenceCondition) { public void setConvergenceCondition(SelectedTag convergenceCondition) {
this.convergenceCondition = convergenceCondition; this.convergenceCondition = convergenceCondition;
} }
public String convergenceConditionTipText() { public String convergenceConditionTipText() {
return "Select between absolute and relative convergence condition"; return "Select between absolute and relative convergence condition";
} }

View File

@@ -34,6 +34,9 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
public ArrayList m_AreaConst4Parallelization = new ArrayList(); public ArrayList m_AreaConst4Parallelization = new ArrayList();
protected int m_OutputDimension = 2; protected int m_OutputDimension = 2;
/**
* TODO
*/
public double[][] m_Border; public double[][] m_Border;
transient protected eva2.gui.Plot m_Plot; transient protected eva2.gui.Plot m_Plot;
transient protected JFrame m_Result; transient protected JFrame m_Result;
@@ -43,7 +46,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @return the clone * @return the clone
*/ */
public abstract Object clone(); public abstract Object clone();
/** This method inits the Problem to log multiruns for the s-Metric it /** This method inits the Problem to log multiruns for the s-Metric it
* is necessary to give the border to get reliable results. * is necessary to give the border to get reliable results.
* also it is necessary to init the local Pareto-Front and the * also it is necessary to init the local Pareto-Front and the
@@ -95,7 +98,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
public void evaluate(Population population) { public void evaluate(Population population) {
AbstractEAIndividual tmpIndy; AbstractEAIndividual tmpIndy;
double[] fitness; double[] fitness;
evaluatePopulationStart(population); evaluatePopulationStart(population);
// first evaluate the population // first evaluate the population
@@ -105,7 +108,9 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
this.evaluate(tmpIndy); this.evaluate(tmpIndy);
fitness = tmpIndy.getFitness(); fitness = tmpIndy.getFitness();
// check and update border if necessary // check and update border if necessary
if (fitness.length != this.m_Border.length) { 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+")"); //System.out.println("AbstractMOOptimizationProblem: Warning fitness.length("+fitness.length+") doesn't fit border.length("+this.m_Border.length+")");
//System.out.println("Resetting the border!"); //System.out.println("Resetting the border!");
this.m_Border = new double[fitness.length][2]; this.m_Border = new double[fitness.length][2];
@@ -121,7 +126,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
} }
population.incrFunctionCalls(); population.incrFunctionCalls();
} }
evaluatePopulationEnd(population); // refactored by MK evaluatePopulationEnd(population); // refactored by MK
} }
@@ -154,9 +159,9 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// algorithms can be applied more easily // algorithms can be applied more easily
this.m_MOSOConverter.convertMultiObjective2SingleObjective(population); this.m_MOSOConverter.convertMultiObjective2SingleObjective(population);
if (this.m_Show) this.drawProblem(population); if (this.m_Show) this.drawProblem(population);
} }
/** This method will init the problem specific visualisation of the problem /** This method will init the problem specific visualisation of the problem
*/ */
public void initProblemFrame() { public void initProblemFrame() {