Further refactoring and removal of unused code. Documenting the Population class.
This commit is contained in:
parent
c9f1fb4d75
commit
4cf0375f35
@ -498,8 +498,7 @@ public class EvAClient implements RemoteStateListener {
|
|||||||
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
gbConstraints.anchor = GridBagConstraints.PAGE_END;
|
gbConstraints.anchor = GridBagConstraints.PAGE_END;
|
||||||
mainFrame.add(statusBar, gbConstraints);
|
mainFrame.add(statusBar, gbConstraints);
|
||||||
|
|
||||||
mainFrame.pack();
|
|
||||||
mainFrame.setVisible(true);
|
mainFrame.setVisible(true);
|
||||||
}
|
}
|
||||||
if (useDefaultModule != null) {
|
if (useDefaultModule != null) {
|
||||||
|
@ -10,242 +10,231 @@ package eva2.gui;
|
|||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
|
import eva2.server.modules.ModuleAdapter;
|
||||||
|
import eva2.server.stat.EvAJob;
|
||||||
|
import eva2.tools.ToolBoxGui;
|
||||||
|
import eva2.tools.jproxy.RMIProxyLocal;
|
||||||
|
import eva2.tools.jproxy.RemoteStateListener;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JComponent;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
|
|
||||||
import eva2.server.modules.ModuleAdapter;
|
|
||||||
import eva2.server.stat.EvAJob;
|
|
||||||
import eva2.tools.BasicResourceLoader;
|
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import java.awt.Toolkit;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import javax.swing.*;
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JToolBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the GUI elements of start and stop buttons and optionally a help button.
|
* Contains the GUI elements of start and stop buttons and optionally a help
|
||||||
|
* button.
|
||||||
*/
|
*/
|
||||||
public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializable, PanelMaker {
|
public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializable, PanelMaker {
|
||||||
private static final Logger logger = Logger.getLogger(EvAInfo.defaultLogger);
|
|
||||||
private String m_Name = "undefined";
|
|
||||||
private ModuleAdapter moduleAdapter;
|
|
||||||
private boolean runningState;
|
|
||||||
private JButton runButton;
|
|
||||||
private JButton postProcessButton;
|
|
||||||
private JButton stopButton;
|
|
||||||
private JButton scheduleButton;
|
|
||||||
// private JButton m_actExitMod;
|
|
||||||
private JButton helpButton;
|
|
||||||
// private JButton m_ShowSolButton;
|
|
||||||
private JToolBar toolBar;
|
|
||||||
private String helpFileName;
|
|
||||||
|
|
||||||
/**
|
private static final Logger LOGGER = Logger.getLogger(EvAInfo.defaultLogger);
|
||||||
*
|
private String m_Name = "undefined";
|
||||||
*/
|
private ModuleAdapter moduleAdapter;
|
||||||
public EvAModuleButtonPanelMaker(ModuleAdapter adapter, boolean state) {
|
private boolean runningState;
|
||||||
m_Name = "GENERAL";
|
private JButton runButton;
|
||||||
runningState = state;
|
private JButton postProcessButton;
|
||||||
moduleAdapter = adapter;
|
private JButton stopButton;
|
||||||
}
|
private JButton scheduleButton;
|
||||||
|
private JButton helpButton;
|
||||||
|
private JToolBar toolBar;
|
||||||
|
private String helpFileName;
|
||||||
|
|
||||||
public JToolBar makePanel() {
|
/**
|
||||||
String myhostname = null;
|
*
|
||||||
|
*/
|
||||||
|
public EvAModuleButtonPanelMaker(ModuleAdapter adapter, boolean state) {
|
||||||
|
m_Name = "GENERAL";
|
||||||
|
runningState = state;
|
||||||
|
moduleAdapter = adapter;
|
||||||
|
}
|
||||||
|
|
||||||
toolBar = new JToolBar();
|
public JToolBar makePanel() {
|
||||||
toolBar.setFloatable(false);
|
toolBar = new JToolBar();
|
||||||
|
toolBar.setFloatable(false);
|
||||||
if (moduleAdapter.hasConnection()) { // we might be in rmi mode
|
|
||||||
try {
|
|
||||||
myhostname = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (Exception e) {
|
|
||||||
logger.log(Level.WARNING, "Could not get hostname", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!moduleAdapter.hasConnection()) {
|
|
||||||
moduleAdapter.addRemoteStateListener((RemoteStateListener)(this));
|
|
||||||
} else {// there is a network RMI connection
|
|
||||||
moduleAdapter.addRemoteStateListener((RemoteStateListener)RMIProxyLocal.newInstance(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
/* ToDo: This is useless? */
|
||||||
runButton = makeIconButton("resources/images/Play24.gif", "Start");
|
if (moduleAdapter.hasConnection()) { // we might be in rmi mode
|
||||||
runButton.setToolTipText("Start the current optimization run.");
|
try {
|
||||||
runButton.addActionListener(new ActionListener() {
|
String myhostname = InetAddress.getLocalHost().getHostName();
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.log(Level.WARNING, "Could not get hostname", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!moduleAdapter.hasConnection()) {
|
||||||
|
moduleAdapter.addRemoteStateListener((RemoteStateListener) (this));
|
||||||
|
} else {// there is a network RMI connection
|
||||||
|
moduleAdapter.addRemoteStateListener((RemoteStateListener) RMIProxyLocal.newInstance(this));
|
||||||
|
}
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
//////////////////////////////////////////////////////////////
|
||||||
//Run Opt pressed !
|
runButton = ToolBoxGui.createIconifiedButton("resources/images/Play24.gif", "Start", true);
|
||||||
onUserStart();
|
runButton.setToolTipText("Start the current optimization run.");
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
runButton.setEnabled(!runningState); // enabled if not running
|
runButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
toolBar.add(runButton);
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
//Run Opt pressed !
|
||||||
|
onUserStart();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
stopButton = makeIconButton("resources/images/Stop24.gif", "Stop");
|
runButton.setEnabled(!runningState); // enabled if not running
|
||||||
stopButton.setToolTipText("Stop the current optimization run.");
|
|
||||||
stopButton.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
toolBar.add(runButton);
|
||||||
try {
|
|
||||||
// this means user break
|
|
||||||
moduleAdapter.stopOpt();
|
|
||||||
} catch (Exception ee) {
|
|
||||||
logger.log(Level.WARNING, "Error while stopping job.", ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
stopButton.setEnabled(runningState);
|
stopButton = ToolBoxGui.createIconifiedButton("resources/images/Stop24.gif", "Stop", true);
|
||||||
toolBar.add(stopButton);
|
stopButton.setToolTipText("Stop the current optimization run.");
|
||||||
|
//stopButton.setBorderPainted(false);
|
||||||
|
stopButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
postProcessButton = makeIconButton("resources/images/History24.gif", "Post Process");
|
@Override
|
||||||
postProcessButton.setToolTipText("Start post processing according to available parameters.");
|
public void actionPerformed(ActionEvent event) {
|
||||||
postProcessButton.addActionListener(new ActionListener() {
|
try {
|
||||||
|
// this means user break
|
||||||
|
moduleAdapter.stopOpt();
|
||||||
|
} catch (Exception ee) {
|
||||||
|
LOGGER.log(Level.WARNING, "Error while stopping job.", ee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
stopButton.setEnabled(runningState);
|
||||||
try {
|
toolBar.add(stopButton);
|
||||||
if (!moduleAdapter.startPostProcessing()) {
|
|
||||||
JOptionPane.showMessageDialog(null, "Post processing seems deactivated! Check the settings.", "Warning", JOptionPane.WARNING_MESSAGE);
|
|
||||||
}
|
|
||||||
} catch (Exception ee) {
|
|
||||||
logger.log(Level.WARNING, "Error in run", ee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
postProcessButton.setEnabled(runningState && moduleAdapter.hasPostProcessing());
|
|
||||||
toolBar.add(postProcessButton);
|
|
||||||
// //////////////////////////////////////////////////////////////
|
|
||||||
scheduleButton= makeIconButton("resources/images/Server24.gif", "Schedule");
|
|
||||||
scheduleButton.setToolTipText("Schedule the currently configured optimization as a job.");
|
|
||||||
scheduleButton.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
postProcessButton = ToolBoxGui.createIconifiedButton("resources/images/History24.gif", "Post Process", true);
|
||||||
EvAJob job = moduleAdapter.scheduleJob();
|
postProcessButton.setToolTipText("Start post processing according to available parameters.");
|
||||||
if (job == null) {
|
//postProcessButton.setBorderPainted(false);
|
||||||
logger.log(Level.WARNING, "There was an error on scheduling your job");
|
postProcessButton.addActionListener(new ActionListener() {
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
scheduleButton.setEnabled(true);
|
|
||||||
toolBar.add(scheduleButton);
|
|
||||||
|
|
||||||
makeHelpButton();
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
try {
|
||||||
|
if (!moduleAdapter.startPostProcessing()) {
|
||||||
|
JOptionPane.showMessageDialog(null, "Post processing seems deactivated! Check the settings.", "Warning", JOptionPane.WARNING_MESSAGE);
|
||||||
|
}
|
||||||
|
} catch (Exception ee) {
|
||||||
|
LOGGER.log(Level.WARNING, "Error in run", ee);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
postProcessButton.setEnabled(runningState && moduleAdapter.hasPostProcessing());
|
||||||
|
toolBar.add(postProcessButton);
|
||||||
|
|
||||||
|
scheduleButton = ToolBoxGui.createIconifiedButton("resources/images/Server24.gif", "Schedule", true);
|
||||||
|
scheduleButton.setToolTipText("Schedule the currently configured optimization as a job.");
|
||||||
|
//scheduleButton.setBorderPainted(false);
|
||||||
|
scheduleButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
return toolBar;
|
@Override
|
||||||
}
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
EvAJob job = moduleAdapter.scheduleJob();
|
||||||
private JButton makeIconButton(final String iconSrc, final String title) {
|
if (job == null) {
|
||||||
JButton newButton;
|
LOGGER.log(Level.WARNING, "There was an error on scheduling your job");
|
||||||
byte[] bytes;
|
}
|
||||||
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
|
}
|
||||||
if (bytes == null) {
|
});
|
||||||
newButton = new JButton(title);
|
scheduleButton.setEnabled(true);
|
||||||
} else {
|
toolBar.add(scheduleButton);
|
||||||
newButton = new JButton(title, new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
|
||||||
}
|
|
||||||
return newButton;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onUserStart() {
|
|
||||||
try {
|
|
||||||
moduleAdapter.startOpt();
|
|
||||||
stopButton.setEnabled(true);
|
|
||||||
runButton.setEnabled(false);
|
|
||||||
postProcessButton.setEnabled(false);
|
|
||||||
// m_RestartButton.setEnabled(false);
|
|
||||||
// m_JHelpButton.setEnabled(true);
|
|
||||||
} catch (Exception ee) {
|
|
||||||
ee.printStackTrace();
|
|
||||||
System.err.print ("Error in run: " +ee +" : " + ee.getMessage() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void makeHelpButton() {
|
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
if (helpFileName != null && (!helpFileName.equals(""))) {
|
|
||||||
helpButton = new JButton("Description");
|
|
||||||
helpButton.setToolTipText("Description of the current optimization algorithm.");
|
|
||||||
helpButton.addActionListener(new ActionListener() {
|
|
||||||
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
makeHelpButton();
|
||||||
//System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!");
|
|
||||||
try {
|
|
||||||
if (helpFileName != null) {
|
|
||||||
HtmlDemo temp = new HtmlDemo(helpFileName);
|
|
||||||
temp.show();
|
|
||||||
}
|
|
||||||
helpButton.setEnabled(true);
|
|
||||||
} catch (Exception ee) {
|
|
||||||
ee.printStackTrace();
|
|
||||||
System.out.print("Error in run: " + ee + " : " + ee.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
toolBar.add(helpButton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void performedStop() {
|
|
||||||
runButton.setEnabled(true);
|
|
||||||
postProcessButton.setEnabled(true);
|
|
||||||
runButton.repaint();
|
|
||||||
stopButton.setEnabled(false);
|
|
||||||
toolBar.repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void performedStart(String infoString) {
|
return toolBar;
|
||||||
// m_ShowSolButton.setEnabled(true);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public void onUserStart() {
|
||||||
|
try {
|
||||||
|
moduleAdapter.startOpt();
|
||||||
|
stopButton.setEnabled(true);
|
||||||
|
runButton.setEnabled(false);
|
||||||
|
postProcessButton.setEnabled(false);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
System.err.print("Error in run: " + ex + " : " + ex.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void performedRestart(String infoString) {
|
private void makeHelpButton() {
|
||||||
}
|
///////////////////////////////////////////////////////////////
|
||||||
|
if (helpFileName != null && (!helpFileName.equals(""))) {
|
||||||
public void updateProgress(final int percent, String msg) {
|
helpButton = new JButton("Description");
|
||||||
}
|
helpButton.setToolTipText("Description of the current optimization algorithm.");
|
||||||
|
helpButton.addActionListener(new ActionListener() {
|
||||||
/**
|
|
||||||
*
|
public void actionPerformed(ActionEvent e) {
|
||||||
*/
|
//System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!");
|
||||||
public String getName() {
|
try {
|
||||||
return m_Name;
|
if (helpFileName != null) {
|
||||||
}
|
HtmlDemo temp = new HtmlDemo(helpFileName);
|
||||||
/**
|
temp.show();
|
||||||
*
|
}
|
||||||
*/
|
helpButton.setEnabled(true);
|
||||||
public void setHelperFilename(String fileName) {
|
} catch (Exception ee) {
|
||||||
if ((fileName == null) && (fileName == helpFileName)) {
|
ee.printStackTrace();
|
||||||
return; // both are null, do nothing
|
System.out.print("Error in run: " + ee + " : " + ee.getMessage());
|
||||||
}
|
}
|
||||||
if (fileName != null) {
|
}
|
||||||
if (helpFileName == null) {
|
});
|
||||||
// only old is null, nothing to be removed
|
toolBar.add(helpButton);
|
||||||
helpFileName = fileName;
|
}
|
||||||
makeHelpButton();
|
}
|
||||||
} else {
|
|
||||||
if (!helpFileName.equals(fileName)) {
|
/**
|
||||||
toolBar.remove(helpButton);
|
*
|
||||||
helpFileName = fileName;
|
*/
|
||||||
makeHelpButton();
|
public void performedStop() {
|
||||||
} //else // both are equal, do nothing
|
runButton.setEnabled(true);
|
||||||
}
|
postProcessButton.setEnabled(true);
|
||||||
} else { // s is null, so just remove
|
runButton.repaint();
|
||||||
toolBar.remove(helpButton);
|
stopButton.setEnabled(false);
|
||||||
helpFileName = fileName;
|
toolBar.repaint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public void performedStart(String infoString) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performedRestart(String infoString) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProgress(final int percent, String msg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return m_Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void setHelperFilename(String fileName) {
|
||||||
|
if ((fileName == null) && (fileName.equals(helpFileName))) {
|
||||||
|
return; // both are null, do nothing
|
||||||
|
}
|
||||||
|
if (fileName != null) {
|
||||||
|
if (helpFileName == null) {
|
||||||
|
// only old is null, nothing to be removed
|
||||||
|
helpFileName = fileName;
|
||||||
|
makeHelpButton();
|
||||||
|
} else {
|
||||||
|
if (!helpFileName.equals(fileName)) {
|
||||||
|
toolBar.remove(helpButton);
|
||||||
|
helpFileName = fileName;
|
||||||
|
makeHelpButton();
|
||||||
|
} //else // both are equal, do nothing
|
||||||
|
}
|
||||||
|
} else { // s is null, so just remove
|
||||||
|
toolBar.remove(helpButton);
|
||||||
|
helpFileName = fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,8 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
for (String className : classesLongNames) {
|
for (String className : classesLongNames) {
|
||||||
classNameMap.put(EVAHELP.cutClassName(className), className);
|
classNameMap.put(EVAHELP.cutClassName(className), className);
|
||||||
}
|
}
|
||||||
objectChooser.setModel(new DefaultComboBoxModel(classNameMap.keySet().toArray()));
|
Vector<String> classesList = new Vector<String>(classesLongNames);
|
||||||
|
objectChooser.setModel(new DefaultComboBoxModel(classesList));
|
||||||
if (withComboBoxToolTips) {
|
if (withComboBoxToolTips) {
|
||||||
objectChooser.setRenderer(new ToolTipComboBoxRenderer(collectComboToolTips(instances, tipMaxLen)));
|
objectChooser.setRenderer(new ToolTipComboBoxRenderer(collectComboToolTips(instances, tipMaxLen)));
|
||||||
}
|
}
|
||||||
@ -405,7 +406,7 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
|
|
||||||
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
||||||
className = (String) objectChooser.getSelectedItem();
|
className = (String) objectChooser.getSelectedItem();
|
||||||
className = classNameMap.get(className);
|
//className = classNameMap.get(className);
|
||||||
try {
|
try {
|
||||||
Object n = (Object) Class.forName(className).newInstance();
|
Object n = (Object) Class.forName(className).newInstance();
|
||||||
genericObjectEditor.setValue(n);
|
genericObjectEditor.setValue(n);
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
package eva2.server.go;
|
package eva2.server.go;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Title: EvA2
|
* Title: EvA2
|
||||||
* Description:
|
* Description:
|
||||||
@ -10,39 +9,73 @@ package eva2.server.go;
|
|||||||
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
|
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
|
|
||||||
|
|
||||||
/*==========================================================================*
|
|
||||||
* INTERFACE DECLARATION
|
|
||||||
*==========================================================================*/
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface PopulationInterface {
|
public interface PopulationInterface {
|
||||||
public IndividualInterface getBestIndividual();
|
|
||||||
public IndividualInterface getWorstIndividual();
|
|
||||||
public double[] getBestFitness();
|
|
||||||
public double[] getWorstFitness();
|
|
||||||
public double[] getMeanFitness();
|
|
||||||
public double[] getPopulationMeasures();
|
|
||||||
public int getFunctionCalls();
|
|
||||||
public int getGeneration();
|
|
||||||
/** This method returns problem specific data
|
|
||||||
* @return double[]
|
|
||||||
*/
|
|
||||||
public double[] getSpecificData();
|
|
||||||
|
|
||||||
/** This method returns identifiers for the
|
/**
|
||||||
* specific data
|
* Returns the best individual of the population.
|
||||||
* Note: "Pareto-Front" is reserved for mulit-crit. Problems
|
*
|
||||||
* string[1] gives the dimension of the fitness values
|
* @return The best individual
|
||||||
* @return String[]
|
*/
|
||||||
*/
|
IndividualInterface getBestIndividual();
|
||||||
public String[] getSpecificDataNames();
|
|
||||||
public Object get(int i);
|
/**
|
||||||
public int size();
|
* Returns the worst individual of the population.
|
||||||
public void clear();
|
*
|
||||||
|
* @return The worst individual
|
||||||
|
*/
|
||||||
|
IndividualInterface getWorstIndividual();
|
||||||
|
|
||||||
|
double[] getBestFitness();
|
||||||
|
|
||||||
|
double[] getWorstFitness();
|
||||||
|
|
||||||
|
double[] getMeanFitness();
|
||||||
|
|
||||||
|
double[] getPopulationMeasures();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of function calls.
|
||||||
|
* @return The number of function calls
|
||||||
|
*/
|
||||||
|
int getFunctionCalls();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The current generation count.
|
||||||
|
* @return int The current generation
|
||||||
|
*/
|
||||||
|
int getGeneration();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns problem specific data
|
||||||
|
*
|
||||||
|
* @return double[]
|
||||||
|
*/
|
||||||
|
double[] getSpecificData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns identifiers for the specific data Note:
|
||||||
|
* "Pareto-Front" is reserved for multi-crit. Problems string[1] gives the
|
||||||
|
* dimension of the fitness values
|
||||||
|
*
|
||||||
|
* @return String[]
|
||||||
|
*/
|
||||||
|
String[] getSpecificDataNames();
|
||||||
|
|
||||||
|
|
||||||
|
Object get(int i);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the size of the population.
|
||||||
|
* @return int size of the population
|
||||||
|
*/
|
||||||
|
int size();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the population.
|
||||||
|
*/
|
||||||
|
void clear();
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,12 @@
|
|||||||
package eva2.server.go.populations;
|
package eva2.server.go.populations;
|
||||||
|
|
||||||
|
|
||||||
import java.util.BitSet;
|
|
||||||
|
|
||||||
import eva2.server.go.individuals.AbstractEAIndividual;
|
import eva2.server.go.individuals.AbstractEAIndividual;
|
||||||
import eva2.server.go.individuals.InterfaceGAIndividual;
|
import eva2.server.go.individuals.InterfaceGAIndividual;
|
||||||
import eva2.tools.math.RNG;
|
import eva2.tools.math.RNG;
|
||||||
|
import java.util.BitSet;
|
||||||
|
|
||||||
/** This implementation of Population Based Incremental Learning is only
|
/**
|
||||||
|
* This implementation of Population Based Incremental Learning is only
|
||||||
* suited for a BitString based genotype representation.
|
* suited for a BitString based genotype representation.
|
||||||
* Copyright: Copyright (c) 2003
|
* Copyright: Copyright (c) 2003
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
* Company: University of Tuebingen, Computer Architecture
|
||||||
@ -45,8 +44,8 @@ public class PBILPopulation extends Population implements Cloneable, java.io.Ser
|
|||||||
* have been inited by a problem
|
* have been inited by a problem
|
||||||
*/
|
*/
|
||||||
public void init() {
|
public void init() {
|
||||||
this.m_Generation = 0;
|
this.generationCount = 0;
|
||||||
this.m_FunctionCalls = 0;
|
this.functionCallCount = 0;
|
||||||
if (!(this.get(0) instanceof InterfaceGAIndividual)) {
|
if (!(this.get(0) instanceof InterfaceGAIndividual)) {
|
||||||
System.err.println("Members of the population are not instance of InterfaceGAIndividual!");
|
System.err.println("Members of the population are not instance of InterfaceGAIndividual!");
|
||||||
return;
|
return;
|
||||||
@ -149,8 +148,8 @@ public class PBILPopulation extends Population implements Cloneable, java.io.Ser
|
|||||||
}
|
}
|
||||||
result += "}\n";
|
result += "}\n";
|
||||||
result += "Population size: " + this.size() + "\n";
|
result += "Population size: " + this.size() + "\n";
|
||||||
result += "Function calls : " + this.m_FunctionCalls + "\n";
|
result += "Function calls : " + this.functionCallCount + "\n";
|
||||||
result += "Generations : " + this.m_Generation;
|
result += "Generations : " + this.generationCount;
|
||||||
//for (int i = 0; i < this.size(); i++) {
|
//for (int i = 0; i < this.size(); i++) {
|
||||||
//result += ((AbstractEAIndividual)this.get(i)).getSolutionRepresentationFor()+"\n";
|
//result += ((AbstractEAIndividual)this.get(i)).getSolutionRepresentationFor()+"\n";
|
||||||
//}
|
//}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user