Cleanup and fix for FLensProblem viewer
This commit is contained in:
parent
a7a277f9ff
commit
5078c58bd0
@ -1,9 +1,4 @@
|
|||||||
package eva2.gui;
|
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.optimization.go.InterfaceNotifyOnInformers;
|
||||||
import eva2.problems.InterfaceAdditionalPopulationInformer;
|
import eva2.problems.InterfaceAdditionalPopulationInformer;
|
||||||
@ -18,8 +13,7 @@ import java.util.List;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces the main EvA2 frame and a tool bar instance. TODO This class should be removed
|
* Produces the main EvA2 frame and a tool bar instance.
|
||||||
* alltogether.
|
|
||||||
*/
|
*/
|
||||||
public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceNotifyOnInformers {
|
public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceNotifyOnInformers {
|
||||||
|
|
||||||
|
@ -242,6 +242,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
|
|||||||
|
|
||||||
public void setEnabledOkCancelButtons(boolean enabled) {
|
public void setEnabledOkCancelButtons(boolean enabled) {
|
||||||
okayButton.setEnabled(enabled);
|
okayButton.setEnabled(enabled);
|
||||||
|
okayButton.setVisible(enabled);
|
||||||
cancelButton.setEnabled(enabled);
|
cancelButton.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,7 +391,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
|
|||||||
* Updates the child property sheet, and creates if needed
|
* Updates the child property sheet, and creates if needed
|
||||||
*/
|
*/
|
||||||
public void updateChildPropertySheet() {
|
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());
|
propertySheetPanel.setTarget(genericObjectEditor.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +407,6 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
|
|||||||
|
|
||||||
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
||||||
className = (String) objectChooser.getSelectedItem();
|
className = (String) objectChooser.getSelectedItem();
|
||||||
//className = classNameMap.get(className);
|
|
||||||
try {
|
try {
|
||||||
Object n = (Object) Class.forName(className).newInstance();
|
Object n = (Object) Class.forName(className).newInstance();
|
||||||
genericObjectEditor.setValue(n);
|
genericObjectEditor.setValue(n);
|
||||||
|
@ -1014,11 +1014,6 @@ public class PropertySheetPanel extends JPanel implements PropertyChangeListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class PropertyTableModel extends DefaultTableModel implements TableModel {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class PropertyCellRenderer implements TableCellRenderer {
|
class PropertyCellRenderer implements TableCellRenderer {
|
||||||
private Logger LOGGER = Logger.getLogger(PropertyCellRenderer.class.getName());
|
private Logger LOGGER = Logger.getLogger(PropertyCellRenderer.class.getName());
|
||||||
JLabel empty = new JLabel();
|
JLabel empty = new JLabel();
|
||||||
|
@ -55,7 +55,6 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
* @param PlotName
|
* @param PlotName
|
||||||
* @param xname
|
* @param xname
|
||||||
* @param yname
|
* @param yname
|
||||||
* @param init
|
|
||||||
*/
|
*/
|
||||||
public Plot(String PlotName, String xname, String yname) {
|
public Plot(String PlotName, String xname, String yname) {
|
||||||
this(PlotName, xname, yname, true);
|
this(PlotName, xname, yname, true);
|
||||||
@ -191,7 +190,6 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
internalFrame = new JEFrame("Plot: " + plotName);
|
internalFrame = new JEFrame("Plot: " + plotName);
|
||||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||||
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
|
||||||
// internalFrame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
|
||||||
|
|
||||||
buttonPanel = new JPanel();
|
buttonPanel = new JPanel();
|
||||||
plotArea = new FunctionArea(xAxisText, yAxisText);
|
plotArea = new FunctionArea(xAxisText, yAxisText);
|
||||||
@ -199,7 +197,6 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
|
|
||||||
installButtons(buttonPanel);
|
installButtons(buttonPanel);
|
||||||
|
|
||||||
// getContentPane().smultetLayout( new GridLayout(1, 4) );
|
|
||||||
internalFrame.add(buttonPanel, BorderLayout.PAGE_END);
|
internalFrame.add(buttonPanel, BorderLayout.PAGE_END);
|
||||||
internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so
|
internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so
|
||||||
// nice
|
// nice
|
||||||
|
@ -1094,7 +1094,6 @@ public class PostProcess {
|
|||||||
double lowBnd = 0;
|
double lowBnd = 0;
|
||||||
int fitCrit = 0; // use first fitness criterion
|
int fitCrit = 0; // use first fitness criterion
|
||||||
SolutionHistogram solHist = SolutionHistogram.createFitNormHistogram(outputPop, lowBnd, upBnd, 20, fitCrit);
|
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 (outputPop.size() > 1) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.println("measures: " + BeanInspector.toString(outputPop.getPopulationMeasures()));
|
listener.println("measures: " + BeanInspector.toString(outputPop.getPopulationMeasures()));
|
||||||
@ -1122,20 +1121,12 @@ public class PostProcess {
|
|||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.println("Best after post process:" + " (first " + printK + " of " + outputPop.size() + ")");
|
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) {
|
if (listener != null) {
|
||||||
for (int i = 0; i < printK; i++) {
|
for (int i = 0; i < printK; i++) {
|
||||||
listener.println(AbstractEAIndividual.getDefaultStringRepresentation(nBestPop.getEAIndividual(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) {
|
if (problem instanceof InterfaceHasSolutionViewer) {
|
||||||
InterfaceSolutionViewer viewer = ((InterfaceHasSolutionViewer) problem).getSolutionViewer();
|
InterfaceSolutionViewer viewer = ((InterfaceHasSolutionViewer) problem).getSolutionViewer();
|
||||||
if (viewer != null) {
|
if (viewer != null) {
|
||||||
|
@ -1467,8 +1467,6 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
InterfaceDataTypeDouble indy = (InterfaceDataTypeDouble) this.population.get(0);
|
InterfaceDataTypeDouble indy = (InterfaceDataTypeDouble) this.population.get(0);
|
||||||
double[][] range = indy.getDoubleRange();
|
double[][] range = indy.getDoubleRange();
|
||||||
this.plot = new Plot("PSO " + population.getGeneration(), "x1", "x2", range[0], range[1]);
|
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
|
@Override
|
||||||
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
public void addPopulationChangedEventListener(InterfacePopulationChangedEventListener ea) {
|
||||||
if (this.changeListener == null) {
|
if (this.changeListener == null) {
|
||||||
this.changeListener = new Vector<InterfacePopulationChangedEventListener>();
|
this.changeListener = new Vector<>();
|
||||||
}
|
}
|
||||||
this.changeListener.add(ea);
|
this.changeListener.add(ea);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eva2.problems;
|
package eva2.problems;
|
||||||
|
|
||||||
|
|
||||||
|
import eva2.gui.JEFrame;
|
||||||
import eva2.optimization.go.StandaloneOptimization;
|
import eva2.optimization.go.StandaloneOptimization;
|
||||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||||
import eva2.optimization.individuals.ESIndividualDoubleData;
|
import eva2.optimization.individuals.ESIndividualDoubleData;
|
||||||
@ -180,7 +181,7 @@ public class FLensProblem extends AbstractOptimizationProblem
|
|||||||
protected double yOffset = 0.0;
|
protected double yOffset = 0.0;
|
||||||
transient protected boolean show = false;
|
transient protected boolean show = false;
|
||||||
|
|
||||||
transient private JFrame problemFrame;
|
transient private JEFrame problemFrame;
|
||||||
transient private MyLensViewer lensViewerPanel;
|
transient private MyLensViewer lensViewerPanel;
|
||||||
public double radius = 5;
|
public double radius = 5;
|
||||||
public double focalLength = 20;
|
public double focalLength = 20;
|
||||||
@ -223,12 +224,11 @@ public class FLensProblem extends AbstractOptimizationProblem
|
|||||||
*/
|
*/
|
||||||
public void initProblemFrame() {
|
public void initProblemFrame() {
|
||||||
if (this.problemFrame == null) {
|
if (this.problemFrame == null) {
|
||||||
this.problemFrame = new JFrame("Lens Problem Viewer");
|
this.problemFrame = new JEFrame("Lens Problem Viewer");
|
||||||
this.lensViewerPanel = new MyLensViewer(this);
|
this.lensViewerPanel = new MyLensViewer(this);
|
||||||
this.problemFrame.getContentPane().add(this.lensViewerPanel);
|
this.problemFrame.getContentPane().add(this.lensViewerPanel);
|
||||||
this.problemFrame.pack();
|
this.problemFrame.pack();
|
||||||
this.problemFrame.setVisible(true);
|
this.problemFrame.setVisible(true);
|
||||||
//this.problemFrame.show();
|
|
||||||
} else {
|
} else {
|
||||||
this.lensViewerPanel.resetView();
|
this.lensViewerPanel.resetView();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user