Change static final variable names to uppercase according to convention
This commit is contained in:
parent
09cf295554
commit
2f99e23676
@ -307,7 +307,7 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected void updateClassType() {
|
public void updateClassType() {
|
||||||
List<String> classesLongNames;
|
List<String> classesLongNames;
|
||||||
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
||||||
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
||||||
@ -355,7 +355,7 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
return tips;
|
return tips;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateChooser() {
|
public void updateChooser() {
|
||||||
String objectName = /*
|
String objectName = /*
|
||||||
* EVAHELP.cutClassName
|
* EVAHELP.cutClassName
|
||||||
*/ (genericObjectEditor.getValue().getClass().getName());
|
*/ (genericObjectEditor.getValue().getClass().getName());
|
||||||
|
@ -7,7 +7,7 @@ package eva2.gui;
|
|||||||
|
|
||||||
public class MultiLineString {
|
public class MultiLineString {
|
||||||
|
|
||||||
String string = "";
|
public String string = "";
|
||||||
|
|
||||||
public MultiLineString() {
|
public MultiLineString() {
|
||||||
}
|
}
|
||||||
|
452
src/eva2/gui/editor/GOEPanel.java
Normal file
452
src/eva2/gui/editor/GOEPanel.java
Normal file
@ -0,0 +1,452 @@
|
|||||||
|
package eva2.gui.editor;
|
||||||
|
|
||||||
|
import eva2.gui.PropertySheetPanel;
|
||||||
|
import eva2.optimization.tools.FileTools;
|
||||||
|
import eva2.tools.BasicResourceLoader;
|
||||||
|
import eva2.tools.EVAHELP;
|
||||||
|
import eva2.tools.SerializedObject;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.ItemEvent;
|
||||||
|
import java.awt.event.ItemListener;
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.beans.PropertyChangeSupport;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Vector;
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.plaf.basic.BasicComboBoxRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class GOEPanel extends JPanel implements ItemListener {
|
||||||
|
|
||||||
|
private Object backupObject;
|
||||||
|
private PropertyChangeSupport propChangeSupport;
|
||||||
|
/**
|
||||||
|
* The chooser component
|
||||||
|
*/
|
||||||
|
private JComboBox objectChooser;
|
||||||
|
/**
|
||||||
|
* The component that performs classifier customization
|
||||||
|
*/
|
||||||
|
private PropertySheetPanel propertySheetPanel;
|
||||||
|
/**
|
||||||
|
* The model containing the list of names to select from
|
||||||
|
*/
|
||||||
|
private DefaultComboBoxModel comboBoxModel;
|
||||||
|
/**
|
||||||
|
* Open object from disk
|
||||||
|
*/
|
||||||
|
private JButton openButton;
|
||||||
|
/**
|
||||||
|
* Save object to disk
|
||||||
|
*/
|
||||||
|
private JButton saveButton;
|
||||||
|
/**
|
||||||
|
* ok button
|
||||||
|
*/
|
||||||
|
private JButton okayButton;
|
||||||
|
/**
|
||||||
|
* cancel button
|
||||||
|
*/
|
||||||
|
private JButton cancelButton;
|
||||||
|
/**
|
||||||
|
* Creates the GUI editor component
|
||||||
|
*/
|
||||||
|
private GenericObjectEditor genericObjectEditor = null;
|
||||||
|
private boolean withComboBoxToolTips = true; // should tool tips for the combo box be created?
|
||||||
|
private int tipMaxLen = 100; // maximum length of tool tip
|
||||||
|
private HashMap<String, String> classNameMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public GOEPanel(Object target, Object backup, PropertyChangeSupport support, GenericObjectEditor goe) {
|
||||||
|
this(target, backup, support, goe, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public GOEPanel(Object target, Object backup, PropertyChangeSupport support, GenericObjectEditor goe, boolean withCancel) {
|
||||||
|
Object m_Object = target;
|
||||||
|
backupObject = backup;
|
||||||
|
propChangeSupport = support;
|
||||||
|
genericObjectEditor = goe;
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!(Proxy.isProxyClass(m_Object.getClass()))) {
|
||||||
|
backupObject = copyObject(m_Object);
|
||||||
|
}
|
||||||
|
} catch (OutOfMemoryError err) {
|
||||||
|
backupObject = null;
|
||||||
|
System.gc();
|
||||||
|
System.err.println("Could not create backup object: not enough memory (GOEPanel backup of " + m_Object + ")");
|
||||||
|
}
|
||||||
|
comboBoxModel = new DefaultComboBoxModel(new String[0]);
|
||||||
|
objectChooser = new JComboBox(comboBoxModel);
|
||||||
|
objectChooser.setEditable(false);
|
||||||
|
propertySheetPanel = new PropertySheetPanel();
|
||||||
|
propertySheetPanel.addPropertyChangeListener(
|
||||||
|
new PropertyChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void propertyChange(final PropertyChangeEvent event) {
|
||||||
|
propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
openButton = makeIconButton("images/Open16.gif", "Open");
|
||||||
|
openButton.setToolTipText("Load a configured object");
|
||||||
|
openButton.setEnabled(true);
|
||||||
|
openButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
Object object = FileTools.openObject(openButton, genericObjectEditor.getClassType());
|
||||||
|
if (object != null) {
|
||||||
|
// setValue takes care of: Making sure obj is of right type,
|
||||||
|
// and firing property change.
|
||||||
|
genericObjectEditor.setValue(object);
|
||||||
|
// Need a second setValue to get property values filled in OK.
|
||||||
|
// Not sure why.
|
||||||
|
genericObjectEditor.setValue(object); // <- Hannes ?!?!?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
saveButton = makeIconButton("images/Save16.gif", "Save");
|
||||||
|
saveButton.setToolTipText("Save the current configured object");
|
||||||
|
saveButton.setEnabled(true);
|
||||||
|
saveButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
FileTools.saveObjectWithFileChooser(saveButton, genericObjectEditor.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
okayButton = new JButton("OK");
|
||||||
|
okayButton.setEnabled(true);
|
||||||
|
okayButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
backupObject = copyObject(genericObjectEditor.getValue());
|
||||||
|
|
||||||
|
updateClassType();
|
||||||
|
updateChildPropertySheet();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ToDo: This is really ugly. Find a way to make this better.
|
||||||
|
*/
|
||||||
|
Container container = GOEPanel.this.getParent();
|
||||||
|
while (!(container instanceof JDialog)) {
|
||||||
|
container = container.getParent();
|
||||||
|
}
|
||||||
|
((JDialog) container).dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancelButton = new JButton("Cancel");
|
||||||
|
cancelButton.setEnabled(true);
|
||||||
|
cancelButton.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(final ActionEvent event) {
|
||||||
|
if (backupObject != null) {
|
||||||
|
// TODO m_goe.setObject(m_Object);
|
||||||
|
genericObjectEditor.setValue(copyObject(backupObject));
|
||||||
|
updateClassType();
|
||||||
|
updateChooser();
|
||||||
|
updateChildPropertySheet();
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* ToDo: This is really ugly. Find a way to make this better.
|
||||||
|
*/
|
||||||
|
Container container = GOEPanel.this.getParent();
|
||||||
|
while (!(container instanceof JDialog)) {
|
||||||
|
container = container.getParent();
|
||||||
|
}
|
||||||
|
((JDialog) container).dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
setLayout(new GridBagLayout());
|
||||||
|
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||||
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
gbConstraints.gridx = 0;
|
||||||
|
gbConstraints.gridy = 0;
|
||||||
|
add(objectChooser, gbConstraints);
|
||||||
|
|
||||||
|
gbConstraints.weightx = 1.0;
|
||||||
|
gbConstraints.weighty = 1.0;
|
||||||
|
gbConstraints.gridy = 1;
|
||||||
|
gbConstraints.gridheight = GridBagConstraints.RELATIVE;
|
||||||
|
gbConstraints.fill = GridBagConstraints.BOTH;
|
||||||
|
add(propertySheetPanel, gbConstraints);
|
||||||
|
|
||||||
|
JToolBar buttonBar = new JToolBar();
|
||||||
|
buttonBar.setRollover(true);
|
||||||
|
buttonBar.setFloatable(false);
|
||||||
|
buttonBar.add(openButton);
|
||||||
|
buttonBar.add(saveButton);
|
||||||
|
|
||||||
|
/* Add spacer to the end of the line */
|
||||||
|
buttonBar.add(Box.createHorizontalGlue());
|
||||||
|
|
||||||
|
if (withCancel) {
|
||||||
|
buttonBar.add(cancelButton);
|
||||||
|
}
|
||||||
|
buttonBar.add(okayButton);
|
||||||
|
|
||||||
|
gbConstraints.weightx = 0.0;
|
||||||
|
gbConstraints.weighty = 0.0;
|
||||||
|
gbConstraints.gridy = 2;
|
||||||
|
gbConstraints.anchor = GridBagConstraints.LINE_START;
|
||||||
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
add(buttonBar, gbConstraints);
|
||||||
|
|
||||||
|
if (genericObjectEditor.getClassType() != null) {
|
||||||
|
updateClassType();
|
||||||
|
updateChooser();
|
||||||
|
updateChildPropertySheet();
|
||||||
|
}
|
||||||
|
objectChooser.addItemListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is duplicated from EvAModuleButtonPanelMaker. ToDo: Refactor
|
||||||
|
* this.
|
||||||
|
*
|
||||||
|
* @param iconSrc
|
||||||
|
* @param title
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private JButton makeIconButton(final String iconSrc, final String title) {
|
||||||
|
JButton newButton;
|
||||||
|
byte[] bytes;
|
||||||
|
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
|
||||||
|
if (bytes == null) {
|
||||||
|
newButton = new JButton(title);
|
||||||
|
} else {
|
||||||
|
newButton = new JButton(new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
||||||
|
}
|
||||||
|
return newButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnabledOkCancelButtons(boolean enabled) {
|
||||||
|
okayButton.setEnabled(enabled);
|
||||||
|
cancelButton.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes a copy of an object using serialization.
|
||||||
|
*
|
||||||
|
* @param source the object to copy
|
||||||
|
* @return a copy of the source object
|
||||||
|
*/
|
||||||
|
protected Object copyObject(Object source) {
|
||||||
|
Object result = null;
|
||||||
|
try {
|
||||||
|
// System.out.println("Copying " + BeanInspector.toString(source));
|
||||||
|
SerializedObject so = new SerializedObject(source);
|
||||||
|
result = so.getObject();
|
||||||
|
so = null;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.err.println("GenericObjectEditor: Problem making backup object");
|
||||||
|
System.err.println(source.getClass().getName());
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used to hook an action listener to the ok button.
|
||||||
|
*
|
||||||
|
* @param a The action listener.
|
||||||
|
*/
|
||||||
|
public void addOkListener(ActionListener a) {
|
||||||
|
okayButton.addActionListener(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used to hook an action listener to the cancel button
|
||||||
|
*
|
||||||
|
* @param a The action listener.
|
||||||
|
*/
|
||||||
|
public void addCancelListener(ActionListener a) {
|
||||||
|
cancelButton.addActionListener(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used to remove an action listener from the ok button
|
||||||
|
*
|
||||||
|
* @param a The action listener
|
||||||
|
*/
|
||||||
|
public void removeOkListener(ActionListener a) {
|
||||||
|
okayButton.removeActionListener(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is used to remove an action listener from the cancel button
|
||||||
|
*
|
||||||
|
* @param a The action listener
|
||||||
|
*/
|
||||||
|
public void removeCancelListener(ActionListener a) {
|
||||||
|
cancelButton.removeActionListener(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(Object o) {
|
||||||
|
propertySheetPanel.setTarget(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected void updateClassType() {
|
||||||
|
List<String> classesLongNames;
|
||||||
|
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
||||||
|
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
||||||
|
if (classesLongNames.size() > 1) {
|
||||||
|
classNameMap = new HashMap<String, String>();
|
||||||
|
for (String className : classesLongNames) {
|
||||||
|
classNameMap.put(EVAHELP.cutClassName(className), className);
|
||||||
|
}
|
||||||
|
Vector<String> classesList = new Vector<String>(classesLongNames);
|
||||||
|
objectChooser.setModel(new DefaultComboBoxModel(classesList));
|
||||||
|
if (withComboBoxToolTips) {
|
||||||
|
objectChooser.setRenderer(new ToolTipComboBoxRenderer(collectComboToolTips(instances, tipMaxLen)));
|
||||||
|
}
|
||||||
|
GridBagConstraints gbConstraints = new GridBagConstraints();
|
||||||
|
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
|
||||||
|
gbConstraints.gridx = 0;
|
||||||
|
gbConstraints.gridy = 0;
|
||||||
|
add(objectChooser, gbConstraints);
|
||||||
|
} else {
|
||||||
|
remove(objectChooser);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String[] collectComboToolTips(List<Class<?>> instances, int maxLen) {
|
||||||
|
String[] tips = new String[instances.size()];
|
||||||
|
for (int i = 0; i < tips.length; i++) {
|
||||||
|
tips[i] = null;
|
||||||
|
Class[] classParams = new Class[]{};
|
||||||
|
try {
|
||||||
|
String tip = null;
|
||||||
|
Method giMeth = instances.get(i).getDeclaredMethod("globalInfo", classParams);
|
||||||
|
if (Modifier.isStatic(giMeth.getModifiers())) {
|
||||||
|
tip = (String) giMeth.invoke(null, (Object[]) null);
|
||||||
|
}
|
||||||
|
if (tip != null) {
|
||||||
|
if (tip.length() <= maxLen) {
|
||||||
|
tips[i] = tip;
|
||||||
|
} else {
|
||||||
|
tips[i] = tip.substring(0, maxLen - 2) + "..";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tips;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateChooser() {
|
||||||
|
String objectName = /*
|
||||||
|
* EVAHELP.cutClassName
|
||||||
|
*/ (genericObjectEditor.getValue().getClass().getName());
|
||||||
|
boolean found = false;
|
||||||
|
for (int i = 0; i < comboBoxModel.getSize(); i++) {
|
||||||
|
if (objectName.equals((String) comboBoxModel.getElementAt(i))) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
comboBoxModel.addElement(objectName);
|
||||||
|
}
|
||||||
|
objectChooser.getModel().setSelectedItem(objectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the child property sheet, and creates if needed
|
||||||
|
*/
|
||||||
|
public void updateChildPropertySheet() {
|
||||||
|
// Set the object as the target of the propertysheet
|
||||||
|
propertySheetPanel.setTarget(genericObjectEditor.getValue());
|
||||||
|
// Adjust size of containing window if possible
|
||||||
|
if ((getTopLevelAncestor() != null)
|
||||||
|
&& (getTopLevelAncestor() instanceof Window)) {
|
||||||
|
((Window) getTopLevelAncestor()).pack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When the chooser selection is changed, ensures that the Object is changed
|
||||||
|
* appropriately.
|
||||||
|
*
|
||||||
|
* @param e a value of type 'ItemEvent'
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void itemStateChanged(ItemEvent e) {
|
||||||
|
String className;
|
||||||
|
|
||||||
|
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
|
||||||
|
className = (String) objectChooser.getSelectedItem();
|
||||||
|
//className = classNameMap.get(className);
|
||||||
|
try {
|
||||||
|
Object n = (Object) Class.forName(className).newInstance();
|
||||||
|
genericObjectEditor.setValue(n);
|
||||||
|
// TODO ? setObject(n);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
System.err.println("Exeption in itemStateChanged " + ex.getMessage());
|
||||||
|
System.err.println("Classpath is " + System.getProperty("java.class.path"));
|
||||||
|
ex.printStackTrace();
|
||||||
|
objectChooser.hidePopup();
|
||||||
|
objectChooser.setSelectedIndex(0);
|
||||||
|
JOptionPane.showMessageDialog(this,
|
||||||
|
"Could not create an example of\n"
|
||||||
|
+ className + "\n"
|
||||||
|
+ "from the current classpath. Is the resource folder at the right place?\nIs the class abstract or the default constructor missing?",
|
||||||
|
"GenericObjectEditor",
|
||||||
|
JOptionPane.ERROR_MESSAGE);
|
||||||
|
EVAHELP.getSystemPropertyString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ToolTipComboBoxRenderer extends BasicComboBoxRenderer {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -5781643352198561208L;
|
||||||
|
String[] toolTips = null;
|
||||||
|
|
||||||
|
public ToolTipComboBoxRenderer(String[] tips) {
|
||||||
|
super();
|
||||||
|
toolTips = tips;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Component getListCellRendererComponent(JList list, Object value,
|
||||||
|
int index, boolean isSelected, boolean cellHasFocus) {
|
||||||
|
if (isSelected) {
|
||||||
|
setBackground(list.getSelectionBackground());
|
||||||
|
setForeground(list.getSelectionForeground());
|
||||||
|
if ((toolTips != null) && (index >= 0)) {
|
||||||
|
if (toolTips[index] != null) {
|
||||||
|
list.setToolTipText(toolTips[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setBackground(list.getBackground());
|
||||||
|
setForeground(list.getForeground());
|
||||||
|
}
|
||||||
|
setFont(list.getFont());
|
||||||
|
setText((value == null) ? "" : value.toString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
27
src/eva2/gui/editor/MultiLineString.java
Normal file
27
src/eva2/gui/editor/MultiLineString.java
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
package eva2.gui.editor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author not attributable
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class MultiLineString {
|
||||||
|
|
||||||
|
public String string = "";
|
||||||
|
|
||||||
|
public MultiLineString() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
MultiLineString multiLineString1 = new MultiLineString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getString() {
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setString(String string) {
|
||||||
|
this.string = string;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -577,7 +577,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.equals(Population.nextGenerationPerformed)) {
|
if (name.equals(Population.NEXT_GENERATION_PERFORMED)) {
|
||||||
Population population = ((InterfaceOptimizer) source).getPopulation();
|
Population population = ((InterfaceOptimizer) source).getPopulation();
|
||||||
double x = 100 / this.m_MultiRuns;
|
double x = 100 / this.m_MultiRuns;
|
||||||
if (this.m_GO.getTerminator() instanceof EvaluationTerminator) {
|
if (this.m_GO.getTerminator() instanceof EvaluationTerminator) {
|
||||||
|
@ -592,7 +592,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
|
|||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
int currentProgress;
|
int currentProgress;
|
||||||
if (name.equals(Population.nextGenerationPerformed)) {
|
if (name.equals(Population.NEXT_GENERATION_PERFORMED)) {
|
||||||
if (this.m_State.isVisible) {
|
if (this.m_State.isVisible) {
|
||||||
Population population = ((InterfaceOptimizer) source).getPopulation();
|
Population population = ((InterfaceOptimizer) source).getPopulation();
|
||||||
double x = 100;
|
double x = 100;
|
||||||
|
@ -382,7 +382,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.equals(Population.nextGenerationPerformed)) {
|
if (name.equals(Population.NEXT_GENERATION_PERFORMED)) {
|
||||||
m_Statistics.createNextGenerationPerformed(
|
m_Statistics.createNextGenerationPerformed(
|
||||||
(PopulationInterface) this.goParams.getOptimizer().getPopulation(),
|
(PopulationInterface) this.goParams.getOptimizer().getPopulation(),
|
||||||
this.goParams.getOptimizer(),
|
this.goParams.getOptimizer(),
|
||||||
|
@ -217,7 +217,7 @@ class CMAParamSet implements InterfacePopulationChangedEventListener, Serializab
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.equals(Population.populationInitialized)) {
|
if (name.equals(Population.POPULATION_INITIALIZED)) {
|
||||||
Population pop = (Population) source;
|
Population pop = (Population) source;
|
||||||
if (MutateESRankMuCMA.TRACE_1) {
|
if (MutateESRankMuCMA.TRACE_1) {
|
||||||
System.out.println("Event " + name + " arrived in CMAParamSet!!!");
|
System.out.println("Event " + name + " arrived in CMAParamSet!!!");
|
||||||
|
@ -106,9 +106,9 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
|
|
||||||
private Comparator<Object> lastSortingComparator = null;
|
private Comparator<Object> lastSortingComparator = null;
|
||||||
private InterfaceDistanceMetric popDistMetric = null; // an associated metric
|
private InterfaceDistanceMetric popDistMetric = null; // an associated metric
|
||||||
public static final String funCallIntervalReached = "FunCallIntervalReached";
|
public static final String FUN_CALL_INTERVAL_REACHED = "FunCallIntervalReached";
|
||||||
public static final String populationInitialized = "PopulationReinitOccured";
|
public static final String POPULATION_INITIALIZED = "PopulationReinitOccured";
|
||||||
public static final String nextGenerationPerformed = "NextGenerationPerformed";
|
public static final String NEXT_GENERATION_PERFORMED = "NextGenerationPerformed";
|
||||||
|
|
||||||
public Population() {
|
public Population() {
|
||||||
LOGGER.log(Level.FINER, "New population has been created.");
|
LOGGER.log(Level.FINER, "New population has been created.");
|
||||||
@ -419,7 +419,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//System.out.println("After pop init: " + this.getStringRepresentation());
|
//System.out.println("After pop init: " + this.getStringRepresentation());
|
||||||
firePropertyChangedEvent(Population.populationInitialized);
|
firePropertyChangedEvent(Population.POPULATION_INITIALIZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -499,8 +499,6 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
* Create a population instance which distributes the individuals according
|
* Create a population instance which distributes the individuals according
|
||||||
* to a random latin hypercube sampling.
|
* to a random latin hypercube sampling.
|
||||||
*
|
*
|
||||||
* @param popSize
|
|
||||||
* @param template
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static void createRLHSampling(Population pop, boolean fillPop) {
|
public static void createRLHSampling(Population pop, boolean fillPop) {
|
||||||
@ -627,7 +625,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
this.functionCallCount++;
|
this.functionCallCount++;
|
||||||
if (doEvalNotify()) {
|
if (doEvalNotify()) {
|
||||||
if ((functionCallCount % notifyEvalInterval) == 0) {
|
if ((functionCallCount % notifyEvalInterval) == 0) {
|
||||||
firePropertyChangedEvent(funCallIntervalReached);
|
firePropertyChangedEvent(FUN_CALL_INTERVAL_REACHED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -647,7 +645,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
// the notify interval will be stepped over or hit
|
// the notify interval will be stepped over or hit
|
||||||
int toHit = (nextStep - functionCallCount);
|
int toHit = (nextStep - functionCallCount);
|
||||||
this.functionCallCount += toHit; // little cheat, notify may be after some more evals
|
this.functionCallCount += toHit; // little cheat, notify may be after some more evals
|
||||||
firePropertyChangedEvent(funCallIntervalReached);
|
firePropertyChangedEvent(FUN_CALL_INTERVAL_REACHED);
|
||||||
d -= toHit;
|
d -= toHit;
|
||||||
// this.functionCalls += (d-toHit);
|
// this.functionCalls += (d-toHit);
|
||||||
}
|
}
|
||||||
@ -744,7 +742,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
((AbstractEAIndividual) get(i)).incrAge();
|
((AbstractEAIndividual) get(i)).incrAge();
|
||||||
}
|
}
|
||||||
this.generationCount++;
|
this.generationCount++;
|
||||||
firePropertyChangedEvent(nextGenerationPerformed);
|
firePropertyChangedEvent(NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2317,7 +2315,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fire an event every n function calls, the event sends the public String
|
* Fire an event every n function calls, the event sends the public String
|
||||||
* funCallIntervalReached. Be aware that if this interval is smaller than
|
* FUN_CALL_INTERVAL_REACHED. Be aware that if this interval is smaller than
|
||||||
* the population size, it may happen that a notification is fired before
|
* the population size, it may happen that a notification is fired before
|
||||||
* all individuals have been evaluated once, meaning that a false zero
|
* all individuals have been evaluated once, meaning that a false zero
|
||||||
* fitness appears at the beginning of the optimization.
|
* fitness appears at the beginning of the optimization.
|
||||||
|
@ -67,7 +67,6 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
private boolean printEdgeRate = false;
|
private boolean printEdgeRate = false;
|
||||||
private boolean printTimestamps = false;
|
private boolean printTimestamps = false;
|
||||||
private boolean printMetrics = false;
|
private boolean printMetrics = false;
|
||||||
// private boolean printExtraOutput = false;
|
|
||||||
|
|
||||||
public BOA() {
|
public BOA() {
|
||||||
}
|
}
|
||||||
@ -246,7 +245,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
defaultInit();
|
defaultInit();
|
||||||
this.problem.initializePopulation(this.population);
|
this.problem.initializePopulation(this.population);
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void evaluatePopulation(Population pop) {
|
private void evaluatePopulation(Population pop) {
|
||||||
@ -553,7 +552,7 @@ public class BOA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
this.population.addAll(newlyGenerated);
|
this.population.addAll(newlyGenerated);
|
||||||
this.count++;
|
this.count++;
|
||||||
// we are done with one generation
|
// we are done with one generation
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
this.problem.evaluatePopulationEnd(this.population);
|
this.problem.evaluatePopulationEnd(this.population);
|
||||||
// print output if desired
|
// print output if desired
|
||||||
// if (this.printExtraOutput) {
|
// if (this.printExtraOutput) {
|
||||||
|
@ -216,14 +216,14 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ
|
|||||||
public void init() {
|
public void init() {
|
||||||
defaultInit();
|
defaultInit();
|
||||||
initRefSet(diversify());
|
initRefSet(diversify());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initByPopulation(Population pop, boolean reset) {
|
public void initByPopulation(Population pop, boolean reset) {
|
||||||
defaultInit();
|
defaultInit();
|
||||||
initRefSet(diversify(pop));
|
initRefSet(diversify(pop));
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -811,13 +811,13 @@ public class BinaryScatterSearch implements InterfaceOptimizer, java.io.Serializ
|
|||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
// The events of the interim hill climbing population will be caught here
|
// The events of the interim hill climbing population will be caught here
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
// set funcalls to real value
|
// set funcalls to real value
|
||||||
refSet.SetFunctionCalls(((Population) source).getFunctionCalls());
|
refSet.SetFunctionCalls(((Population) source).getFunctionCalls());
|
||||||
|
|
||||||
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -100,7 +100,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
|||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ public class CHCAdaptiveSearchAlgorithm implements InterfaceOptimizer, java.io.S
|
|||||||
nextGeneration.addPopulation(tmp);
|
nextGeneration.addPopulation(tmp);
|
||||||
this.population = nextGeneration;
|
this.population = nextGeneration;
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -897,7 +897,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +150,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
m_Population.addPopulationChangedEventListener(null); // noone will be notified directly on pop changes
|
m_Population.addPopulationChangedEventListener(null); // noone will be notified directly on pop changes
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +167,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,21 +256,21 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// System.out.println("funcalls: " + evalCnt);
|
// System.out.println("funcalls: " + evalCnt);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
// The events of the interim hill climbing population will be caught here
|
// The events of the interim hill climbing population will be caught here
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
// if ((((Population)source).size() % 50) > 0) {
|
// if ((((Population)source).size() % 50) > 0) {
|
||||||
// System.out.println("bla");
|
// System.out.println("bla");
|
||||||
// }
|
// }
|
||||||
// set funcalls to real value
|
// set funcalls to real value
|
||||||
m_Population.SetFunctionCalls(((Population) source).getFunctionCalls());
|
m_Population.SetFunctionCalls(((Population) source).getFunctionCalls());
|
||||||
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
// do not react to NextGenerationPerformed
|
// do not react to NextGenerationPerformed
|
||||||
//else System.err.println("ERROR, event was " + name);
|
//else System.err.println("ERROR, event was " + name);
|
||||||
|
@ -109,7 +109,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
// children = new Population(m_Population.size());
|
// children = new Population(m_Population.size());
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideHideable() {
|
public void hideHideable() {
|
||||||
@ -128,7 +128,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
// if (reset) this.m_Population.init();
|
// if (reset) this.m_Population.init();
|
||||||
// else children = new Population(m_Population.size());
|
// else children = new Population(m_Population.size());
|
||||||
@ -590,7 +590,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
|||||||
}
|
}
|
||||||
this.m_Population.incrFunctionCallsBy(children.size());
|
this.m_Population.incrFunctionCallsBy(children.size());
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void optimizeSteadyState() {
|
public void optimizeSteadyState() {
|
||||||
@ -699,7 +699,7 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
|||||||
// }
|
// }
|
||||||
m_Problem.evaluatePopulationEnd(m_Population);
|
m_Problem.evaluatePopulationEnd(m_Population);
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -607,7 +607,7 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
|
|||||||
generateEvalImmigrants(getNumRndImmigrants());
|
generateEvalImmigrants(getNumRndImmigrants());
|
||||||
}
|
}
|
||||||
collectPopulationIncGen(population, peakOpts, randomNewIndies);
|
collectPopulationIncGen(population, peakOpts, randomNewIndies);
|
||||||
//this.firePropertyChangedEvent(Population.nextGenerationPerformed); // moved this to registerPopulationStateChanged which is called from the population
|
//this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED); // moved this to registerPopulationStateChanged which is called from the population
|
||||||
}
|
}
|
||||||
|
|
||||||
private Population deactivateSpecies(int clustIndex, boolean resetRandomly) {
|
private Population deactivateSpecies(int clustIndex, boolean resetRandomly) {
|
||||||
@ -1304,9 +1304,9 @@ public class EsDpiNiching implements InterfaceOptimizer, Serializable, Interface
|
|||||||
if (getPopulation() != source) {
|
if (getPopulation() != source) {
|
||||||
System.err.println("Warning, mismatching population in " + this.getClass().getName());
|
System.err.println("Warning, mismatching population in " + this.getClass().getName());
|
||||||
}
|
}
|
||||||
if (name.equals(Population.funCallIntervalReached)) {
|
if (name.equals(Population.FUN_CALL_INTERVAL_REACHED)) {
|
||||||
// getPopulation().SetFunctionCalls(((Population)source).getFunctionCalls()); // this is ugly and I dont know what its for.. possibly if the population instance changes along the GUi?
|
// getPopulation().SetFunctionCalls(((Population)source).getFunctionCalls()); // this is ugly and I dont know what its for.. possibly if the population instance changes along the GUi?
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
} else {
|
} else {
|
||||||
// this may come from cloned instances with the same listener - should not happen since they are removed.
|
// this may come from cloned instances with the same listener - should not happen since they are removed.
|
||||||
// it may still come from "incGeneration" calls - we can ignore those
|
// it may still come from "incGeneration" calls - we can ignore those
|
||||||
|
@ -212,7 +212,7 @@ public class EvolutionStrategies implements InterfaceOptimizer, java.io.Serializ
|
|||||||
setPop(getReplacePop(nextGeneration));
|
setPop(getReplacePop(nextGeneration));
|
||||||
|
|
||||||
// necessary here because evalPop was not called on population
|
// necessary here because evalPop was not called on population
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +100,7 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
|||||||
//
|
//
|
||||||
// setPop(getReplacePop(nextGeneration));
|
// setPop(getReplacePop(nextGeneration));
|
||||||
//
|
//
|
||||||
// this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
// this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
super.optimize();
|
super.optimize();
|
||||||
|
|
||||||
@ -147,8 +147,8 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void firePropertyChangedEvent(String name) {
|
protected void firePropertyChangedEvent(String name) {
|
||||||
if (name.equals(Population.funCallIntervalReached)) {
|
if (name.equals(Population.FUN_CALL_INTERVAL_REACHED)) {
|
||||||
super.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
super.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
} else {
|
} else {
|
||||||
} // nothing, evt is produced in #registerPopulationStateChanged, dont forward original due to changing pop size
|
} // nothing, evt is produced in #registerPopulationStateChanged, dont forward original due to changing pop size
|
||||||
}
|
}
|
||||||
@ -258,9 +258,9 @@ public class EvolutionStrategyIPOP extends EvolutionStrategies implements Interf
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.equals(Population.funCallIntervalReached)) {
|
if (name.equals(Population.FUN_CALL_INTERVAL_REACHED)) {
|
||||||
getPopulation().SetFunctionCalls(((Population) source).getFunctionCalls()); // TODO this is ugly
|
getPopulation().SetFunctionCalls(((Population) source).getFunctionCalls()); // TODO this is ugly
|
||||||
super.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
super.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
} else {
|
} else {
|
||||||
// System.err.println("Not forwarding event " + name);
|
// System.err.println("Not forwarding event " + name);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.m_PopulationSize = this.m_Population.size();
|
this.m_PopulationSize = this.m_Population.size();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -66,7 +66,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class EvolutionaryProgramming implements InterfaceOptimizer, java.io.Seri
|
|||||||
nextGeneration.addPopulation(this.m_Population);
|
nextGeneration.addPopulation(this.m_Population);
|
||||||
this.m_Population = nextGeneration;
|
this.m_Population = nextGeneration;
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,7 +60,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.m_CurrentFloodPeak = this.m_InitialFloodPeak;
|
this.m_CurrentFloodPeak = this.m_InitialFloodPeak;
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
this.m_CurrentFloodPeak = this.m_InitialFloodPeak;
|
this.m_CurrentFloodPeak = this.m_InitialFloodPeak;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ public class FloodAlgorithm implements InterfaceOptimizer, java.io.Serializable
|
|||||||
}
|
}
|
||||||
this.m_CurrentFloodPeak -= this.m_DrainRate;
|
this.m_CurrentFloodPeak -= this.m_DrainRate;
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.optimizationProblem.initializePopulation(this.population);
|
this.optimizationProblem.initializePopulation(this.population);
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,7 +74,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
this.optimizationProblem.initializePopulation(population);
|
this.optimizationProblem.initializePopulation(population);
|
||||||
this.population.init();
|
this.population.init();
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public class GeneticAlgorithm implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
}
|
}
|
||||||
this.population.setTargetSize(this.population.size());
|
this.population.setTargetSize(this.population.size());
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.getPopulation().init();
|
this.getPopulation().init();
|
||||||
this.m_Problem.evaluate(this.getPopulation());
|
this.m_Problem.evaluate(this.getPopulation());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
//System.out.println("initByPopulation() called");
|
//System.out.println("initByPopulation() called");
|
||||||
// indyhash = new Hashtable();
|
// indyhash = new Hashtable();
|
||||||
@ -306,7 +306,7 @@ public class GradientDescentAlgorithm implements InterfaceOptimizer, java.io.Ser
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double momentumweigth = 0.1;
|
private double momentumweigth = 0.1;
|
||||||
|
@ -55,7 +55,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,7 +64,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ public class HillClimbing implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// this.m_Population.incrGeneration();
|
// this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InterfaceMutation getMutationOperator() {
|
public InterfaceMutation getMutationOperator() {
|
||||||
|
@ -144,7 +144,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
System.err.println("Error, inconsistent generations!");
|
System.err.println("Error, inconsistent generations!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed, this.m_Optimizer.getPopulation());
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED, this.m_Optimizer.getPopulation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,7 +217,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
this.m_Population.addPopulation(pop);
|
this.m_Population.addPopulation(pop);
|
||||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed, this.m_Optimizer.getPopulation());
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED, this.m_Optimizer.getPopulation());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,7 +285,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||||
}
|
}
|
||||||
// System.out.println("Fitnesscalls :" + this.m_Population.getFunctionCalls());
|
// System.out.println("Fitnesscalls :" + this.m_Population.getFunctionCalls());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed, this.m_Optimizer.getPopulation());
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED, this.m_Optimizer.getPopulation());
|
||||||
double plotValue = (this.m_Problem.getDoublePlotValue(this.m_Population)).doubleValue();
|
double plotValue = (this.m_Problem.getDoublePlotValue(this.m_Population)).doubleValue();
|
||||||
if (this.m_Show) {
|
if (this.m_Show) {
|
||||||
this.m_Plot.setConnectedPoint(this.m_Population.getFunctionCalls(), plotValue, 0);
|
this.m_Plot.setConnectedPoint(this.m_Population.getFunctionCalls(), plotValue, 0);
|
||||||
|
@ -119,7 +119,7 @@ public class LTGA implements InterfaceOptimizer, java.io.Serializable, Interface
|
|||||||
this.defaultInit();
|
this.defaultInit();
|
||||||
this.problem.initializePopulation(this.population);
|
this.problem.initializePopulation(this.population);
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void evaluatePopulation(Population pop) {
|
private void evaluatePopulation(Population pop) {
|
||||||
@ -368,10 +368,10 @@ public class LTGA implements InterfaceOptimizer, java.io.Serializable, Interface
|
|||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
// The events of the interim hill climbing population will be caught here
|
// The events of the interim hill climbing population will be caught here
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
// set funcalls to real value
|
// set funcalls to real value
|
||||||
this.population.setFunctionCalls(((Population) source).getFunctionCalls());
|
this.population.setFunctionCalls(((Population) source).getFunctionCalls());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ public class MLTGA implements InterfaceOptimizer, java.io.Serializable, Interfac
|
|||||||
defaultInit();
|
defaultInit();
|
||||||
this.problem.initializePopulation(this.population);
|
this.problem.initializePopulation(this.population);
|
||||||
this.evaluatePopulation(this.population);
|
this.evaluatePopulation(this.population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void evaluatePopulation(Population pop) {
|
private void evaluatePopulation(Population pop) {
|
||||||
@ -347,10 +347,10 @@ public class MLTGA implements InterfaceOptimizer, java.io.Serializable, Interfac
|
|||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
// The events of the interim hill climbing population will be caught here
|
// The events of the interim hill climbing population will be caught here
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
// set funcalls to real value
|
// set funcalls to real value
|
||||||
this.population.setFunctionCalls(((Population) source).getFunctionCalls());
|
this.population.setFunctionCalls(((Population) source).getFunctionCalls());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer,
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.getPopulation().init();
|
this.getPopulation().init();
|
||||||
this.m_Problem.evaluate(this.getPopulation());
|
this.m_Problem.evaluate(this.getPopulation());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer,
|
|||||||
this.m_GlobalOptimizer.setProblem(this.m_Problem);
|
this.m_GlobalOptimizer.setProblem(this.m_Problem);
|
||||||
this.m_GlobalOptimizer.init();
|
this.m_GlobalOptimizer.init();
|
||||||
this.evaluatePopulation(this.m_GlobalOptimizer.getPopulation());
|
this.evaluatePopulation(this.m_GlobalOptimizer.getPopulation());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,7 +174,7 @@ public class MemeticAlgorithm implements InterfaceOptimizer,
|
|||||||
System.out.println("function calls"
|
System.out.println("function calls"
|
||||||
+ this.m_GlobalOptimizer.getPopulation().getFunctionCalls());
|
+ this.m_GlobalOptimizer.getPopulation().getFunctionCalls());
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,7 +61,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,7 +76,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ public class MonteCarloSearch implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +183,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable {
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
// children = new Population(m_Population.size());
|
// children = new Population(m_Population.size());
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ public class MultiObjectiveCMAES implements InterfaceOptimizer, Serializable {
|
|||||||
|
|
||||||
m_Population.incrFunctionCallsBy(children.size());
|
m_Population.incrFunctionCallsBy(children.size());
|
||||||
m_Population.incrGeneration();
|
m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.m_Optimizer.init();
|
this.m_Optimizer.init();
|
||||||
this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation());
|
this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +81,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
public void initByPopulation(Population pop, boolean reset) {
|
public void initByPopulation(Population pop, boolean reset) {
|
||||||
this.m_Optimizer.initByPopulation(pop, reset);
|
this.m_Optimizer.initByPopulation(pop, reset);
|
||||||
this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation());
|
this.m_Archiver.addElementsToArchive(this.m_Optimizer.getPopulation());
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +123,7 @@ public class MultiObjectiveEA implements InterfaceOptimizer, java.io.Serializabl
|
|||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double[][] showMay(Population pop) {
|
private double[][] showMay(Population pop) {
|
||||||
|
@ -274,7 +274,7 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte
|
|||||||
private void fireNextGenerationPerformed() {
|
private void fireNextGenerationPerformed() {
|
||||||
if (m_Listener != null) {
|
if (m_Listener != null) {
|
||||||
for (int i = 0; i < m_Listener.size(); i++) {
|
for (int i = 0; i < m_Listener.size(); i++) {
|
||||||
m_Listener.elementAt(i).registerPopulationStateChanged(this, Population.nextGenerationPerformed);
|
m_Listener.elementAt(i).registerPopulationStateChanged(this, Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ public class NelderMeadSimplex implements InterfaceOptimizer, Serializable, Inte
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
fireNextGenerationPerformed();
|
fireNextGenerationPerformed();
|
||||||
}// else System.err.println("unknown event!");
|
}// else System.err.println("unknown event!");
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class PDDifferentialEvolution implements InterfaceOptimizer, java.io.Seri
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hideHideable() {
|
public void hideHideable() {
|
||||||
@ -119,7 +119,7 @@ public class PDDifferentialEvolution implements InterfaceOptimizer, java.io.Seri
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ public class PDDifferentialEvolution implements InterfaceOptimizer, java.io.Seri
|
|||||||
}
|
}
|
||||||
this.m_Population.incrFunctionCallsBy(children.size());
|
this.m_Population.incrFunctionCallsBy(children.size());
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void optimizeSteadyState() {
|
public void optimizeSteadyState() {
|
||||||
@ -617,7 +617,7 @@ public class PDDifferentialEvolution implements InterfaceOptimizer, java.io.Seri
|
|||||||
|
|
||||||
m_Problem.evaluatePopulationEnd(m_Population);
|
m_Problem.evaluatePopulationEnd(m_Population);
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S
|
|||||||
setWithShow(withShow);
|
setWithShow(withShow);
|
||||||
|
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -125,7 +125,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ public class ParticleFilterOptimization implements InterfaceOptimizer, java.io.S
|
|||||||
|
|
||||||
// collectStatistics(m_Population);
|
// collectStatistics(m_Population);
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,7 +477,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
this.m_BestIndividual = (AbstractEAIndividual) this.m_Population.getBestEAIndividual().clone();
|
this.m_BestIndividual = (AbstractEAIndividual) this.m_Population.getBestEAIndividual().clone();
|
||||||
|
|
||||||
if (reset) {
|
if (reset) {
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
treeLevels = 0;
|
treeLevels = 0;
|
||||||
@ -1392,7 +1392,7 @@ public class ParticleSwarmOptimization implements InterfaceOptimizer, java.io.Se
|
|||||||
// } else m_Population.incrFunctionCallsBy(maxSteps);
|
// } else m_Population.incrFunctionCallsBy(maxSteps);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
|
|
||||||
if (sleepTime > 0) {
|
if (sleepTime > 0) {
|
||||||
try {
|
try {
|
||||||
|
@ -75,7 +75,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -96,7 +96,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j
|
|||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
}
|
}
|
||||||
((PBILPopulation) this.m_Population).buildProbabilityVector();
|
((PBILPopulation) this.m_Population).buildProbabilityVector();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -142,7 +142,7 @@ public class PopulationBasedIncrementalLearning implements InterfaceOptimizer, j
|
|||||||
} else {
|
} else {
|
||||||
this.m_Population = nextGeneration;
|
this.m_Population = nextGeneration;
|
||||||
}
|
}
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,7 +194,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
|||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
// The events of the interim hill climbing population will be caught here
|
// The events of the interim hill climbing population will be caught here
|
||||||
if (name.compareTo(Population.funCallIntervalReached) == 0) {
|
if (name.compareTo(Population.FUN_CALL_INTERVAL_REACHED) == 0) {
|
||||||
// if ((((Population)source).size() % 50) > 0) {
|
// if ((((Population)source).size() % 50) > 0) {
|
||||||
// System.out.println("bla");
|
// System.out.println("bla");
|
||||||
// }
|
// }
|
||||||
@ -203,7 +203,7 @@ public class ScatterSearch implements InterfaceOptimizer, java.io.Serializable,
|
|||||||
|
|
||||||
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
// System.out.println("FunCallIntervalReached at " + (((Population)source).getFunctionCalls()));
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
// do not react to NextGenerationPerformed
|
// do not react to NextGenerationPerformed
|
||||||
//else System.err.println("ERROR, event was " + name);
|
//else System.err.println("ERROR, event was " + name);
|
||||||
|
@ -59,7 +59,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.m_CurrentTemperature = this.m_InitialTemperature;
|
this.m_CurrentTemperature = this.m_InitialTemperature;
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,7 +75,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ public class SimulatedAnnealing implements InterfaceOptimizer, java.io.Serializa
|
|||||||
}
|
}
|
||||||
this.m_CurrentTemperature = this.m_Alpha * this.m_CurrentTemperature;
|
this.m_CurrentTemperature = this.m_Alpha * this.m_CurrentTemperature;
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +53,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
public void init() {
|
public void init() {
|
||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.evaluatePopulation(this.m_Population);
|
this.evaluatePopulation(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
}
|
}
|
||||||
this.m_Population.incrFunctionCallsBy(this.m_Population.size());
|
this.m_Population.incrFunctionCallsBy(this.m_Population.size());
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,7 +55,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa
|
|||||||
this.m_Problem.initializePopulation(this.m_Population);
|
this.m_Problem.initializePopulation(this.m_Population);
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.m_CurrentT = this.m_InitialT;
|
this.m_CurrentT = this.m_InitialT;
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,7 +71,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa
|
|||||||
if (reset) {
|
if (reset) {
|
||||||
this.m_Population.init();
|
this.m_Population.init();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ public class ThresholdAlgorithm implements InterfaceOptimizer, java.io.Serializa
|
|||||||
}
|
}
|
||||||
this.m_CurrentT = this.m_Alpha * this.m_CurrentT;
|
this.m_CurrentT = this.m_Alpha * this.m_CurrentT;
|
||||||
this.m_Population.incrGeneration();
|
this.m_Population.incrGeneration();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -678,7 +678,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
|||||||
population.incrFunctionCalls();
|
population.incrFunctionCalls();
|
||||||
if (notifyAfter(population.getFunctionCalls())) {
|
if (notifyAfter(population.getFunctionCalls())) {
|
||||||
// System.out.println("Notifying after " + population.getFunctionCalls());
|
// System.out.println("Notifying after " + population.getFunctionCalls());
|
||||||
firePropertyChangedEvent(Population.nextGenerationPerformed);
|
firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
|
|||||||
this.m_SOOptimizer.init();
|
this.m_SOOptimizer.init();
|
||||||
}
|
}
|
||||||
this.communicate();
|
this.communicate();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -130,7 +130,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
|
|||||||
this.m_SOOptimizer.initByPopulation(pop, reset);
|
this.m_SOOptimizer.initByPopulation(pop, reset);
|
||||||
}
|
}
|
||||||
this.communicate();
|
this.communicate();
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +150,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
|
|||||||
|
|
||||||
System.gc();
|
System.gc();
|
||||||
|
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,7 +173,7 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
|
|||||||
oldFunctionCalls = this.m_Population.getFunctionCalls();
|
oldFunctionCalls = this.m_Population.getFunctionCalls();
|
||||||
this.m_Problem.evaluate(this.m_Population);
|
this.m_Problem.evaluate(this.m_Population);
|
||||||
this.m_Population.SetFunctionCalls(oldFunctionCalls);
|
this.m_Population.SetFunctionCalls(oldFunctionCalls);
|
||||||
this.firePropertyChangedEvent(Population.nextGenerationPerformed);
|
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||||
// double plotValue = (this.problem.getDoublePlotValue(this.m_Population)).doubleValue();
|
// double plotValue = (this.problem.getDoublePlotValue(this.m_Population)).doubleValue();
|
||||||
// now they are synchronized lets migrate
|
// now they are synchronized lets migrate
|
||||||
this.migrate();
|
this.migrate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user