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 {
m_Frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
} 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();
@ -142,7 +142,7 @@ public class Plot implements PlotInterface, Serializable {
m_PlotArea.exportToAscii();
}
});
// JButton PrintButton = new JButton ("Print");
// PrintButton.addActionListener(new ActionListener() {
// public void actionPerformed(ActionEvent e) {
@ -212,7 +212,7 @@ public class Plot implements PlotInterface, Serializable {
// }
// }
// });
// MK: Im not sure whether save/open ever worked...
// JButton OpenButton = new JButton ("Open..");
// 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
*/
public boolean isValid() {
@ -381,7 +381,7 @@ public class Plot implements PlotInterface, Serializable {
protected void dumpPlot() {
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?");
if (returnVal != JOptionPane.YES_OPTION) return;
}
if (!(m_PlotArea.exportToAscii(sFile))) {
if (!(m_PlotArea.exportToAscii(sFile))) {
JOptionPane.showMessageDialog(m_Frame,
"Couldn't write to file: "
+ sFile.getName(),

View File

@ -19,7 +19,6 @@ import eva2.gui.BeanInspector;
import eva2.server.go.IndividualInterface;
import eva2.server.go.InterfaceTerminator;
import eva2.server.go.PopulationInterface;
import eva2.server.go.individuals.AbstractEAIndividual;
import eva2.server.go.operators.distancemetric.PhenotypeMetric;
import eva2.server.go.populations.InterfaceSolutionSet;
import eva2.server.go.problems.InterfaceOptimizationProblem;
@ -48,7 +47,7 @@ Serializable {
private String msg="";
protected String tagString = "Fitness converged";
PhenotypeMetric pMetric = null;
public FitnessConvergenceTerminator() {
pMetric = new PhenotypeMetric();
}
@ -62,14 +61,14 @@ Serializable {
if (bAbsolute) convergenceCondition.setSelectedTag("Absolute");
else convergenceCondition.setSelectedTag("Relative");
}
/**
*
*/
public String globalInfo() {
return "Stop if a fitness convergence criterion has been met.";
}
public void init(InterfaceOptimizationProblem prob) {
if (pMetric == null) pMetric = new PhenotypeMetric();
firstTime = true;
@ -80,7 +79,7 @@ Serializable {
public boolean isTerminated(InterfaceSolutionSet solSet) {
return isTerminated(solSet.getCurrentPopulation());
}
public boolean isTerminated(PopulationInterface Pop) {
if (!firstTime && isStillConverged(Pop.getBestIndividual())) {
if (stagnationTimeHasPassed(Pop)) {
@ -98,7 +97,7 @@ Serializable {
return false;
}
}
public String lastTerminationMessage() {
return msg;
}
@ -114,19 +113,19 @@ Serializable {
else sb.append(" function calls.");
return sb.toString();
}
protected void saveState(PopulationInterface Pop) {
oldFit = Pop.getBestFitness();
oldNorm = PhenotypeMetric.norm(oldFit);
popFitCalls = Pop.getFunctionCalls();
popGens = Pop.getGeneration();
firstTime = false;
firstTime = false;
}
/**
* Return true if |oldFit - curFit| < |oldFit| * thresh% (relative case)
* and if |oldFit - curFit| < thresh (absolute case).
*
*
* @param curFit
* @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));
return ret;
}
private boolean stagnationTimeHasPassed(PopulationInterface pop) {
if (stagnationMeasure.isSelectedString("Fitness calls")) { // by fitness calls
// 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;
}
}
/**
*
*/
@ -177,7 +176,7 @@ Serializable {
public String convergenceThresholdTipText() {
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() {
return m_stagTime;
}
public String stagnationTimeTipText() {
return "Terminate if the population has not improved for this time";
}
@ -210,7 +209,7 @@ Serializable {
public void setStagnationMeasure(SelectedTag stagnationTimeIn) {
this.stagnationMeasure = stagnationTimeIn;
}
public String stagnationMeasureTipText() {
return "Stagnation time is measured in fitness calls or generations, to be selected here.";
}
@ -228,7 +227,7 @@ Serializable {
public void setConvergenceCondition(SelectedTag convergenceCondition) {
this.convergenceCondition = convergenceCondition;
}
public String convergenceConditionTipText() {
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();
protected int m_OutputDimension = 2;
/**
* TODO
*/
public double[][] m_Border;
transient protected eva2.gui.Plot m_Plot;
transient protected JFrame m_Result;
@ -43,7 +46,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
* @return the clone
*/
public abstract Object clone();
/** This method inits the Problem to log multiruns for the s-Metric it
* is necessary to give the border to get reliable results.
* 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) {
AbstractEAIndividual tmpIndy;
double[] fitness;
evaluatePopulationStart(population);
// first evaluate the population
@ -105,7 +108,9 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
this.evaluate(tmpIndy);
fitness = tmpIndy.getFitness();
// 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("Resetting the border!");
this.m_Border = new double[fitness.length][2];
@ -121,7 +126,7 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
}
population.incrFunctionCalls();
}
evaluatePopulationEnd(population); // refactored by MK
}
@ -154,9 +159,9 @@ public abstract class AbstractMultiObjectiveOptimizationProblem extends Abstract
// algorithms can be applied more easily
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
*/
public void initProblemFrame() {