Renaming and documentation variables/classes
This commit is contained in:
@@ -1,17 +1,5 @@
|
|||||||
package eva2.gui.plot;
|
package eva2.gui.plot;
|
||||||
|
|
||||||
/*
|
|
||||||
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of
|
|
||||||
* Tuebingen, Computer Architecture @author Holger Ulmer, Felix Streichert,
|
|
||||||
* Hannes Planatscher @version: $Revision: 306 $ $Date: 2007-12-04 14:22:52
|
|
||||||
* +0100 (Tue, 04 Dec 2007) $ $Author: mkron $
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
* ==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
import eva2.gui.*;
|
import eva2.gui.*;
|
||||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||||
import eva2.optimization.mocco.paretofrontviewer.InterfaceRefPointListener;
|
import eva2.optimization.mocco.paretofrontviewer.InterfaceRefPointListener;
|
||||||
|
@@ -1,12 +1,5 @@
|
|||||||
package eva2.gui.plot;
|
package eva2.gui.plot;
|
||||||
|
|
||||||
/*
|
|
||||||
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of
|
|
||||||
* Tuebingen, Computer Architecture @author Holger Ulmer, Felix Streichert,
|
|
||||||
* Hannes Planatscher @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07
|
|
||||||
* +0100 (Tue, 11 Dec 2007) $ $Author: mkron $
|
|
||||||
*/
|
|
||||||
|
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.gui.JEFrame;
|
import eva2.gui.JEFrame;
|
||||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||||
@@ -43,13 +36,13 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
* Generated serial version identifier.
|
* Generated serial version identifier.
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -9027101244918249825L;
|
private static final long serialVersionUID = -9027101244918249825L;
|
||||||
private JFileChooser m_FileChooser;
|
private JFileChooser fileChooser;
|
||||||
private JPanel m_ButtonPanel;
|
private JPanel m_ButtonPanel;
|
||||||
private String plotName;
|
private String plotName;
|
||||||
private String xAxisText;
|
private String xAxisText;
|
||||||
private String yAxisText;
|
private String yAxisText;
|
||||||
protected FunctionArea m_PlotArea;
|
protected FunctionArea plotArea;
|
||||||
protected JInternalFrame m_Frame;
|
protected JInternalFrame internalFrame;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You might want to try to assign the x-range as x and y-range as y array
|
* You might want to try to assign the x-range as x and y-range as y array
|
||||||
@@ -61,7 +54,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
for (int i = 0; i < x.length; i++) {
|
for (int i = 0; i < x.length; i++) {
|
||||||
points.addDPoint(x[i], y[i]);
|
points.addDPoint(x[i], y[i]);
|
||||||
}
|
}
|
||||||
m_PlotArea.addDElement(points);
|
plotArea.addDElement(points);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,39 +87,39 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void installButtons(JPanel buttonPan) {
|
protected void installButtons(JPanel buttonPan) {
|
||||||
JButton ClearButton = new JButton("Clear");
|
JButton clearButton = new JButton("Clear");
|
||||||
ClearButton.addActionListener(new ActionListener() {
|
clearButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
clearAll();
|
clearAll();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JButton LOGButton = new JButton("Log/Lin");
|
JButton loglinButton = new JButton("Log/Lin");
|
||||||
LOGButton.setToolTipText("Toggle between a linear and a log scale on the y-axis.");
|
loglinButton.setToolTipText("Toggle between a linear and a log scale on the y-axis.");
|
||||||
LOGButton.addActionListener(new ActionListener() {
|
loglinButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
m_PlotArea.toggleLog();
|
plotArea.toggleLog();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JButton ExportButton = new JButton("Export to TSV");
|
JButton exportButton = new JButton("Export to TSV");
|
||||||
ExportButton.setToolTipText("Exports the graph data to a simple TSV file.");
|
exportButton.setToolTipText("Exports the graph data to a simple TSV file.");
|
||||||
ExportButton.addActionListener(new ActionListener() {
|
exportButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
exportPlot();
|
exportPlot();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
JButton DumpButton = new JButton("Dump");
|
JButton dumpButton = new JButton("Dump");
|
||||||
DumpButton.setToolTipText("Dump the graph data to standard output");
|
dumpButton.setToolTipText("Dump the graph data to standard output");
|
||||||
DumpButton.addActionListener(new ActionListener() {
|
dumpButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
m_PlotArea.exportToAscii();
|
plotArea.exportToAscii();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -138,10 +131,10 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
try {
|
try {
|
||||||
Robot robot = new Robot();
|
Robot robot = new Robot();
|
||||||
Rectangle area;
|
Rectangle area;
|
||||||
area = m_Frame.getBounds();
|
area = internalFrame.getBounds();
|
||||||
BufferedImage bufferedImage = robot.createScreenCapture(area);
|
BufferedImage bufferedImage = robot.createScreenCapture(area);
|
||||||
JFileChooser fc = new JFileChooser();
|
JFileChooser fc = new JFileChooser();
|
||||||
if (fc.showSaveDialog(m_Frame) != JFileChooser.APPROVE_OPTION) {
|
if (fc.showSaveDialog(internalFrame) != JFileChooser.APPROVE_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// System.out.println("Name " + outfile);
|
// System.out.println("Name " + outfile);
|
||||||
@@ -191,13 +184,10 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
buttonPan.add(ClearButton);
|
buttonPan.add(clearButton);
|
||||||
buttonPan.add(LOGButton);
|
buttonPan.add(loglinButton);
|
||||||
buttonPan.add(DumpButton);
|
buttonPan.add(dumpButton);
|
||||||
buttonPan.add(ExportButton);
|
buttonPan.add(exportButton);
|
||||||
// m_ButtonPanel.add(PrintButton);
|
|
||||||
// m_ButtonPanel.add(OpenButton);
|
|
||||||
// m_ButtonPanel.add(SaveButton);
|
|
||||||
buttonPan.add(saveImageButton);
|
buttonPan.add(saveImageButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,47 +196,47 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
m_Frame = 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);
|
||||||
// m_Frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
// internalFrame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
|
||||||
|
|
||||||
m_ButtonPanel = new JPanel();
|
m_ButtonPanel = new JPanel();
|
||||||
m_PlotArea = new FunctionArea(xAxisText, yAxisText);
|
plotArea = new FunctionArea(xAxisText, yAxisText);
|
||||||
m_ButtonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
|
m_ButtonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
|
||||||
|
|
||||||
installButtons(m_ButtonPanel);
|
installButtons(m_ButtonPanel);
|
||||||
|
|
||||||
// getContentPane().smultetLayout( new GridLayout(1, 4) );
|
// getContentPane().smultetLayout( new GridLayout(1, 4) );
|
||||||
m_Frame.add(m_ButtonPanel, BorderLayout.PAGE_END);
|
internalFrame.add(m_ButtonPanel, BorderLayout.PAGE_END);
|
||||||
m_Frame.add(m_PlotArea, BorderLayout.CENTER); // north was not so
|
internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so
|
||||||
// nice
|
// nice
|
||||||
m_Frame.addInternalFrameListener(new InternalFrameAdapter() {
|
internalFrame.addInternalFrameListener(new InternalFrameAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void internalFrameClosing(InternalFrameEvent e) {
|
public void internalFrameClosing(InternalFrameEvent e) {
|
||||||
super.internalFrameClosing(e);
|
super.internalFrameClosing(e);
|
||||||
m_PlotArea.clearAll(); // this was a memory leak
|
plotArea.clearAll(); // this was a memory leak
|
||||||
m_PlotArea = null;
|
plotArea = null;
|
||||||
m_Frame.dispose();
|
internalFrame.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
m_Frame.pack();
|
internalFrame.pack();
|
||||||
m_Frame.setVisible(true);
|
internalFrame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate whether graph legend entries should show their unique number.
|
* Indicate whether graph legend entries should show their unique number.
|
||||||
*/
|
*/
|
||||||
public void setAppendIndexInLegend(boolean appendIndexInLegend) {
|
public void setAppendIndexInLegend(boolean appendIndexInLegend) {
|
||||||
this.m_PlotArea.setAppendIndexInLegend(appendIndexInLegend);
|
this.plotArea.setAppendIndexInLegend(appendIndexInLegend);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether graph legend entries show their unique number.
|
* Indicates whether graph legend entries show their unique number.
|
||||||
*/
|
*/
|
||||||
public boolean isAppendIndexInLegend() {
|
public boolean isAppendIndexInLegend() {
|
||||||
return m_PlotArea.isAppendIndexInLegend();
|
return plotArea.isAppendIndexInLegend();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,7 +245,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
* @return true if the graphs are annotated by tool tip info strings
|
* @return true if the graphs are annotated by tool tip info strings
|
||||||
*/
|
*/
|
||||||
public boolean isShowGraphToolTips() {
|
public boolean isShowGraphToolTips() {
|
||||||
return m_PlotArea.isShowGraphToolTips();
|
return plotArea.isShowGraphToolTips();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -265,7 +255,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
* tip info strings
|
* tip info strings
|
||||||
*/
|
*/
|
||||||
public void setShowGraphToolTips(boolean doShowGraphToolTips) {
|
public void setShowGraphToolTips(boolean doShowGraphToolTips) {
|
||||||
m_PlotArea.setShowGraphToolTips(doShowGraphToolTips);
|
plotArea.setShowGraphToolTips(doShowGraphToolTips);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -298,9 +288,9 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setPreferredSize(Dimension prefSize) {
|
public void setPreferredSize(Dimension prefSize) {
|
||||||
if (m_Frame != null) {
|
if (internalFrame != null) {
|
||||||
m_Frame.setPreferredSize(prefSize);
|
internalFrame.setPreferredSize(prefSize);
|
||||||
m_Frame.pack();
|
internalFrame.pack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +301,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return (m_Frame != null) && (m_PlotArea != null);
|
return (internalFrame != null) && (plotArea != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -319,12 +309,12 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setConnectedPoint(double x, double y, int func) {
|
public void setConnectedPoint(double x, double y, int func) {
|
||||||
m_PlotArea.setConnectedPoint(x, y, func);
|
plotArea.setConnectedPoint(x, y, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPointCount(int graphLabel) {
|
public int getPointCount(int graphLabel) {
|
||||||
return m_PlotArea.getPointCount(graphLabel);
|
return plotArea.getPointCount(graphLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,7 +322,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addGraph(int g1, int g2, boolean forceAdd) {
|
public void addGraph(int g1, int g2, boolean forceAdd) {
|
||||||
m_PlotArea.addGraph(g1, g2, forceAdd);
|
plotArea.addGraph(g1, g2, forceAdd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -340,7 +330,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
public void setUnconnectedPoint(double x, double y, int GraphLabel) {
|
||||||
m_PlotArea.setUnconnectedPoint(x, y, GraphLabel);
|
plotArea.setUnconnectedPoint(x, y, GraphLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -348,10 +338,10 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clearAll() {
|
public void clearAll() {
|
||||||
m_PlotArea.clearAll();
|
plotArea.clearAll();
|
||||||
m_PlotArea.removeAllDElements();
|
plotArea.removeAllDElements();
|
||||||
m_PlotArea.clearLegend();
|
plotArea.clearLegend();
|
||||||
m_Frame.repaint();
|
internalFrame.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -359,7 +349,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void clearGraph(int GraphNumber) {
|
public void clearGraph(int GraphNumber) {
|
||||||
m_PlotArea.clearGraph(GraphNumber);
|
plotArea.clearGraph(GraphNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -367,7 +357,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setInfoString(int GraphLabel, String Info, float stroke) {
|
public void setInfoString(int GraphLabel, String Info, float stroke) {
|
||||||
m_PlotArea.setInfoString(GraphLabel, Info, stroke);
|
plotArea.setInfoString(GraphLabel, Info, stroke);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -375,18 +365,18 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void jump() {
|
public void jump() {
|
||||||
m_PlotArea.jump();
|
plotArea.jump();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
protected Object openObject() {
|
protected Object openObject() {
|
||||||
if (m_FileChooser == null) {
|
if (fileChooser == null) {
|
||||||
createFileChooser();
|
createFileChooser();
|
||||||
}
|
}
|
||||||
int returnVal = m_FileChooser.showOpenDialog(m_Frame);
|
int returnVal = fileChooser.showOpenDialog(internalFrame);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File selected = m_FileChooser.getSelectedFile();
|
File selected = fileChooser.getSelectedFile();
|
||||||
try {
|
try {
|
||||||
ObjectInputStream oi = new ObjectInputStream(
|
ObjectInputStream oi = new ObjectInputStream(
|
||||||
new BufferedInputStream(new FileInputStream(selected)));
|
new BufferedInputStream(new FileInputStream(selected)));
|
||||||
@@ -399,7 +389,7 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
JOptionPane.showMessageDialog(m_Frame, "Couldn't read object: "
|
JOptionPane.showMessageDialog(internalFrame, "Couldn't read object: "
|
||||||
+ selected.getName() + "\n" + ex.getMessage(),
|
+ selected.getName() + "\n" + ex.getMessage(),
|
||||||
"Open object file", JOptionPane.ERROR_MESSAGE);
|
"Open object file", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
@@ -411,28 +401,28 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
* Just dump the plot to stdout.
|
* Just dump the plot to stdout.
|
||||||
*/
|
*/
|
||||||
protected void dumpPlot() {
|
protected void dumpPlot() {
|
||||||
m_PlotArea.exportToAscii();
|
plotArea.exportToAscii();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void exportPlot() {
|
protected void exportPlot() {
|
||||||
if (m_FileChooser == null) {
|
if (fileChooser == null) {
|
||||||
createFileChooser();
|
createFileChooser();
|
||||||
}
|
}
|
||||||
int returnVal = m_FileChooser.showSaveDialog(m_Frame);
|
int returnVal = fileChooser.showSaveDialog(internalFrame);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File sFile = m_FileChooser.getSelectedFile();
|
File sFile = fileChooser.getSelectedFile();
|
||||||
if (sFile.exists()) {
|
if (sFile.exists()) {
|
||||||
returnVal = JOptionPane.showConfirmDialog(m_Frame, "The file "
|
returnVal = JOptionPane.showConfirmDialog(internalFrame, "The file "
|
||||||
+ sFile.getName() + " already exists. Overwrite?");
|
+ sFile.getName() + " already exists. Overwrite?");
|
||||||
if (returnVal != JOptionPane.YES_OPTION) {
|
if (returnVal != JOptionPane.YES_OPTION) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(m_PlotArea.exportToAscii(sFile))) {
|
if (!(plotArea.exportToAscii(sFile))) {
|
||||||
JOptionPane.showMessageDialog(m_Frame,
|
JOptionPane.showMessageDialog(internalFrame,
|
||||||
"Couldn't write to file: " + sFile.getName(),
|
"Couldn't write to file: " + sFile.getName(),
|
||||||
"Export error", JOptionPane.ERROR_MESSAGE);
|
"Export error", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
@@ -443,19 +433,19 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void saveObject(Object object) {
|
protected void saveObject(Object object) {
|
||||||
if (m_FileChooser == null) {
|
if (fileChooser == null) {
|
||||||
createFileChooser();
|
createFileChooser();
|
||||||
}
|
}
|
||||||
int returnVal = m_FileChooser.showSaveDialog(m_Frame);
|
int returnVal = fileChooser.showSaveDialog(internalFrame);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
File sFile = m_FileChooser.getSelectedFile();
|
File sFile = fileChooser.getSelectedFile();
|
||||||
try {
|
try {
|
||||||
ObjectOutputStream oo = new ObjectOutputStream(
|
ObjectOutputStream oo = new ObjectOutputStream(
|
||||||
new BufferedOutputStream(new FileOutputStream(sFile)));
|
new BufferedOutputStream(new FileOutputStream(sFile)));
|
||||||
oo.writeObject(object);
|
oo.writeObject(object);
|
||||||
oo.close();
|
oo.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
JOptionPane.showMessageDialog(m_Frame,
|
JOptionPane.showMessageDialog(internalFrame,
|
||||||
"Couldn't write to file: " + sFile.getName() + "\n"
|
"Couldn't write to file: " + sFile.getName() + "\n"
|
||||||
+ ex.getMessage(), "Save object",
|
+ ex.getMessage(), "Save object",
|
||||||
JOptionPane.ERROR_MESSAGE);
|
JOptionPane.ERROR_MESSAGE);
|
||||||
@@ -467,8 +457,8 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void createFileChooser() {
|
protected void createFileChooser() {
|
||||||
m_FileChooser = new JFileChooser(new File("/resources"));
|
fileChooser = new JFileChooser(new File("/resources"));
|
||||||
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,15 +473,15 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public FunctionArea getFunctionArea() {
|
public FunctionArea getFunctionArea() {
|
||||||
return m_PlotArea;
|
return plotArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
m_Frame.dispose();
|
internalFrame.dispose();
|
||||||
m_Frame = null;
|
internalFrame = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -512,22 +502,4 @@ public class Plot implements PlotInterface, Serializable {
|
|||||||
public void recolorAllGraphsByIndex() {
|
public void recolorAllGraphsByIndex() {
|
||||||
getFunctionArea().recolorAllGraphsByIndex();
|
getFunctionArea().recolorAllGraphsByIndex();
|
||||||
}
|
}
|
||||||
// /**
|
|
||||||
// * Just for testing the Plot class.
|
|
||||||
// */
|
|
||||||
// public static void main( String[] args ){
|
|
||||||
// Plot plot = new Plot("Plot-Test","x-value","y-value");
|
|
||||||
// plot.init();
|
|
||||||
// double x;
|
|
||||||
// for (x= 0; x <6000; x++) {
|
|
||||||
// //double y = SpecialFunction.getnormcdf(x);
|
|
||||||
// // double yy = 0.5*SpecialFunction.getnormpdf(x);
|
|
||||||
// double n = Math.sin(((double)x/1000*Math.PI));
|
|
||||||
// //plot.setConnectedPoint(x,Math.sin(x),0);
|
|
||||||
// //plot.setConnectedPoint(x,Math.cos(x),1);
|
|
||||||
// //plot.setConnectedPoint(x,y,0);
|
|
||||||
// plot.setConnectedPoint(x,n,1);
|
|
||||||
// }
|
|
||||||
// //plot.addGraph(1,2);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
@@ -59,11 +59,11 @@ public class TopoPlot extends Plot {
|
|||||||
* @param color_scale the topologies color coding. Values (0-3) are valid. @See ColorBarCalculator.
|
* @param color_scale the topologies color coding. Values (0-3) are valid. @See ColorBarCalculator.
|
||||||
*/
|
*/
|
||||||
public void setParams(int gridX, int gridY, int color_scale) {
|
public void setParams(int gridX, int gridY, int color_scale) {
|
||||||
if (gridX > m_Frame.getWidth()) {
|
if (gridX > internalFrame.getWidth()) {
|
||||||
gridX = m_Frame.getWidth();
|
gridX = internalFrame.getWidth();
|
||||||
}
|
}
|
||||||
if (gridY > m_Frame.getHeight()) {
|
if (gridY > internalFrame.getHeight()) {
|
||||||
gridY = m_Frame.getHeight();
|
gridY = internalFrame.getHeight();
|
||||||
}
|
}
|
||||||
gridx = gridX;
|
gridx = gridX;
|
||||||
gridy = gridY;
|
gridy = gridY;
|
||||||
@@ -145,7 +145,7 @@ public class TopoPlot extends Plot {
|
|||||||
fitRange = java.lang.Math.abs(max - min);
|
fitRange = java.lang.Math.abs(max - min);
|
||||||
ColorBarCalculator colorBar = new ColorBarCalculator(colorScale);
|
ColorBarCalculator colorBar = new ColorBarCalculator(colorScale);
|
||||||
|
|
||||||
m_Frame.setVisible(false);
|
internalFrame.setVisible(false);
|
||||||
for (int x = 0; x < gridx; x++) {
|
for (int x = 0; x < gridx; x++) {
|
||||||
for (int y = 0; y < gridy; y++) {
|
for (int y = 0; y < gridy; y++) {
|
||||||
pos[0] = border[0][0] + x * deltaX;
|
pos[0] = border[0][0] + x * deltaX;
|
||||||
@@ -156,7 +156,7 @@ public class TopoPlot extends Plot {
|
|||||||
// Color color = new Color(colorBar.getRGB((float)(problem.functionValue(pos)/fitRange))); // Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
// Color color = new Color(colorBar.getRGB((float)(problem.functionValue(pos)/fitRange))); // Color color = new Color(255,(int)(problem.doEvaluation(pos)[0]/fitRange*255),(int)(problem.doEvaluation(pos)[0]/fitRange*255));
|
||||||
rect.setColor(color);
|
rect.setColor(color);
|
||||||
rect.setFillColor(color);
|
rect.setFillColor(color);
|
||||||
m_PlotArea.addDElement(rect);
|
plotArea.addDElement(rect);
|
||||||
} // for y
|
} // for y
|
||||||
} // for x
|
} // for x
|
||||||
if (withGradientsIfAvailable && (problem instanceof InterfaceFirstOrderDerivableProblem)) {
|
if (withGradientsIfAvailable && (problem instanceof InterfaceFirstOrderDerivableProblem)) {
|
||||||
@@ -172,6 +172,6 @@ public class TopoPlot extends Plot {
|
|||||||
} // for y
|
} // for y
|
||||||
} // for x
|
} // for x
|
||||||
}
|
}
|
||||||
m_Frame.setVisible(true);
|
internalFrame.setVisible(true);
|
||||||
} // setTopology
|
} // setTopology
|
||||||
} // class
|
} // class
|
||||||
|
@@ -186,7 +186,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
errMsg = "check console output for error messages.";
|
errMsg = "check console output for error messages.";
|
||||||
}
|
}
|
||||||
errMsg = "Exception in Processor: " + errMsg;
|
errMsg = "Exception in Processor: " + errMsg;
|
||||||
LOGGER.log(Level.SEVERE, e.getMessage(), e);
|
e.printStackTrace();
|
||||||
|
LOGGER.log(Level.SEVERE, errMsg, e);
|
||||||
try {
|
try {
|
||||||
JOptionPane.showMessageDialog(null, StringTools.wrapLine(errMsg, 60, 0.2), "Error in Optimization", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(null, StringTools.wrapLine(errMsg, 60, 0.2), "Error in Optimization", JOptionPane.ERROR_MESSAGE);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
@@ -345,7 +345,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
|
|||||||
// popRep = new DPointSet();
|
// popRep = new DPointSet();
|
||||||
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(i);
|
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(i);
|
||||||
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
||||||
// plot.m_PlotArea.addDElement(popRep);
|
// plot.plotArea.addDElement(popRep);
|
||||||
// //System.out.println("Adding" + i + " : ("+tmpIndy1.getDoubleData()[0]+"/"+tmpIndy1.getDoubleData()[1]+")");
|
// //System.out.println("Adding" + i + " : ("+tmpIndy1.getDoubleData()[0]+"/"+tmpIndy1.getDoubleData()[1]+")");
|
||||||
// for (int j = i; j < pop.size(); j++) {
|
// for (int j = i; j < pop.size(); j++) {
|
||||||
// if (ConnectionMatrix[i][j]) {
|
// if (ConnectionMatrix[i][j]) {
|
||||||
@@ -355,7 +355,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
|
|||||||
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
||||||
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(j);
|
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(j);
|
||||||
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
||||||
// plot.m_PlotArea.addDElement(popRep);
|
// plot.plotArea.addDElement(popRep);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
@@ -45,7 +45,7 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractStatistics implements InterfaceTextListener, InterfaceStatistics {
|
public abstract class AbstractStatistics implements InterfaceTextListener, InterfaceStatistics {
|
||||||
private transient PrintWriter resultOut;
|
private transient PrintWriter resultOut;
|
||||||
protected InterfaceStatisticsParameter m_StatsParams;
|
protected InterfaceStatisticsParameter statisticsParameter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keep track of all intermediate fitness values, best, avg. and worst, averaging over all runs
|
* Keep track of all intermediate fitness values, best, avg. and worst, averaging over all runs
|
||||||
@@ -169,7 +169,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
if (dataListeners != null) {
|
if (dataListeners != null) {
|
||||||
for (InterfaceStatisticsListener l : dataListeners) {
|
for (InterfaceStatisticsListener l : dataListeners) {
|
||||||
if (start) {
|
if (start) {
|
||||||
l.notifyRunStarted(runNumber, m_StatsParams.getMultiRuns(),
|
l.notifyRunStarted(runNumber, statisticsParameter.getMultiRuns(),
|
||||||
currentStatHeader, currentStatMetaInfo);
|
currentStatHeader, currentStatMetaInfo);
|
||||||
} else {
|
} else {
|
||||||
l.notifyRunStopped(optRunsPerformed, normal);
|
l.notifyRunStopped(optRunsPerformed, normal);
|
||||||
@@ -203,9 +203,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
String startDate = getDateString();
|
String startDate = getDateString();
|
||||||
// open the result file:
|
// open the result file:
|
||||||
if (doFileOutput() // not "text-window only"
|
if (doFileOutput() // not "text-window only"
|
||||||
&& (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE)) { // verbosity accordingly high
|
&& (statisticsParameter.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE)) { // verbosity accordingly high
|
||||||
//!resFName.equalsIgnoreCase("none") && !resFName.equals("")) {
|
//!resFName.equalsIgnoreCase("none") && !resFName.equals("")) {
|
||||||
String fnameBase = makeOutputFileName(m_StatsParams.getResultFilePrefix(), infoString, startDate);
|
String fnameBase = makeOutputFileName(statisticsParameter.getResultFilePrefix(), infoString, startDate);
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
String fname = fnameBase;
|
String fname = fnameBase;
|
||||||
while (new File(fname).exists()) {
|
while (new File(fname).exists()) {
|
||||||
@@ -236,7 +236,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected boolean doFileOutput() {
|
protected boolean doFileOutput() {
|
||||||
return (m_StatsParams.getOutputTo().getSelectedTagID() != 1); // not "text-window only"
|
return (statisticsParameter.getOutputTo().getSelectedTagID() != 1); // not "text-window only"
|
||||||
}
|
}
|
||||||
|
|
||||||
private String makeOutputFileName(String prefix, String infoString, String startDate) {
|
private String makeOutputFileName(String prefix, String infoString, String startDate) {
|
||||||
@@ -258,8 +258,8 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
|
|
||||||
if (runNumber == 0) {
|
if (runNumber == 0) {
|
||||||
// store the intial graph selection state, so that modifications during runtime cannot cause inconsistencies
|
// store the intial graph selection state, so that modifications during runtime cannot cause inconsistencies
|
||||||
lastFieldSelection = (StringSelection) m_StatsParams.getFieldSelection().clone();
|
lastFieldSelection = (StringSelection) statisticsParameter.getFieldSelection().clone();
|
||||||
lastIsShowFull = m_StatsParams.isOutputAllFieldsAsText();
|
lastIsShowFull = statisticsParameter.isOutputAllFieldsAsText();
|
||||||
|
|
||||||
currentStatDoubleData = null;
|
currentStatDoubleData = null;
|
||||||
currentStatObjectData = null;
|
currentStatObjectData = null;
|
||||||
@@ -273,7 +273,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
optRunsPerformed = 0;
|
optRunsPerformed = 0;
|
||||||
convergenceCnt = 0;
|
convergenceCnt = 0;
|
||||||
if (saveParams) {
|
if (saveParams) {
|
||||||
m_StatsParams.saveInstance();
|
statisticsParameter.saveInstance();
|
||||||
}
|
}
|
||||||
initOutput(infoString);
|
initOutput(infoString);
|
||||||
bestIndyAllRuns = null;
|
bestIndyAllRuns = null;
|
||||||
@@ -349,7 +349,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
// check if target zero was reached
|
// check if target zero was reached
|
||||||
if (bestCurrentIndy != null) {
|
if (bestCurrentIndy != null) {
|
||||||
if (Mathematics.norm(bestOfRunIndy.getFitness()) < this.m_StatsParams.getConvergenceRateThreshold()) {
|
if (Mathematics.norm(bestOfRunIndy.getFitness()) < this.statisticsParameter.getConvergenceRateThreshold()) {
|
||||||
convergenceCnt++;
|
convergenceCnt++;
|
||||||
}
|
}
|
||||||
if (printRunStoppedVerbosity()) {
|
if (printRunStoppedVerbosity()) {
|
||||||
@@ -414,7 +414,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postProcessingPerformed(Population resultPop) { // called from processor
|
public void postProcessingPerformed(Population resultPop) { // called from processor
|
||||||
if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= m_StatsParams.getMultiRuns()) {
|
if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= statisticsParameter.getMultiRuns()) {
|
||||||
printToTextListener("\n");
|
printToTextListener("\n");
|
||||||
}
|
}
|
||||||
if (printRunStoppedVerbosity()) {
|
if (printRunStoppedVerbosity()) {
|
||||||
@@ -426,7 +426,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (optRunsPerformed >= m_StatsParams.getMultiRuns()) {
|
if (optRunsPerformed >= statisticsParameter.getMultiRuns()) {
|
||||||
finalizeOutput();
|
finalizeOutput();
|
||||||
fireDataListenersFinalize();
|
fireDataListenersFinalize();
|
||||||
}
|
}
|
||||||
@@ -480,7 +480,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
|
|
||||||
protected void finalizeOutput() {
|
protected void finalizeOutput() {
|
||||||
if (printFinalVerbosity()) {
|
if (printFinalVerbosity()) {
|
||||||
printToTextListener("*******\n Runs performed: " + optRunsPerformed + ", reached target " + convergenceCnt + " times with threshold " + m_StatsParams.getConvergenceRateThreshold() + ", rate " + convergenceCnt / (double) m_StatsParams.getMultiRuns() + '\n');
|
printToTextListener("*******\n Runs performed: " + optRunsPerformed + ", reached target " + convergenceCnt + " times with threshold " + statisticsParameter.getConvergenceRateThreshold() + ", rate " + convergenceCnt / (double) statisticsParameter.getMultiRuns() + '\n');
|
||||||
}
|
}
|
||||||
if (printFinalVerbosity()) {
|
if (printFinalVerbosity()) {
|
||||||
printToTextListener(" Average function calls: " + (functionCallSum / optRunsPerformed) + "\n");
|
printToTextListener(" Average function calls: " + (functionCallSum / optRunsPerformed) + "\n");
|
||||||
@@ -660,7 +660,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
resultOut.print(s);
|
resultOut.print(s);
|
||||||
}
|
}
|
||||||
for (InterfaceTextListener l : textListeners) {
|
for (InterfaceTextListener l : textListeners) {
|
||||||
if (m_StatsParams.getOutputTo().getSelectedTagID() >= 1) {
|
if (statisticsParameter.getOutputTo().getSelectedTagID() >= 1) {
|
||||||
l.print(s);
|
l.print(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -681,7 +681,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InterfaceStatisticsParameter getStatisticsParameter() {
|
public InterfaceStatisticsParameter getStatisticsParameter() {
|
||||||
return m_StatsParams;
|
return statisticsParameter;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean doTextOutput() {
|
protected boolean doTextOutput() {
|
||||||
@@ -693,7 +693,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* concatenate them to a string using the textFieldDelimiter of the instance.
|
* concatenate them to a string using the textFieldDelimiter of the instance.
|
||||||
*
|
*
|
||||||
* @param informerList
|
* @param informerList
|
||||||
* @param pop
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getOutputHeaderFieldNamesAsString(List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected String getOutputHeaderFieldNamesAsString(List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
@@ -706,7 +705,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* The length of this list depends on the field selection state.
|
* The length of this list depends on the field selection state.
|
||||||
*
|
*
|
||||||
* @param informerList
|
* @param informerList
|
||||||
* @param pop
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected List<String> getOutputHeaderFieldNames(List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected List<String> getOutputHeaderFieldNames(List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
@@ -723,7 +721,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* The length of this list depends on the field selection state.
|
* The length of this list depends on the field selection state.
|
||||||
*
|
*
|
||||||
* @param informerList
|
* @param informerList
|
||||||
* @param pop
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected List<String> getOutputMetaInfo(List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected List<String> getOutputMetaInfo(List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
@@ -756,12 +753,11 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
GraphSelectionEnum[] vals = GraphSelectionEnum.values();
|
GraphSelectionEnum[] vals = GraphSelectionEnum.values();
|
||||||
ArrayList<String> headerEntries = new ArrayList<String>();
|
ArrayList<String> headerEntries = new ArrayList<String>();
|
||||||
headerEntries.add("FunctionCalls");
|
headerEntries.add("FunctionCalls");
|
||||||
for (int i = 0; i < vals.length; i++) {
|
for (GraphSelectionEnum val : vals) {
|
||||||
if (isRequestedField(vals[i])) {
|
if (isRequestedField(val)) {
|
||||||
headerEntries.add(vals[i].toString());
|
headerEntries.add(val.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return new String[]{"Fun.calls","Best","Mean", "Worst"};
|
|
||||||
return headerEntries.toArray(new String[headerEntries.size()]);
|
return headerEntries.toArray(new String[headerEntries.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,7 +778,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
headerInfo.add(GraphSelectionEnum.getInfoStrings()[i]);
|
headerInfo.add(GraphSelectionEnum.getInfoStrings()[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// return new String[]{"Fun.calls","Best","Mean", "Worst"};
|
|
||||||
return headerInfo.toArray(new String[headerInfo.size()]);
|
return headerInfo.toArray(new String[headerInfo.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -829,7 +824,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
protected Object[] getSimpleOutputValues() {
|
protected Object[] getSimpleOutputValues() {
|
||||||
GraphSelectionEnum[] selEnumVals = null;
|
GraphSelectionEnum[] selEnumVals = null;
|
||||||
selEnumVals = GraphSelectionEnum.values();
|
selEnumVals = GraphSelectionEnum.values();
|
||||||
// else selEnumVals = (GraphSelectionEnum[]) (m_StatsParams.getGraphSelection().getSelectedEnum(GraphSelectionEnum.values()));
|
|
||||||
Object[] ret = new Object[1 + selEnumVals.length];
|
Object[] ret = new Object[1 + selEnumVals.length];
|
||||||
ret[0] = functionCalls;
|
ret[0] = functionCalls;
|
||||||
for (int i = 1; i <= selEnumVals.length; i++) {
|
for (int i = 1; i <= selEnumVals.length; i++) {
|
||||||
@@ -869,15 +863,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
// all standard fields should be filled now
|
// all standard fields should be filled now
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// Object[] ret = new Object[4];
|
|
||||||
// ret[0]=functionCalls;
|
|
||||||
// ret[1]=currentBestFit;
|
|
||||||
// if (meanFitness!=null) ret[2]=meanFitness;
|
|
||||||
// else ret[2]="#";
|
|
||||||
// if (currentWorstFit!=null) ret[3] = currentWorstFit;
|
|
||||||
// else ret[3]="#";
|
|
||||||
// return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -890,7 +875,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* @param informerList
|
* @param informerList
|
||||||
* @param pop
|
* @param pop
|
||||||
* @return
|
* @return
|
||||||
* @see #getOutputHeader(List, PopulationInterface)
|
* @see #getOutputHeaderFieldNames(java.util.List) (List)
|
||||||
*/
|
*/
|
||||||
protected List<Object> getOutputValues(List<InterfaceAdditionalPopulationInformer> informerList, PopulationInterface pop) {
|
protected List<Object> getOutputValues(List<InterfaceAdditionalPopulationInformer> informerList, PopulationInterface pop) {
|
||||||
LinkedList<Object> values = new LinkedList<Object>();
|
LinkedList<Object> values = new LinkedList<Object>();
|
||||||
@@ -1168,7 +1153,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String[] getCurrentFieldHeaders() {
|
public String[] getCurrentFieldHeaders() {
|
||||||
StringSelection fSel = m_StatsParams.getFieldSelection();
|
StringSelection fSel = statisticsParameter.getFieldSelection();
|
||||||
return fSel.getSelected();
|
return fSel.getSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1274,22 +1259,22 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean printLineByVerbosity(int iteration) {
|
private boolean printLineByVerbosity(int iteration) {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_KTH_IT)
|
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
|| ((m_StatsParams.getOutputVerbosity().getSelectedTagID() == StatisticsParameter.VERBOSITY_KTH_IT)
|
|| ((statisticsParameter.getOutputVerbosity().getSelectedTagID() == StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
&& (isKthRun(iteration, m_StatsParams.getOutputVerbosityK())));
|
&& (isKthRun(iteration, statisticsParameter.getOutputVerbosityK())));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printRunIntroVerbosity() {
|
private boolean printRunIntroVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT)
|
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT)
|
||||||
|| (optRunsPerformed == 0 && (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_FINAL));
|
|| (optRunsPerformed == 0 && (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_FINAL));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printRunStoppedVerbosity() {
|
private boolean printRunStoppedVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean printFinalVerbosity() {
|
private boolean printFinalVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE);
|
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isKthRun(int i, int k) {
|
private boolean isKthRun(int i, int k) {
|
||||||
@@ -1309,7 +1294,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean printHeaderByVerbosity() {
|
private boolean printHeaderByVerbosity() {
|
||||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void divideMean(Double[] mean, double d) {
|
private static void divideMean(Double[] mean, double d) {
|
||||||
@@ -1318,9 +1303,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
mean[j] /= d;
|
mean[j] /= d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for (int i=0; i<mean.length; i++) {
|
|
||||||
// for (int j=0; j<mean[i].length; j++) mean[i][j] /= d;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -44,7 +44,7 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
|||||||
|
|
||||||
public StatisticsStandalone(InterfaceStatisticsParameter statParams) {
|
public StatisticsStandalone(InterfaceStatisticsParameter statParams) {
|
||||||
super();
|
super();
|
||||||
m_StatsParams = statParams;
|
statisticsParameter = statParams;
|
||||||
try {
|
try {
|
||||||
m_MyHostName = InetAddress.getLocalHost().getHostName();
|
m_MyHostName = InetAddress.getLocalHost().getHostName();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -58,14 +58,14 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
|||||||
|
|
||||||
public StatisticsStandalone(String resultFileName, int multiRuns, int verbosity, boolean outputAllFieldsAsText) {
|
public StatisticsStandalone(String resultFileName, int multiRuns, int verbosity, boolean outputAllFieldsAsText) {
|
||||||
this(StatisticsParameter.getInstance(false));
|
this(StatisticsParameter.getInstance(false));
|
||||||
m_StatsParams.setMultiRuns(multiRuns);
|
statisticsParameter.setMultiRuns(multiRuns);
|
||||||
m_StatsParams.setOutputVerbosity(m_StatsParams.getOutputVerbosity().setSelectedTag(verbosity));
|
statisticsParameter.setOutputVerbosity(statisticsParameter.getOutputVerbosity().setSelectedTag(verbosity));
|
||||||
m_StatsParams.setResultFilePrefix(resultFileName);
|
statisticsParameter.setResultFilePrefix(resultFileName);
|
||||||
m_StatsParams.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
statisticsParameter.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
||||||
if (resultFileName == null) {
|
if (resultFileName == null) {
|
||||||
m_StatsParams.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_WINDOW);
|
statisticsParameter.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_WINDOW);
|
||||||
} else {
|
} else {
|
||||||
m_StatsParams.setOutputTo(m_StatsParams.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_FILE));
|
statisticsParameter.setOutputTo(statisticsParameter.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_FILE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,13 +76,13 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
|||||||
@Override
|
@Override
|
||||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
if (collectData) {
|
if (collectData) {
|
||||||
m_ResultData = new ArrayList<ArrayList<Object[]>>(m_StatsParams.getMultiRuns());
|
m_ResultData = new ArrayList<ArrayList<Object[]>>(statisticsParameter.getMultiRuns());
|
||||||
List<String> description = getOutputHeaderFieldNames(informerList);
|
List<String> description = getOutputHeaderFieldNames(informerList);
|
||||||
m_ResultHeaderStrings = new ArrayList<String>();
|
m_ResultHeaderStrings = new ArrayList<String>();
|
||||||
for (String str : description) {
|
for (String str : description) {
|
||||||
m_ResultHeaderStrings.add(str);
|
m_ResultHeaderStrings.add(str);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < m_StatsParams.getMultiRuns(); i++) {
|
for (int i = 0; i < statisticsParameter.getMultiRuns(); i++) {
|
||||||
m_ResultData.add(new ArrayList<Object[]>());
|
m_ResultData.add(new ArrayList<Object[]>());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -109,11 +109,6 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getHostName() {
|
|
||||||
return m_MyHostName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether data collection is activated, which stores an Object[] for every iteration and
|
* Check whether data collection is activated, which stores an Object[] for every iteration and
|
||||||
* every multi-run.
|
* every multi-run.
|
||||||
|
@@ -1,16 +1,5 @@
|
|||||||
package eva2.optimization.stat;
|
package eva2.optimization.stat;
|
||||||
|
|
||||||
/*
|
|
||||||
* Title: EvA2
|
|
||||||
* Description:
|
|
||||||
* Copyright: Copyright (c) 2003
|
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
|
||||||
* @version: $Revision: 322 $
|
|
||||||
* $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007) $
|
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
|
||||||
|
|
||||||
import eva2.gui.BeanInspector;
|
import eva2.gui.BeanInspector;
|
||||||
import eva2.gui.plot.Graph;
|
import eva2.gui.plot.Graph;
|
||||||
import eva2.gui.plot.GraphWindow;
|
import eva2.gui.plot.GraphWindow;
|
||||||
@@ -57,7 +46,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public StatisticsWithGUI() {
|
public StatisticsWithGUI() {
|
||||||
m_StatsParams = StatisticsParameter.getInstance(true);
|
statisticsParameter = StatisticsParameter.getInstance(true);
|
||||||
proxyPrinter = new JTextoutputFrame("Optimization Log");
|
proxyPrinter = new JTextoutputFrame("Optimization Log");
|
||||||
addTextListener(proxyPrinter);
|
addTextListener(proxyPrinter);
|
||||||
}
|
}
|
||||||
@@ -82,7 +71,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
public void stopOptPerformed(boolean normal, String stopMessage) {
|
public void stopOptPerformed(boolean normal, String stopMessage) {
|
||||||
super.stopOptPerformed(normal, stopMessage);
|
super.stopOptPerformed(normal, stopMessage);
|
||||||
|
|
||||||
if (optRunsPerformed > m_StatsParams.getMultiRuns()) {
|
if (optRunsPerformed > statisticsParameter.getMultiRuns()) {
|
||||||
// this may happen if the user reduces the multirun parameter during late multiruns
|
// this may happen if the user reduces the multirun parameter during late multiruns
|
||||||
System.err.println("error: more runs performed than defined.");
|
System.err.println("error: more runs performed than defined.");
|
||||||
}
|
}
|
||||||
@@ -93,7 +82,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// unite the graphs only if the break was "normal"
|
// unite the graphs only if the break was "normal"
|
||||||
if ((m_StatsParams.getMultiRuns() > 1) && (statGraph != null)) {
|
if ((statisticsParameter.getMultiRuns() > 1) && (statGraph != null)) {
|
||||||
// unite the point sets for a multirun
|
// unite the point sets for a multirun
|
||||||
for (int i = 0; i < fitnessGraph.length; i++) {
|
for (int i = 0; i < fitnessGraph.length; i++) {
|
||||||
for (int j = 0; j < fitnessGraph[i].length; j++) {
|
for (int j = 0; j < fitnessGraph[i].length; j++) {
|
||||||
@@ -109,7 +98,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PlotInterface p = fitnessFrame[0].getPlotter();
|
PlotInterface p = fitnessFrame[0].getPlotter();
|
||||||
if ((optRunsPerformed >= m_StatsParams.getMultiRuns()) || !normal) {
|
if ((optRunsPerformed >= statisticsParameter.getMultiRuns()) || !normal) {
|
||||||
// update the legend after the last multirun or after a user break
|
// update the legend after the last multirun or after a user break
|
||||||
if ((p != null) && p.isValid()) {
|
if ((p != null) && p.isValid()) {
|
||||||
((Plot) p).getFunctionArea().updateLegend();
|
((Plot) p).getFunctionArea().updateLegend();
|
||||||
@@ -119,13 +108,13 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
|
|
||||||
public void maybeShowProxyPrinter() {
|
public void maybeShowProxyPrinter() {
|
||||||
if (proxyPrinter != null) {
|
if (proxyPrinter != null) {
|
||||||
proxyPrinter.setShow(m_StatsParams.isShowTextOutput());
|
proxyPrinter.setShow(statisticsParameter.isShowTextOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||||
if (m_StatsParams instanceof StatisticsParameter) {
|
if (statisticsParameter instanceof StatisticsParameter) {
|
||||||
graphDesc = lastFieldSelection.getSelectedWithIndex();
|
graphDesc = lastFieldSelection.getSelectedWithIndex();
|
||||||
} else {
|
} else {
|
||||||
graphDesc = null;
|
graphDesc = null;
|
||||||
@@ -133,7 +122,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
maybeShowProxyPrinter();
|
maybeShowProxyPrinter();
|
||||||
int windowCount = 1; // TODO this was earlier description.length for the 2-D String-Array returned by m_StatsParams.getPlotDescriptions, which however always returned an array of length 1 (in the first dim).
|
int windowCount = 1; // TODO this was earlier description.length for the 2-D String-Array returned by statisticsParameter.getPlotDescriptions, which however always returned an array of length 1 (in the first dim).
|
||||||
int graphCount = graphDesc.size();
|
int graphCount = graphDesc.size();
|
||||||
fitnessFrame = new GraphWindow[windowCount];
|
fitnessFrame = new GraphWindow[windowCount];
|
||||||
for (int i = 0; i < fitnessFrame.length; i++) {
|
for (int i = 0; i < fitnessFrame.length; i++) {
|
||||||
@@ -154,14 +143,12 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
fitnessGraph[i][j].jump();
|
fitnessGraph[i][j].jump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_StatsParams.getMultiRuns() > 1
|
if (statisticsParameter.getMultiRuns() > 1
|
||||||
&& m_StatsParams.getUseStatPlot() == true) {
|
&& statisticsParameter.getUseStatPlot() == true) {
|
||||||
// String Info = m_StatsParams.GetInfoString();
|
|
||||||
statGraph = new Graph[windowCount][];
|
statGraph = new Graph[windowCount][];
|
||||||
for (int i = 0; i < statGraph.length; i++) {
|
for (int i = 0; i < statGraph.length; i++) {
|
||||||
statGraph[i] = new Graph[graphCount];
|
statGraph[i] = new Graph[graphCount];
|
||||||
for (int j = 0; j < statGraph[i].length; j++) {
|
for (int j = 0; j < statGraph[i].length; j++) {
|
||||||
// String[] d = (String[]) description.get(i);
|
|
||||||
statGraph[i][j] = fitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_" + //Info +
|
statGraph[i][j] = fitnessFrame[i].getNewGraph(graphDesc.get(j).head + "_" + //Info +
|
||||||
graphInfoString);
|
graphInfoString);
|
||||||
}
|
}
|
||||||
@@ -195,12 +182,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void plotCurrentResults() {
|
protected void plotCurrentResults() {
|
||||||
// m_PlotCounter--;
|
|
||||||
|
|
||||||
// if (m_PlotCounter == 0) {
|
|
||||||
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
|
||||||
int subGraph = 0;
|
int subGraph = 0;
|
||||||
// boolean doPlotAdditionalInfo = m_StatsParams.isOutputAdditionalInfo();
|
|
||||||
for (int i = 0; i < graphDesc.size(); i++) {
|
for (int i = 0; i < graphDesc.size(); i++) {
|
||||||
Integer colIndex = i + 1; // always add one because the function calls are located in column zero
|
Integer colIndex = i + 1; // always add one because the function calls are located in column zero
|
||||||
if (lastIsShowFull) {
|
if (lastIsShowFull) {
|
||||||
@@ -210,11 +192,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
if (currentStatDoubleData[colIndex] != null) {
|
if (currentStatDoubleData[colIndex] != null) {
|
||||||
plotFitnessPoint(0, subGraph++, functionCalls, currentStatDoubleData[colIndex]);
|
plotFitnessPoint(0, subGraph++, functionCalls, currentStatDoubleData[colIndex]);
|
||||||
} else {
|
} else {
|
||||||
// EVAERROR.errorMsgOnce("Error, data field " + graphDesc.get(i).head + " does not contain primitive data and cannot be plotted.");
|
|
||||||
subGraph++; // increase index anyways or the name assignment gets inconsistent
|
subGraph++; // increase index anyways or the name assignment gets inconsistent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -255,9 +235,6 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
printToTextListener(s + "\n");
|
printToTextListener(s + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// m_PlotCounter--;
|
|
||||||
// if (m_PlotCounter == 0) {
|
|
||||||
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int i = 0; i < fitnessGraph.length; i++) {
|
for (int i = 0; i < fitnessGraph.length; i++) {
|
||||||
for (int j = 0; j < fitnessGraph[i].length; j++) {
|
for (int j = 0; j < fitnessGraph[i].length; j++) {
|
||||||
|
@@ -1713,7 +1713,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
|
|||||||
point.setIcon(icon);
|
point.setIcon(icon);
|
||||||
popRep.addDPoint(point);
|
popRep.addDPoint(point);
|
||||||
}
|
}
|
||||||
this.m_TopologyMainSwarm.m_PlotArea.addDElement(popRep); */
|
this.m_TopologyMainSwarm.plotArea.addDElement(popRep); */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2098,14 +2098,14 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
|
|||||||
//
|
//
|
||||||
// synchronized(m_TopologySwarm){
|
// synchronized(m_TopologySwarm){
|
||||||
// try {
|
// try {
|
||||||
// JFrame frame = m_TopologySwarm.m_Frame;
|
// JFrame frame = m_TopologySwarm.internalFrame;
|
||||||
// Robot robot = new Robot();
|
// Robot robot = new Robot();
|
||||||
// Rectangle area;
|
// Rectangle area;
|
||||||
// area = frame.getBounds();
|
// area = frame.getBounds();
|
||||||
// BufferedImage bufferedImage = robot.createScreenCapture(area);
|
// BufferedImage bufferedImage = robot.createScreenCapture(area);
|
||||||
//
|
//
|
||||||
// // JFileChooser fc = new JFileChooser();
|
// // JFileChooser fc = new JFileChooser();
|
||||||
// // if (fc.showSaveDialog(m_TopologySwarm.m_Frame) != JFileChooser.APPROVE_OPTION) return;
|
// // if (fc.showSaveDialog(m_TopologySwarm.internalFrame) != JFileChooser.APPROVE_OPTION) return;
|
||||||
// System.out.println("Name " + f.getName());
|
// System.out.println("Name " + f.getName());
|
||||||
// try {
|
// try {
|
||||||
// FileOutputStream fos = new FileOutputStream(f);
|
// FileOutputStream fos = new FileOutputStream(f);
|
||||||
|
@@ -23,7 +23,7 @@ public class TestingDArea {
|
|||||||
area.setBackground(Color.white);
|
area.setBackground(Color.white);
|
||||||
area.setPreferredSize(new Dimension(600, 500));
|
area.setPreferredSize(new Dimension(600, 500));
|
||||||
area.setVisibleRectangle(1, 1, 100000, 1000);
|
area.setVisibleRectangle(1, 1, 100000, 1000);
|
||||||
area.setVisibleRectangle(0, -3, 10, 10);//m_PlotArea.setAutoFocus(true);
|
area.setVisibleRectangle(0, -3, 10, 10);//plotArea.setAutoFocus(true);
|
||||||
area.setMinRectangle(0, 0, 1, 1);
|
area.setMinRectangle(0, 0, 1, 1);
|
||||||
ScaledBorder myBorder = new ScaledBorder();
|
ScaledBorder myBorder = new ScaledBorder();
|
||||||
myBorder.x_label = "x";//"App. " + Name + " func. calls";
|
myBorder.x_label = "x";//"App. " + Name + " func. calls";
|
||||||
|
@@ -24,14 +24,6 @@ import java.awt.print.Printable;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
|
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
|
|
||||||
/*==========================================================================*
|
|
||||||
* CLASS DECLARATION
|
|
||||||
*==========================================================================*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DArea is the crossing of the <code>JComponent</code>s and the
|
* DArea is the crossing of the <code>JComponent</code>s and the
|
||||||
* <code>DComponent</code>s. It's the <code>DParent</code> which can be added to
|
* <code>DComponent</code>s. It's the <code>DParent</code> which can be added to
|
||||||
|
@@ -10,11 +10,6 @@ import eva2.tools.math.interpolation.SplineInterpolation;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//created at June 27 2006
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Andreas Dräger
|
|
||||||
*/
|
|
||||||
public class Mathematics {
|
public class Mathematics {
|
||||||
/**
|
/**
|
||||||
* Computes the full adjoint matrix.
|
* Computes the full adjoint matrix.
|
||||||
@@ -93,7 +88,7 @@ public class Mathematics {
|
|||||||
*
|
*
|
||||||
* @param x a vector
|
* @param x a vector
|
||||||
* @param y another vector
|
* @param y another vector
|
||||||
* @param root what kind of distance funktion
|
* @param root what kind of distance function
|
||||||
* @return the distance of x and y
|
* @return the distance of x and y
|
||||||
* @throws Exception if x and y have different dimensions an exception is thrown.
|
* @throws Exception if x and y have different dimensions an exception is thrown.
|
||||||
*/
|
*/
|
||||||
@@ -602,16 +597,11 @@ public class Mathematics {
|
|||||||
* @param dblArrList a list of double vectors
|
* @param dblArrList a list of double vectors
|
||||||
* @param interpolate flag whether, for even size, the median is interpolated
|
* @param interpolate flag whether, for even size, the median is interpolated
|
||||||
* @return the median
|
* @return the median
|
||||||
* @see #DoubleArrayComparator
|
* @see DoubleArrayComparator
|
||||||
*/
|
*/
|
||||||
public static double[] median(List<double[]> dblArrList, boolean interpolate) {
|
public static double[] median(List<double[]> dblArrList, boolean interpolate) {
|
||||||
java.util.Collections.sort(dblArrList, new DoubleArrayComparator()); // by
|
// by default the comparator uses pareto dominance
|
||||||
// default,
|
java.util.Collections.sort(dblArrList, new DoubleArrayComparator());
|
||||||
// the
|
|
||||||
// comparator
|
|
||||||
// uses
|
|
||||||
// pareto
|
|
||||||
// dominance
|
|
||||||
|
|
||||||
int len = dblArrList.size();
|
int len = dblArrList.size();
|
||||||
if (len % 2 != 0) {
|
if (len % 2 != 0) {
|
||||||
@@ -630,7 +620,7 @@ public class Mathematics {
|
|||||||
public static double median2(double[] vector, boolean clone) {
|
public static double median2(double[] vector, boolean clone) {
|
||||||
double[] in;
|
double[] in;
|
||||||
if (clone) {
|
if (clone) {
|
||||||
in = (double[]) vector.clone();
|
in = vector.clone();
|
||||||
} else {
|
} else {
|
||||||
in = vector;
|
in = vector;
|
||||||
}
|
}
|
||||||
@@ -771,26 +761,6 @@ public class Mathematics {
|
|||||||
return prod;
|
return prod;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Normalizes the doubles in the array using the given value so that they
|
|
||||||
// sum up to 1.
|
|
||||||
// *
|
|
||||||
// * @param doubles the array of double
|
|
||||||
// * @param sum the value by which the doubles are to be normalized
|
|
||||||
// * @exception IllegalArgumentException if sum is zero or NaN
|
|
||||||
// */
|
|
||||||
// public static void normalize(double[] v, double sum, double[] res) {
|
|
||||||
// if (Double.isNaN(sum)) {
|
|
||||||
// throw new IllegalArgumentException("Can't normalize array. Sum is NaN.");
|
|
||||||
// }
|
|
||||||
// if (sum == 0) {
|
|
||||||
// // Maybe this should just be a return.
|
|
||||||
// throw new
|
|
||||||
// IllegalArgumentException("Can't normalize array. Sum is zero.");
|
|
||||||
// }
|
|
||||||
// svMult(1/sum, v, res);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Project the values in x to the range given. The range must be an vector
|
* Project the values in x to the range given. The range must be an vector
|
||||||
* of 2d-arrays each of which containing lower and upper bound in the i-th
|
* of 2d-arrays each of which containing lower and upper bound in the i-th
|
||||||
|
@@ -6,6 +6,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Random number generator used across all optimizations
|
||||||
|
* for reproducability of runs.
|
||||||
|
*/
|
||||||
public class RNG {
|
public class RNG {
|
||||||
|
|
||||||
private static Random random;
|
private static Random random;
|
||||||
|
@@ -1,17 +1,4 @@
|
|||||||
package eva2.tools.math;
|
package eva2.tools.math;
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Filename: $RCSfile: StatisticUtils.java,v $
|
|
||||||
// Purpose: Interface definition for calling external programs from JOELib.
|
|
||||||
// Language: Java
|
|
||||||
// Compiler: JDK 1.4
|
|
||||||
// Authors: Joerg K. Wegner
|
|
||||||
// Version: $Revision: 1.1 $
|
|
||||||
// $Date: 2004/02/28 17:19:28 $
|
|
||||||
// $Author: ulmerh $
|
|
||||||
//
|
|
||||||
// Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
|
|
||||||
//
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
import eva2.optimization.problems.AbstractProblemDouble;
|
import eva2.optimization.problems.AbstractProblemDouble;
|
||||||
import eva2.tools.math.Jama.Matrix;
|
import eva2.tools.math.Jama.Matrix;
|
||||||
@@ -38,7 +25,6 @@ public class StatisticUtils {
|
|||||||
*
|
*
|
||||||
* @param y1 double vector 1
|
* @param y1 double vector 1
|
||||||
* @param y2 double vector 2
|
* @param y2 double vector 2
|
||||||
* @param n the length of two double vectors
|
|
||||||
* @return the correlation coefficient
|
* @return the correlation coefficient
|
||||||
*/
|
*/
|
||||||
public final static double correlation(double y1[], double y2[]) {
|
public final static double correlation(double y1[], double y2[]) {
|
||||||
@@ -472,135 +458,6 @@ public class StatisticUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// these came from ContingencyTables.java in the wsi package (mkron)
|
|
||||||
// /**
|
|
||||||
// * Computes conditional entropy of the rows given
|
|
||||||
// * the columns.
|
|
||||||
// *
|
|
||||||
// * @param matrix the contingency table
|
|
||||||
// * @return the conditional entropy of the rows given the columns
|
|
||||||
// */
|
|
||||||
// public static double entropyConditionedOnColumns(double[][] matrix) {
|
|
||||||
// double ret = 0;
|
|
||||||
// double colSum;
|
|
||||||
// double total = 0;
|
|
||||||
//
|
|
||||||
// for (int j = 0; j < matrix[0].length; j++) {
|
|
||||||
// colSum = 0;
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < matrix.length; i++) {
|
|
||||||
// ret = ret + lnFunc(matrix[i][j]);
|
|
||||||
// colSum += matrix[i][j];
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// ret = ret - lnFunc(colSum);
|
|
||||||
// total += colSum;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StatisticUtils.eq(total, 0)) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return -ret / (total * log2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Computes conditional entropy of the columns given
|
|
||||||
// * the rows.
|
|
||||||
// *
|
|
||||||
// * @param matrix the contingency table
|
|
||||||
// * @return the conditional entropy of the columns given the rows
|
|
||||||
// */
|
|
||||||
// public static double entropyConditionedOnRows(double[][] matrix) {
|
|
||||||
// double returnValue = 0;
|
|
||||||
// double sumForRow;
|
|
||||||
// double total = 0;
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < matrix.length; i++) {
|
|
||||||
// sumForRow = 0;
|
|
||||||
//
|
|
||||||
// for (int j = 0; j < matrix[0].length; j++) {
|
|
||||||
// returnValue = returnValue + lnFunc(matrix[i][j]);
|
|
||||||
// sumForRow += matrix[i][j];
|
|
||||||
// }
|
|
||||||
// returnValue = returnValue - lnFunc(sumForRow);
|
|
||||||
// total += sumForRow;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StatisticUtils.eq(total, 0)) {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return -returnValue / (total * log2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Computes the columns' entropy for the given contingency table.
|
|
||||||
// *
|
|
||||||
// * @param matrix the contingency table
|
|
||||||
// * @return the columns' entropy
|
|
||||||
// */
|
|
||||||
// public static double entropyOverColumns(double[][] matrix)
|
|
||||||
// {
|
|
||||||
// double returnValue = 0;
|
|
||||||
// double sumForColumn;
|
|
||||||
// double total = 0;
|
|
||||||
//
|
|
||||||
// for (int j = 0; j < matrix[0].length; j++)
|
|
||||||
// {
|
|
||||||
// sumForColumn = 0;
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < matrix.length; i++)
|
|
||||||
// {
|
|
||||||
// sumForColumn += matrix[i][j];
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// returnValue = returnValue - lnFunc(sumForColumn);
|
|
||||||
// total += sumForColumn;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StatisticUtils.eq(total, 0))
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (returnValue + lnFunc(total)) / (total * log2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Computes the rows' entropy for the given contingency table.
|
|
||||||
// *
|
|
||||||
// * @param matrix the contingency table
|
|
||||||
// * @return the rows' entropy
|
|
||||||
// */
|
|
||||||
// public static double entropyOverRows(double[][] matrix)
|
|
||||||
// {
|
|
||||||
// double returnValue = 0;
|
|
||||||
// double sumForRow;
|
|
||||||
// double total = 0;
|
|
||||||
//
|
|
||||||
// for (int i = 0; i < matrix.length; i++)
|
|
||||||
// {
|
|
||||||
// sumForRow = 0;
|
|
||||||
//
|
|
||||||
// for (int j = 0; j < matrix[0].length; j++)
|
|
||||||
// {
|
|
||||||
// sumForRow += matrix[i][j];
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// returnValue = returnValue - lnFunc(sumForRow);
|
|
||||||
// total += sumForRow;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (StatisticUtils.eq(total, 0))
|
|
||||||
// {
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return (returnValue + lnFunc(total)) / (total * log2);
|
|
||||||
// }
|
|
||||||
|
|
||||||
private static double lnFunc(double num) {
|
private static double lnFunc(double num) {
|
||||||
// hard coded for efficiency reasons
|
// hard coded for efficiency reasons
|
||||||
if (num < 1e-7) {
|
if (num < 1e-7) {
|
||||||
@@ -610,44 +467,6 @@ public class StatisticUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// // The following methods got mysteriously lost maybe during cvs-svn refactoring.
|
|
||||||
// // For the time being I add method thunks which give a warning when called. (mkron)
|
|
||||||
// public static double quadratic_entropy(double[] ds) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static double mutual_information(double[] ds, double[] ds2, int nbins) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static double quadratic_mutinf(double[] feature, double[] labels) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static double quadratic_mutinf(double[] feature, double[] labels, int[] classes) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static double SUquadratic(double[] feature, double[] labels) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static double SUquadratic(double[] feature, double[] labels, int[] classes) {
|
|
||||||
// // TODO Auto-generated method stub
|
|
||||||
// System.err.println("warning, not implemented!");
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Random Latin Hypercube Sampling within a given double range.
|
* Random Latin Hypercube Sampling within a given double range.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user