Cleanup and fix for FLensProblem viewer

This commit is contained in:
Fabian Becker 2014-10-16 21:39:07 +02:00
parent a7a277f9ff
commit 5078c58bd0
7 changed files with 7 additions and 32 deletions

View File

@ -1,9 +1,4 @@
package eva2.gui;
/*
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of Tuebingen, Computer
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 272
* $ $Date: 2007-11-21 18:06:36 +0100 (Wed, 21 Nov 2007) $ $Author: mkron $
*/
import eva2.optimization.go.InterfaceNotifyOnInformers;
import eva2.problems.InterfaceAdditionalPopulationInformer;
@ -18,8 +13,7 @@ import java.util.List;
import java.util.logging.Logger;
/**
* Produces the main EvA2 frame and a tool bar instance. TODO This class should be removed
* alltogether.
* Produces the main EvA2 frame and a tool bar instance.
*/
public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceNotifyOnInformers {

View File

@ -242,6 +242,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
public void setEnabledOkCancelButtons(boolean enabled) {
okayButton.setEnabled(enabled);
okayButton.setVisible(enabled);
cancelButton.setEnabled(enabled);
}
@ -390,7 +391,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
* Updates the child property sheet, and creates if needed
*/
public void updateChildPropertySheet() {
// Set the object as the target of the propertysheet
// Set the object as the target of the PropertySheet
propertySheetPanel.setTarget(genericObjectEditor.getValue());
}
@ -406,7 +407,6 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
className = (String) objectChooser.getSelectedItem();
//className = classNameMap.get(className);
try {
Object n = (Object) Class.forName(className).newInstance();
genericObjectEditor.setValue(n);

View File

@ -1014,11 +1014,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
}
}
class PropertyTableModel extends DefaultTableModel implements TableModel {
}
class PropertyCellRenderer implements TableCellRenderer {
private Logger LOGGER = Logger.getLogger(PropertyCellRenderer.class.getName());
JLabel empty = new JLabel();

View File

@ -55,7 +55,6 @@ public class Plot implements PlotInterface, Serializable {
* @param PlotName
* @param xname
* @param yname
* @param init
*/
public Plot(String PlotName, String xname, String yname) {
this(PlotName, xname, yname, true);
@ -191,7 +190,6 @@ public class Plot implements PlotInterface, Serializable {
internalFrame = new JEFrame("Plot: " + plotName);
BasicResourceLoader loader = BasicResourceLoader.instance();
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
// internalFrame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
buttonPanel = new JPanel();
plotArea = new FunctionArea(xAxisText, yAxisText);
@ -199,7 +197,6 @@ public class Plot implements PlotInterface, Serializable {
installButtons(buttonPanel);
// getContentPane().smultetLayout( new GridLayout(1, 4) );
internalFrame.add(buttonPanel, BorderLayout.PAGE_END);
internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so
// nice

View File

@ -1094,7 +1094,6 @@ public class PostProcess {
double lowBnd = 0;
int fitCrit = 0; // use first fitness criterion
SolutionHistogram solHist = SolutionHistogram.createFitNormHistogram(outputPop, lowBnd, upBnd, 20, fitCrit);
// PostProcessInterim.outputResult((AbstractOptimizationProblem)goParams.getProblem(), outputPop, 0.01, System.out, 0, 2000, 20, goParams.getPostProcessSteps());
if (outputPop.size() > 1) {
if (listener != null) {
listener.println("measures: " + BeanInspector.toString(outputPop.getPopulationMeasures()));
@ -1122,20 +1121,12 @@ public class PostProcess {
if (listener != null) {
listener.println("Best after post process:" + " (first " + printK + " of " + outputPop.size() + ")");
}
// ((outputPop.size()>nBestPop.size())
// ? ( " (first " + nBestPop.size() + " of " + outputPop.size() + ")") :
// (" (" + nBestPop.size() + ")") ));
//////////// output some individual data
if (listener != null) {
for (int i = 0; i < printK; i++) {
listener.println(AbstractEAIndividual.getDefaultStringRepresentation(nBestPop.getEAIndividual(i)));
}
}
// for (int i=0; i<printK; i++) {
// System.out.println(AbstractEAIndividual.getDefaultStringRepresentation(nBestPop.getEAIndividual(i)));
// }
}
// System.out.println(nBestPop);
if (problem instanceof InterfaceHasSolutionViewer) {
InterfaceSolutionViewer viewer = ((InterfaceHasSolutionViewer) problem).getSolutionViewer();
if (viewer != null) {

View File

@ -1467,8 +1467,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
InterfaceDataTypeDouble indy = (InterfaceDataTypeDouble) this.population.get(0);
double[][] range = indy.getDoubleRange();
this.plot = new Plot("PSO " + population.getGeneration(), "x1", "x2", range[0], range[1]);
// this.plot.setUnconnectedPoint(range[0][0], range[1][0], 0);
// this.plot.setUnconnectedPoint(range[0][1], range[1][1], 0);
}
}
@ -1480,7 +1478,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
@Override
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
if (this.changeListener == null) {
this.changeListener = new Vector<InterfacePopulationChangedEventListener>();
this.changeListener = new Vector<>();
}
this.changeListener.add(ea);
}

View File

@ -1,6 +1,7 @@
package eva2.problems;
import eva2.gui.JEFrame;
import eva2.optimization.go.StandaloneOptimization;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.individuals.ESIndividualDoubleData;
@ -180,7 +181,7 @@ public class FLensProblem extends AbstractOptimizationProblem
protected double yOffset = 0.0;
transient protected boolean show = false;
transient private JFrame problemFrame;
transient private JEFrame problemFrame;
transient private MyLensViewer lensViewerPanel;
public double radius = 5;
public double focalLength = 20;
@ -223,12 +224,11 @@ public class FLensProblem extends AbstractOptimizationProblem
*/
public void initProblemFrame() {
if (this.problemFrame == null) {
this.problemFrame = new JFrame("Lens Problem Viewer");
this.problemFrame = new JEFrame("Lens Problem Viewer");
this.lensViewerPanel = new MyLensViewer(this);
this.problemFrame.getContentPane().add(this.lensViewerPanel);
this.problemFrame.pack();
this.problemFrame.setVisible(true);
//this.problemFrame.show();
} else {
this.lensViewerPanel.resetView();
}