Renaming and documentation variables/classes
This commit is contained in:
parent
5e94821eb5
commit
6473b35859
@ -1,17 +1,5 @@
|
||||
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.optimization.individuals.AbstractEAIndividual;
|
||||
import eva2.optimization.mocco.paretofrontviewer.InterfaceRefPointListener;
|
||||
|
@ -1,12 +1,5 @@
|
||||
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.gui.JEFrame;
|
||||
import eva2.optimization.individuals.AbstractEAIndividual;
|
||||
@ -43,13 +36,13 @@ public class Plot implements PlotInterface, Serializable {
|
||||
* Generated serial version identifier.
|
||||
*/
|
||||
private static final long serialVersionUID = -9027101244918249825L;
|
||||
private JFileChooser m_FileChooser;
|
||||
private JFileChooser fileChooser;
|
||||
private JPanel m_ButtonPanel;
|
||||
private String plotName;
|
||||
private String xAxisText;
|
||||
private String yAxisText;
|
||||
protected FunctionArea m_PlotArea;
|
||||
protected JInternalFrame m_Frame;
|
||||
protected FunctionArea plotArea;
|
||||
protected JInternalFrame internalFrame;
|
||||
|
||||
/**
|
||||
* 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++) {
|
||||
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) {
|
||||
JButton ClearButton = new JButton("Clear");
|
||||
ClearButton.addActionListener(new ActionListener() {
|
||||
JButton clearButton = new JButton("Clear");
|
||||
clearButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
clearAll();
|
||||
}
|
||||
});
|
||||
JButton LOGButton = new JButton("Log/Lin");
|
||||
LOGButton.setToolTipText("Toggle between a linear and a log scale on the y-axis.");
|
||||
LOGButton.addActionListener(new ActionListener() {
|
||||
JButton loglinButton = new JButton("Log/Lin");
|
||||
loglinButton.setToolTipText("Toggle between a linear and a log scale on the y-axis.");
|
||||
loglinButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
m_PlotArea.toggleLog();
|
||||
plotArea.toggleLog();
|
||||
}
|
||||
});
|
||||
JButton ExportButton = new JButton("Export to TSV");
|
||||
ExportButton.setToolTipText("Exports the graph data to a simple TSV file.");
|
||||
ExportButton.addActionListener(new ActionListener() {
|
||||
JButton exportButton = new JButton("Export to TSV");
|
||||
exportButton.setToolTipText("Exports the graph data to a simple TSV file.");
|
||||
exportButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
exportPlot();
|
||||
}
|
||||
});
|
||||
JButton DumpButton = new JButton("Dump");
|
||||
DumpButton.setToolTipText("Dump the graph data to standard output");
|
||||
DumpButton.addActionListener(new ActionListener() {
|
||||
JButton dumpButton = new JButton("Dump");
|
||||
dumpButton.setToolTipText("Dump the graph data to standard output");
|
||||
dumpButton.addActionListener(new ActionListener() {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
m_PlotArea.exportToAscii();
|
||||
plotArea.exportToAscii();
|
||||
}
|
||||
});
|
||||
|
||||
@ -138,10 +131,10 @@ public class Plot implements PlotInterface, Serializable {
|
||||
try {
|
||||
Robot robot = new Robot();
|
||||
Rectangle area;
|
||||
area = m_Frame.getBounds();
|
||||
area = internalFrame.getBounds();
|
||||
BufferedImage bufferedImage = robot.createScreenCapture(area);
|
||||
JFileChooser fc = new JFileChooser();
|
||||
if (fc.showSaveDialog(m_Frame) != JFileChooser.APPROVE_OPTION) {
|
||||
if (fc.showSaveDialog(internalFrame) != JFileChooser.APPROVE_OPTION) {
|
||||
return;
|
||||
}
|
||||
// System.out.println("Name " + outfile);
|
||||
@ -191,13 +184,10 @@ public class Plot implements PlotInterface, Serializable {
|
||||
}
|
||||
});
|
||||
|
||||
buttonPan.add(ClearButton);
|
||||
buttonPan.add(LOGButton);
|
||||
buttonPan.add(DumpButton);
|
||||
buttonPan.add(ExportButton);
|
||||
// m_ButtonPanel.add(PrintButton);
|
||||
// m_ButtonPanel.add(OpenButton);
|
||||
// m_ButtonPanel.add(SaveButton);
|
||||
buttonPan.add(clearButton);
|
||||
buttonPan.add(loglinButton);
|
||||
buttonPan.add(dumpButton);
|
||||
buttonPan.add(exportButton);
|
||||
buttonPan.add(saveImageButton);
|
||||
}
|
||||
|
||||
@ -206,47 +196,47 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
m_Frame = new JEFrame("Plot: " + plotName);
|
||||
internalFrame = new JEFrame("Plot: " + plotName);
|
||||
BasicResourceLoader loader = BasicResourceLoader.instance();
|
||||
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_PlotArea = new FunctionArea(xAxisText, yAxisText);
|
||||
plotArea = new FunctionArea(xAxisText, yAxisText);
|
||||
m_ButtonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
|
||||
|
||||
installButtons(m_ButtonPanel);
|
||||
|
||||
// getContentPane().smultetLayout( new GridLayout(1, 4) );
|
||||
m_Frame.add(m_ButtonPanel, BorderLayout.PAGE_END);
|
||||
m_Frame.add(m_PlotArea, BorderLayout.CENTER); // north was not so
|
||||
internalFrame.add(m_ButtonPanel, BorderLayout.PAGE_END);
|
||||
internalFrame.add(plotArea, BorderLayout.CENTER); // north was not so
|
||||
// nice
|
||||
m_Frame.addInternalFrameListener(new InternalFrameAdapter() {
|
||||
internalFrame.addInternalFrameListener(new InternalFrameAdapter() {
|
||||
|
||||
@Override
|
||||
public void internalFrameClosing(InternalFrameEvent e) {
|
||||
super.internalFrameClosing(e);
|
||||
m_PlotArea.clearAll(); // this was a memory leak
|
||||
m_PlotArea = null;
|
||||
m_Frame.dispose();
|
||||
plotArea.clearAll(); // this was a memory leak
|
||||
plotArea = null;
|
||||
internalFrame.dispose();
|
||||
}
|
||||
});
|
||||
m_Frame.pack();
|
||||
m_Frame.setVisible(true);
|
||||
internalFrame.pack();
|
||||
internalFrame.setVisible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate whether graph legend entries should show their unique number.
|
||||
*/
|
||||
public void setAppendIndexInLegend(boolean appendIndexInLegend) {
|
||||
this.m_PlotArea.setAppendIndexInLegend(appendIndexInLegend);
|
||||
this.plotArea.setAppendIndexInLegend(appendIndexInLegend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether graph legend entries show their unique number.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public boolean isShowGraphToolTips() {
|
||||
return m_PlotArea.isShowGraphToolTips();
|
||||
return plotArea.isShowGraphToolTips();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,7 +255,7 @@ public class Plot implements PlotInterface, Serializable {
|
||||
* tip info strings
|
||||
*/
|
||||
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) {
|
||||
if (m_Frame != null) {
|
||||
m_Frame.setPreferredSize(prefSize);
|
||||
m_Frame.pack();
|
||||
if (internalFrame != null) {
|
||||
internalFrame.setPreferredSize(prefSize);
|
||||
internalFrame.pack();
|
||||
}
|
||||
}
|
||||
|
||||
@ -311,7 +301,7 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
public void setConnectedPoint(double x, double y, int func) {
|
||||
m_PlotArea.setConnectedPoint(x, y, func);
|
||||
plotArea.setConnectedPoint(x, y, func);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
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
|
||||
public void clearAll() {
|
||||
m_PlotArea.clearAll();
|
||||
m_PlotArea.removeAllDElements();
|
||||
m_PlotArea.clearLegend();
|
||||
m_Frame.repaint();
|
||||
plotArea.clearAll();
|
||||
plotArea.removeAllDElements();
|
||||
plotArea.clearLegend();
|
||||
internalFrame.repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -359,7 +349,7 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*/
|
||||
@Override
|
||||
public void clearGraph(int GraphNumber) {
|
||||
m_PlotArea.clearGraph(GraphNumber);
|
||||
plotArea.clearGraph(GraphNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -367,7 +357,7 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*/
|
||||
@Override
|
||||
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
|
||||
public void jump() {
|
||||
m_PlotArea.jump();
|
||||
plotArea.jump();
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
protected Object openObject() {
|
||||
if (m_FileChooser == null) {
|
||||
if (fileChooser == null) {
|
||||
createFileChooser();
|
||||
}
|
||||
int returnVal = m_FileChooser.showOpenDialog(m_Frame);
|
||||
int returnVal = fileChooser.showOpenDialog(internalFrame);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File selected = m_FileChooser.getSelectedFile();
|
||||
File selected = fileChooser.getSelectedFile();
|
||||
try {
|
||||
ObjectInputStream oi = new ObjectInputStream(
|
||||
new BufferedInputStream(new FileInputStream(selected)));
|
||||
@ -399,7 +389,7 @@ public class Plot implements PlotInterface, Serializable {
|
||||
}
|
||||
return obj;
|
||||
} catch (Exception ex) {
|
||||
JOptionPane.showMessageDialog(m_Frame, "Couldn't read object: "
|
||||
JOptionPane.showMessageDialog(internalFrame, "Couldn't read object: "
|
||||
+ selected.getName() + "\n" + ex.getMessage(),
|
||||
"Open object file", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
@ -411,28 +401,28 @@ public class Plot implements PlotInterface, Serializable {
|
||||
* Just dump the plot to stdout.
|
||||
*/
|
||||
protected void dumpPlot() {
|
||||
m_PlotArea.exportToAscii();
|
||||
plotArea.exportToAscii();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void exportPlot() {
|
||||
if (m_FileChooser == null) {
|
||||
if (fileChooser == null) {
|
||||
createFileChooser();
|
||||
}
|
||||
int returnVal = m_FileChooser.showSaveDialog(m_Frame);
|
||||
int returnVal = fileChooser.showSaveDialog(internalFrame);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File sFile = m_FileChooser.getSelectedFile();
|
||||
File sFile = fileChooser.getSelectedFile();
|
||||
if (sFile.exists()) {
|
||||
returnVal = JOptionPane.showConfirmDialog(m_Frame, "The file "
|
||||
returnVal = JOptionPane.showConfirmDialog(internalFrame, "The file "
|
||||
+ sFile.getName() + " already exists. Overwrite?");
|
||||
if (returnVal != JOptionPane.YES_OPTION) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!(m_PlotArea.exportToAscii(sFile))) {
|
||||
JOptionPane.showMessageDialog(m_Frame,
|
||||
if (!(plotArea.exportToAscii(sFile))) {
|
||||
JOptionPane.showMessageDialog(internalFrame,
|
||||
"Couldn't write to file: " + sFile.getName(),
|
||||
"Export error", JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
@ -443,19 +433,19 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*
|
||||
*/
|
||||
protected void saveObject(Object object) {
|
||||
if (m_FileChooser == null) {
|
||||
if (fileChooser == null) {
|
||||
createFileChooser();
|
||||
}
|
||||
int returnVal = m_FileChooser.showSaveDialog(m_Frame);
|
||||
int returnVal = fileChooser.showSaveDialog(internalFrame);
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File sFile = m_FileChooser.getSelectedFile();
|
||||
File sFile = fileChooser.getSelectedFile();
|
||||
try {
|
||||
ObjectOutputStream oo = new ObjectOutputStream(
|
||||
new BufferedOutputStream(new FileOutputStream(sFile)));
|
||||
oo.writeObject(object);
|
||||
oo.close();
|
||||
} catch (IOException ex) {
|
||||
JOptionPane.showMessageDialog(m_Frame,
|
||||
JOptionPane.showMessageDialog(internalFrame,
|
||||
"Couldn't write to file: " + sFile.getName() + "\n"
|
||||
+ ex.getMessage(), "Save object",
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
@ -467,8 +457,8 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*
|
||||
*/
|
||||
protected void createFileChooser() {
|
||||
m_FileChooser = new JFileChooser(new File("/resources"));
|
||||
m_FileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
fileChooser = new JFileChooser(new File("/resources"));
|
||||
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -483,15 +473,15 @@ public class Plot implements PlotInterface, Serializable {
|
||||
*
|
||||
*/
|
||||
public FunctionArea getFunctionArea() {
|
||||
return m_PlotArea;
|
||||
return plotArea;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void dispose() {
|
||||
m_Frame.dispose();
|
||||
m_Frame = null;
|
||||
internalFrame.dispose();
|
||||
internalFrame = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -512,22 +502,4 @@ public class Plot implements PlotInterface, Serializable {
|
||||
public void 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.
|
||||
*/
|
||||
public void setParams(int gridX, int gridY, int color_scale) {
|
||||
if (gridX > m_Frame.getWidth()) {
|
||||
gridX = m_Frame.getWidth();
|
||||
if (gridX > internalFrame.getWidth()) {
|
||||
gridX = internalFrame.getWidth();
|
||||
}
|
||||
if (gridY > m_Frame.getHeight()) {
|
||||
gridY = m_Frame.getHeight();
|
||||
if (gridY > internalFrame.getHeight()) {
|
||||
gridY = internalFrame.getHeight();
|
||||
}
|
||||
gridx = gridX;
|
||||
gridy = gridY;
|
||||
@ -145,7 +145,7 @@ public class TopoPlot extends Plot {
|
||||
fitRange = java.lang.Math.abs(max - min);
|
||||
ColorBarCalculator colorBar = new ColorBarCalculator(colorScale);
|
||||
|
||||
m_Frame.setVisible(false);
|
||||
internalFrame.setVisible(false);
|
||||
for (int x = 0; x < gridx; x++) {
|
||||
for (int y = 0; y < gridy; y++) {
|
||||
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));
|
||||
rect.setColor(color);
|
||||
rect.setFillColor(color);
|
||||
m_PlotArea.addDElement(rect);
|
||||
plotArea.addDElement(rect);
|
||||
} // for y
|
||||
} // for x
|
||||
if (withGradientsIfAvailable && (problem instanceof InterfaceFirstOrderDerivableProblem)) {
|
||||
@ -172,6 +172,6 @@ public class TopoPlot extends Plot {
|
||||
} // for y
|
||||
} // for x
|
||||
}
|
||||
m_Frame.setVisible(true);
|
||||
internalFrame.setVisible(true);
|
||||
} // setTopology
|
||||
} // class
|
||||
|
@ -186,7 +186,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
errMsg = "check console output for error messages.";
|
||||
}
|
||||
errMsg = "Exception in Processor: " + errMsg;
|
||||
LOGGER.log(Level.SEVERE, e.getMessage(), e);
|
||||
e.printStackTrace();
|
||||
LOGGER.log(Level.SEVERE, errMsg, e);
|
||||
try {
|
||||
JOptionPane.showMessageDialog(null, StringTools.wrapLine(errMsg, 60, 0.2), "Error in Optimization", JOptionPane.ERROR_MESSAGE);
|
||||
} catch (Exception ex) {
|
||||
|
@ -345,7 +345,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
|
||||
// popRep = new DPointSet();
|
||||
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(i);
|
||||
// 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]+")");
|
||||
// for (int j = i; j < pop.size(); j++) {
|
||||
// if (ConnectionMatrix[i][j]) {
|
||||
@ -355,7 +355,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
|
||||
// popRep.addDPoint(new DPoint(tmpIndy1.getDoubleData()[0], tmpIndy1.getDoubleData()[1]));
|
||||
// tmpIndy1 = (InterfaceDataTypeDouble)pop.get(j);
|
||||
// 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 {
|
||||
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
|
||||
@ -169,7 +169,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
if (dataListeners != null) {
|
||||
for (InterfaceStatisticsListener l : dataListeners) {
|
||||
if (start) {
|
||||
l.notifyRunStarted(runNumber, m_StatsParams.getMultiRuns(),
|
||||
l.notifyRunStarted(runNumber, statisticsParameter.getMultiRuns(),
|
||||
currentStatHeader, currentStatMetaInfo);
|
||||
} else {
|
||||
l.notifyRunStopped(optRunsPerformed, normal);
|
||||
@ -203,9 +203,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
String startDate = getDateString();
|
||||
// open the result file:
|
||||
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("")) {
|
||||
String fnameBase = makeOutputFileName(m_StatsParams.getResultFilePrefix(), infoString, startDate);
|
||||
String fnameBase = makeOutputFileName(statisticsParameter.getResultFilePrefix(), infoString, startDate);
|
||||
int cnt = 0;
|
||||
String fname = fnameBase;
|
||||
while (new File(fname).exists()) {
|
||||
@ -236,7 +236,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -258,8 +258,8 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
if (runNumber == 0) {
|
||||
// store the intial graph selection state, so that modifications during runtime cannot cause inconsistencies
|
||||
lastFieldSelection = (StringSelection) m_StatsParams.getFieldSelection().clone();
|
||||
lastIsShowFull = m_StatsParams.isOutputAllFieldsAsText();
|
||||
lastFieldSelection = (StringSelection) statisticsParameter.getFieldSelection().clone();
|
||||
lastIsShowFull = statisticsParameter.isOutputAllFieldsAsText();
|
||||
|
||||
currentStatDoubleData = null;
|
||||
currentStatObjectData = null;
|
||||
@ -273,7 +273,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
optRunsPerformed = 0;
|
||||
convergenceCnt = 0;
|
||||
if (saveParams) {
|
||||
m_StatsParams.saveInstance();
|
||||
statisticsParameter.saveInstance();
|
||||
}
|
||||
initOutput(infoString);
|
||||
bestIndyAllRuns = null;
|
||||
@ -349,7 +349,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
// check if target zero was reached
|
||||
if (bestCurrentIndy != null) {
|
||||
if (Mathematics.norm(bestOfRunIndy.getFitness()) < this.m_StatsParams.getConvergenceRateThreshold()) {
|
||||
if (Mathematics.norm(bestOfRunIndy.getFitness()) < this.statisticsParameter.getConvergenceRateThreshold()) {
|
||||
convergenceCnt++;
|
||||
}
|
||||
if (printRunStoppedVerbosity()) {
|
||||
@ -414,7 +414,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
@Override
|
||||
public void postProcessingPerformed(Population resultPop) { // called from processor
|
||||
if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= m_StatsParams.getMultiRuns()) {
|
||||
if (!printRunStoppedVerbosity() && printFinalVerbosity() && optRunsPerformed >= statisticsParameter.getMultiRuns()) {
|
||||
printToTextListener("\n");
|
||||
}
|
||||
if (printRunStoppedVerbosity()) {
|
||||
@ -426,7 +426,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
}
|
||||
}
|
||||
if (optRunsPerformed >= m_StatsParams.getMultiRuns()) {
|
||||
if (optRunsPerformed >= statisticsParameter.getMultiRuns()) {
|
||||
finalizeOutput();
|
||||
fireDataListenersFinalize();
|
||||
}
|
||||
@ -480,7 +480,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
protected void finalizeOutput() {
|
||||
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()) {
|
||||
printToTextListener(" Average function calls: " + (functionCallSum / optRunsPerformed) + "\n");
|
||||
@ -660,7 +660,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
resultOut.print(s);
|
||||
}
|
||||
for (InterfaceTextListener l : textListeners) {
|
||||
if (m_StatsParams.getOutputTo().getSelectedTagID() >= 1) {
|
||||
if (statisticsParameter.getOutputTo().getSelectedTagID() >= 1) {
|
||||
l.print(s);
|
||||
}
|
||||
}
|
||||
@ -681,7 +681,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
|
||||
@Override
|
||||
public InterfaceStatisticsParameter getStatisticsParameter() {
|
||||
return m_StatsParams;
|
||||
return statisticsParameter;
|
||||
}
|
||||
|
||||
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.
|
||||
*
|
||||
* @param informerList
|
||||
* @param pop
|
||||
* @return
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param informerList
|
||||
* @param pop
|
||||
* @return
|
||||
*/
|
||||
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.
|
||||
*
|
||||
* @param informerList
|
||||
* @param pop
|
||||
* @return
|
||||
*/
|
||||
protected List<String> getOutputMetaInfo(List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||
@ -756,12 +753,11 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
GraphSelectionEnum[] vals = GraphSelectionEnum.values();
|
||||
ArrayList<String> headerEntries = new ArrayList<String>();
|
||||
headerEntries.add("FunctionCalls");
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
if (isRequestedField(vals[i])) {
|
||||
headerEntries.add(vals[i].toString());
|
||||
for (GraphSelectionEnum val : vals) {
|
||||
if (isRequestedField(val)) {
|
||||
headerEntries.add(val.toString());
|
||||
}
|
||||
}
|
||||
// return new String[]{"Fun.calls","Best","Mean", "Worst"};
|
||||
return headerEntries.toArray(new String[headerEntries.size()]);
|
||||
}
|
||||
|
||||
@ -782,7 +778,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
headerInfo.add(GraphSelectionEnum.getInfoStrings()[i]);
|
||||
}
|
||||
}
|
||||
// return new String[]{"Fun.calls","Best","Mean", "Worst"};
|
||||
return headerInfo.toArray(new String[headerInfo.size()]);
|
||||
}
|
||||
|
||||
@ -829,7 +824,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
protected Object[] getSimpleOutputValues() {
|
||||
GraphSelectionEnum[] selEnumVals = null;
|
||||
selEnumVals = GraphSelectionEnum.values();
|
||||
// else selEnumVals = (GraphSelectionEnum[]) (m_StatsParams.getGraphSelection().getSelectedEnum(GraphSelectionEnum.values()));
|
||||
Object[] ret = new Object[1 + selEnumVals.length];
|
||||
ret[0] = functionCalls;
|
||||
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
|
||||
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 pop
|
||||
* @return
|
||||
* @see #getOutputHeader(List, PopulationInterface)
|
||||
* @see #getOutputHeaderFieldNames(java.util.List) (List)
|
||||
*/
|
||||
protected List<Object> getOutputValues(List<InterfaceAdditionalPopulationInformer> informerList, PopulationInterface pop) {
|
||||
LinkedList<Object> values = new LinkedList<Object>();
|
||||
@ -1168,7 +1153,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
|
||||
public String[] getCurrentFieldHeaders() {
|
||||
StringSelection fSel = m_StatsParams.getFieldSelection();
|
||||
StringSelection fSel = statisticsParameter.getFieldSelection();
|
||||
return fSel.getSelected();
|
||||
}
|
||||
|
||||
@ -1274,22 +1259,22 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
* @return
|
||||
*/
|
||||
private boolean printLineByVerbosity(int iteration) {
|
||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
|| ((m_StatsParams.getOutputVerbosity().getSelectedTagID() == StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
&& (isKthRun(iteration, m_StatsParams.getOutputVerbosityK())));
|
||||
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() > StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
|| ((statisticsParameter.getOutputVerbosity().getSelectedTagID() == StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
&& (isKthRun(iteration, statisticsParameter.getOutputVerbosityK())));
|
||||
}
|
||||
|
||||
private boolean printRunIntroVerbosity() {
|
||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
|| (optRunsPerformed == 0 && (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_FINAL));
|
||||
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT)
|
||||
|| (optRunsPerformed == 0 && (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_FINAL));
|
||||
}
|
||||
|
||||
private boolean printRunStoppedVerbosity() {
|
||||
return (m_StatsParams.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||
return (statisticsParameter.getOutputVerbosity().getSelectedTagID() >= StatisticsParameter.VERBOSITY_KTH_IT);
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -1309,7 +1294,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -1318,9 +1303,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
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) {
|
||||
super();
|
||||
m_StatsParams = statParams;
|
||||
statisticsParameter = statParams;
|
||||
try {
|
||||
m_MyHostName = InetAddress.getLocalHost().getHostName();
|
||||
} catch (Exception e) {
|
||||
@ -58,14 +58,14 @@ public class StatisticsStandalone extends AbstractStatistics implements Interfac
|
||||
|
||||
public StatisticsStandalone(String resultFileName, int multiRuns, int verbosity, boolean outputAllFieldsAsText) {
|
||||
this(StatisticsParameter.getInstance(false));
|
||||
m_StatsParams.setMultiRuns(multiRuns);
|
||||
m_StatsParams.setOutputVerbosity(m_StatsParams.getOutputVerbosity().setSelectedTag(verbosity));
|
||||
m_StatsParams.setResultFilePrefix(resultFileName);
|
||||
m_StatsParams.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
||||
statisticsParameter.setMultiRuns(multiRuns);
|
||||
statisticsParameter.setOutputVerbosity(statisticsParameter.getOutputVerbosity().setSelectedTag(verbosity));
|
||||
statisticsParameter.setResultFilePrefix(resultFileName);
|
||||
statisticsParameter.setOutputAllFieldsAsText(outputAllFieldsAsText);
|
||||
if (resultFileName == null) {
|
||||
m_StatsParams.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_WINDOW);
|
||||
statisticsParameter.getOutputTo().setSelectedTag(StatisticsParameter.OUTPUT_WINDOW);
|
||||
} 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
|
||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||
if (collectData) {
|
||||
m_ResultData = new ArrayList<ArrayList<Object[]>>(m_StatsParams.getMultiRuns());
|
||||
m_ResultData = new ArrayList<ArrayList<Object[]>>(statisticsParameter.getMultiRuns());
|
||||
List<String> description = getOutputHeaderFieldNames(informerList);
|
||||
m_ResultHeaderStrings = new ArrayList<String>();
|
||||
for (String str : description) {
|
||||
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[]>());
|
||||
}
|
||||
} 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
|
||||
* every multi-run.
|
||||
|
@ -1,16 +1,5 @@
|
||||
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.plot.Graph;
|
||||
import eva2.gui.plot.GraphWindow;
|
||||
@ -57,7 +46,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
*
|
||||
*/
|
||||
public StatisticsWithGUI() {
|
||||
m_StatsParams = StatisticsParameter.getInstance(true);
|
||||
statisticsParameter = StatisticsParameter.getInstance(true);
|
||||
proxyPrinter = new JTextoutputFrame("Optimization Log");
|
||||
addTextListener(proxyPrinter);
|
||||
}
|
||||
@ -82,7 +71,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
public void stopOptPerformed(boolean normal, String 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
|
||||
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"
|
||||
if ((m_StatsParams.getMultiRuns() > 1) && (statGraph != null)) {
|
||||
if ((statisticsParameter.getMultiRuns() > 1) && (statGraph != null)) {
|
||||
// unite the point sets for a multirun
|
||||
for (int i = 0; i < fitnessGraph.length; i++) {
|
||||
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();
|
||||
if ((optRunsPerformed >= m_StatsParams.getMultiRuns()) || !normal) {
|
||||
if ((optRunsPerformed >= statisticsParameter.getMultiRuns()) || !normal) {
|
||||
// update the legend after the last multirun or after a user break
|
||||
if ((p != null) && p.isValid()) {
|
||||
((Plot) p).getFunctionArea().updateLegend();
|
||||
@ -119,13 +108,13 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
|
||||
public void maybeShowProxyPrinter() {
|
||||
if (proxyPrinter != null) {
|
||||
proxyPrinter.setShow(m_StatsParams.isShowTextOutput());
|
||||
proxyPrinter.setShow(statisticsParameter.isShowTextOutput());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initPlots(PopulationInterface pop, List<InterfaceAdditionalPopulationInformer> informerList) {
|
||||
if (m_StatsParams instanceof StatisticsParameter) {
|
||||
if (statisticsParameter instanceof StatisticsParameter) {
|
||||
graphDesc = lastFieldSelection.getSelectedWithIndex();
|
||||
} else {
|
||||
graphDesc = null;
|
||||
@ -133,7 +122,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
}
|
||||
|
||||
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();
|
||||
fitnessFrame = new GraphWindow[windowCount];
|
||||
for (int i = 0; i < fitnessFrame.length; i++) {
|
||||
@ -154,14 +143,12 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
fitnessGraph[i][j].jump();
|
||||
}
|
||||
}
|
||||
if (m_StatsParams.getMultiRuns() > 1
|
||||
&& m_StatsParams.getUseStatPlot() == true) {
|
||||
// String Info = m_StatsParams.GetInfoString();
|
||||
if (statisticsParameter.getMultiRuns() > 1
|
||||
&& statisticsParameter.getUseStatPlot() == true) {
|
||||
statGraph = new Graph[windowCount][];
|
||||
for (int i = 0; i < statGraph.length; i++) {
|
||||
statGraph[i] = new Graph[graphCount];
|
||||
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 +
|
||||
graphInfoString);
|
||||
}
|
||||
@ -195,12 +182,7 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
*/
|
||||
@Override
|
||||
protected void plotCurrentResults() {
|
||||
// m_PlotCounter--;
|
||||
|
||||
// if (m_PlotCounter == 0) {
|
||||
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
||||
int subGraph = 0;
|
||||
// boolean doPlotAdditionalInfo = m_StatsParams.isOutputAdditionalInfo();
|
||||
for (int i = 0; i < graphDesc.size(); i++) {
|
||||
Integer colIndex = i + 1; // always add one because the function calls are located in column zero
|
||||
if (lastIsShowFull) {
|
||||
@ -210,11 +192,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
if (currentStatDoubleData[colIndex] != null) {
|
||||
plotFitnessPoint(0, subGraph++, functionCalls, currentStatDoubleData[colIndex]);
|
||||
} 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
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,9 +235,6 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
||||
printToTextListener(s + "\n");
|
||||
}
|
||||
|
||||
// m_PlotCounter--;
|
||||
// if (m_PlotCounter == 0) {
|
||||
// m_PlotCounter = m_StatsParams.GetPlotoutput();
|
||||
int index = 0;
|
||||
for (int i = 0; i < fitnessGraph.length; i++) {
|
||||
for (int j = 0; j < fitnessGraph[i].length; j++) {
|
||||
|
@ -1713,7 +1713,7 @@ public class NichePSO implements InterfaceAdditionalPopulationInformer, Interfac
|
||||
point.setIcon(icon);
|
||||
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){
|
||||
// try {
|
||||
// JFrame frame = m_TopologySwarm.m_Frame;
|
||||
// JFrame frame = m_TopologySwarm.internalFrame;
|
||||
// Robot robot = new Robot();
|
||||
// Rectangle area;
|
||||
// area = frame.getBounds();
|
||||
// BufferedImage bufferedImage = robot.createScreenCapture(area);
|
||||
//
|
||||
// // 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());
|
||||
// try {
|
||||
// FileOutputStream fos = new FileOutputStream(f);
|
||||
|
@ -23,7 +23,7 @@ public class TestingDArea {
|
||||
area.setBackground(Color.white);
|
||||
area.setPreferredSize(new Dimension(600, 500));
|
||||
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);
|
||||
ScaledBorder myBorder = new ScaledBorder();
|
||||
myBorder.x_label = "x";//"App. " + Name + " func. calls";
|
||||
|
@ -24,14 +24,6 @@ import java.awt.print.Printable;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.border.Border;
|
||||
|
||||
/*==========================================================================*
|
||||
* IMPORTS
|
||||
*==========================================================================*/
|
||||
|
||||
/*==========================================================================*
|
||||
* CLASS DECLARATION
|
||||
*==========================================================================*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -10,11 +10,6 @@ import eva2.tools.math.interpolation.SplineInterpolation;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
//created at June 27 2006
|
||||
|
||||
/**
|
||||
* @author Andreas Dräger
|
||||
*/
|
||||
public class Mathematics {
|
||||
/**
|
||||
* Computes the full adjoint matrix.
|
||||
@ -93,7 +88,7 @@ public class Mathematics {
|
||||
*
|
||||
* @param x a 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
|
||||
* @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 interpolate flag whether, for even size, the median is interpolated
|
||||
* @return the median
|
||||
* @see #DoubleArrayComparator
|
||||
* @see DoubleArrayComparator
|
||||
*/
|
||||
public static double[] median(List<double[]> dblArrList, boolean interpolate) {
|
||||
java.util.Collections.sort(dblArrList, new DoubleArrayComparator()); // by
|
||||
// default,
|
||||
// the
|
||||
// comparator
|
||||
// uses
|
||||
// pareto
|
||||
// dominance
|
||||
// by default the comparator uses pareto dominance
|
||||
java.util.Collections.sort(dblArrList, new DoubleArrayComparator());
|
||||
|
||||
int len = dblArrList.size();
|
||||
if (len % 2 != 0) {
|
||||
@ -630,7 +620,7 @@ public class Mathematics {
|
||||
public static double median2(double[] vector, boolean clone) {
|
||||
double[] in;
|
||||
if (clone) {
|
||||
in = (double[]) vector.clone();
|
||||
in = vector.clone();
|
||||
} else {
|
||||
in = vector;
|
||||
}
|
||||
@ -771,26 +761,6 @@ public class Mathematics {
|
||||
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
|
||||
* 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.Random;
|
||||
|
||||
/**
|
||||
* Random number generator used across all optimizations
|
||||
* for reproducability of runs.
|
||||
*/
|
||||
public class RNG {
|
||||
|
||||
private static Random random;
|
||||
|
@ -1,17 +1,4 @@
|
||||
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.tools.math.Jama.Matrix;
|
||||
@ -38,7 +25,6 @@ public class StatisticUtils {
|
||||
*
|
||||
* @param y1 double vector 1
|
||||
* @param y2 double vector 2
|
||||
* @param n the length of two double vectors
|
||||
* @return the correlation coefficient
|
||||
*/
|
||||
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) {
|
||||
// hard coded for efficiency reasons
|
||||
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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user