Reformat all Code.

This commit is contained in:
2013-07-22 15:37:52 +02:00
parent 4bbcf937dc
commit 09cf295554
681 changed files with 57140 additions and 51465 deletions

View File

@@ -5,6 +5,7 @@
package eva2.gui; package eva2.gui;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@@ -13,7 +14,6 @@ import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
/** /**
*
* @author becker * @author becker
*/ */
public class AboutDialog extends JDialog { public class AboutDialog extends JDialog {

View File

@@ -6,6 +6,7 @@ import eva2.tools.Pair;
import eva2.tools.SelectedTag; import eva2.tools.SelectedTag;
import eva2.tools.StringTools; import eva2.tools.StringTools;
import eva2.tools.Tag; import eva2.tools.Tag;
import java.beans.BeanInfo; import java.beans.BeanInfo;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.Introspector; import java.beans.Introspector;
@@ -23,7 +24,6 @@ import java.util.logging.Logger;
* generic display. * generic display.
* *
* @author mkron, Holger Ulmer, Felix Streichert, Hannes Planatscher * @author mkron, Holger Ulmer, Felix Streichert, Hannes Planatscher
*
*/ */
public class BeanInspector { public class BeanInspector {
private static final Logger LOGGER = Logger.getLogger(BeanInspector.class.getName()); private static final Logger LOGGER = Logger.getLogger(BeanInspector.class.getName());
@@ -108,9 +108,9 @@ public class BeanInspector {
/** /**
* Produce a String representation of an arbitrary object. * Produce a String representation of an arbitrary object.
* *
* @see #toString(Object, char, boolean, String)
* @param obj * @param obj
* @return * @return
* @see #toString(Object, char, boolean, String)
*/ */
public static String toString(Object obj) { public static String toString(Object obj) {
return toString(obj, ';', false, "", 1, false); return toString(obj, ';', false, "", 1, false);
@@ -574,7 +574,6 @@ public class BeanInspector {
/** /**
* For a Java primitive wrapper class return the corresponding primitive * For a Java primitive wrapper class return the corresponding primitive
* class. * class.
*
*/ */
public static Class getUnboxedType(Class cls) { public static Class getUnboxedType(Class cls) {
if (cls == Double.class) { if (cls == Double.class) {

View File

@@ -9,10 +9,12 @@ package eva2.gui;
* $Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $ * $Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.optimization.OptimizationStateListener; import eva2.optimization.OptimizationStateListener;
import eva2.optimization.modules.ModuleAdapter; import eva2.optimization.modules.ModuleAdapter;
import eva2.optimization.stat.OptimizationJob; import eva2.optimization.stat.OptimizationJob;
import eva2.tools.ToolBoxGui; import eva2.tools.ToolBoxGui;
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;

View File

@@ -7,6 +7,7 @@ package eva2.gui;
import eva2.optimization.go.InterfaceNotifyOnInformers; import eva2.optimization.go.InterfaceNotifyOnInformers;
import eva2.optimization.problems.InterfaceAdditionalPopulationInformer; import eva2.optimization.problems.InterfaceAdditionalPopulationInformer;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.io.Serializable; import java.io.Serializable;
@@ -86,8 +87,8 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
} }
/** /**
* @deprecated
* @return The toolbar with control buttons * @return The toolbar with control buttons
* @deprecated
*/ */
public JExtToolBar getToolBar() { public JExtToolBar getToolBar() {
return extToolBar; return extToolBar;

View File

@@ -9,10 +9,9 @@ import javax.swing.tree.DefaultMutableTreeNode;
* The tree is constructed using the reflection functionality of PropertySheetPanel * The tree is constructed using the reflection functionality of PropertySheetPanel
* which is also used to generate the nested panels for parameter configuration. * which is also used to generate the nested panels for parameter configuration.
* *
* @author mkron
* @see PropertySheetPanel * @see PropertySheetPanel
* @see GOParameters * @see GOParameters
* @author mkron
*
*/ */
public class EvATreeNode extends DefaultMutableTreeNode { public class EvATreeNode extends DefaultMutableTreeNode {
private String[] childrenNames = null; private String[] childrenNames = null;
@@ -84,8 +83,7 @@ public class EvATreeNode extends DefaultMutableTreeNode {
} }
if (extendedInfo != null) { if (extendedInfo != null) {
return myName + " - " + extendedInfo; return myName + " - " + extendedInfo;
} } else {
else {
return myName; return myName;
} }
} }

View File

@@ -15,8 +15,8 @@ import javax.swing.tree.TreePath;
* to react to selection changes in the tree view (and update the parameter panel), * to react to selection changes in the tree view (and update the parameter panel),
* and the property change listener to * and the property change listener to
* react to changes in the parameters (and update the tree). * react to changes in the parameters (and update the tree).
* @author mkron
* *
* @author mkron
*/ */
public class EvATreeSelectionListener implements TreeSelectionListener, PropertyChangeListener { public class EvATreeSelectionListener implements TreeSelectionListener, PropertyChangeListener {
private PropertyEditor goe = null; private PropertyEditor goe = null;
@@ -54,7 +54,8 @@ public class EvATreeSelectionListener implements TreeSelectionListener, Property
if (TRACE) { if (TRACE) {
for (int i = tp.getPathCount() - 1; i >= 0; i--) { for (int i = tp.getPathCount() - 1; i >= 0; i--) {
System.out.println("* " + i + " " + tp.getPathComponent(i)); System.out.println("* " + i + " " + tp.getPathComponent(i));
} } }
}
EvATreeNode leafNode = (EvATreeNode) tp.getLastPathComponent(); EvATreeNode leafNode = (EvATreeNode) tp.getLastPathComponent();
// goe.setValue(leafNode.getUserObject()); // goe.setValue(leafNode.getUserObject());
Component editComp = goe.getCustomEditor(); Component editComp = goe.getCustomEditor();

View File

@@ -6,7 +6,6 @@ import eva2.tools.chart2d.DFunction;
* Represents an exponential scaling function. * Represents an exponential scaling function.
* MK: added a guard against undefined values: the smallest positive position can * MK: added a guard against undefined values: the smallest positive position can
* be stored and used instead of invalid points. * be stored and used instead of invalid points.
*
*/ */
public class Exp extends DFunction { public class Exp extends DFunction {
private double minValue = 1e-10; // think of a minimal value we want to show in case invalid (<=0) values are requested private double minValue = 1e-10; // think of a minimal value we want to show in case invalid (<=0) values are requested
@@ -14,11 +13,11 @@ public class Exp extends DFunction {
public void setMinValue(double v) { public void setMinValue(double v) {
if (v > 0) { if (v > 0) {
minValue = v; minValue = v;
} } else {
else {
System.err.println("Error, minimal value for Exp must be positive!"); System.err.println("Error, minimal value for Exp must be positive!");
} }
} }
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see eva2.tools.chart2d.DFunction#isDefinedAt(double) * @see eva2.tools.chart2d.DFunction#isDefinedAt(double)

View File

@@ -12,10 +12,12 @@ package eva2.gui;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import javax.swing.AbstractAction; import javax.swing.AbstractAction;
import javax.swing.Action; import javax.swing.Action;
import javax.swing.Icon; import javax.swing.Icon;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
/** /**
* *
*/ */
@@ -24,6 +26,7 @@ public abstract class ExtAction extends AbstractAction {
public final static String MNEMONIC = "Mnemonic"; public final static String MNEMONIC = "Mnemonic";
public final static String TOOLTIP = "ToolTip"; public final static String TOOLTIP = "ToolTip";
public final static String KEYSTROKE = "KeyStroke"; public final static String KEYSTROKE = "KeyStroke";
/** /**
* *
*/ */
@@ -33,6 +36,7 @@ public abstract class ExtAction extends AbstractAction {
putValue(Action.NAME, m.getText()); putValue(Action.NAME, m.getText());
putValue(TOOLTIP, toolTip); putValue(TOOLTIP, toolTip);
} }
/** /**
* *
*/ */
@@ -43,6 +47,7 @@ public abstract class ExtAction extends AbstractAction {
} }
putValue(KEYSTROKE, key); putValue(KEYSTROKE, key);
} }
/** /**
* *
*/ */
@@ -53,6 +58,7 @@ public abstract class ExtAction extends AbstractAction {
} }
setValues(s, toolTip); setValues(s, toolTip);
} }
/** /**
* *
*/ */
@@ -60,6 +66,7 @@ public abstract class ExtAction extends AbstractAction {
this(s, toolTip); this(s, toolTip);
putValue(KEYSTROKE, key); putValue(KEYSTROKE, key);
} }
/** /**
* *
*/ */

View File

@@ -12,14 +12,17 @@ package eva2.gui;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import javax.swing.JComponent; import javax.swing.JComponent;
/** /**
* *
*/ */
public abstract class ExtActionChangedListener implements PropertyChangeListener { public abstract class ExtActionChangedListener implements PropertyChangeListener {
protected JComponent component; protected JComponent component;
/** /**
* *
*/ */
@@ -27,11 +30,13 @@ public abstract class ExtActionChangedListener implements PropertyChangeListener
super(); super();
setTarget(c); setTarget(c);
} }
/** /**
* *
*/ */
@Override @Override
public abstract void propertyChange(PropertyChangeEvent e); public abstract void propertyChange(PropertyChangeEvent e);
/** /**
* *
*/ */

View File

@@ -9,6 +9,7 @@ package eva2.gui;
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ * $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $ * $Author: streiche $
*/ */
import java.awt.Component; import java.awt.Component;
import java.awt.Event; import java.awt.Event;
import java.util.logging.Level; import java.util.logging.Level;

View File

@@ -5,6 +5,7 @@ import eva2.optimization.tools.FileTools;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import eva2.tools.EVAHELP; import eva2.tools.EVAHELP;
import eva2.tools.SerializedObject; import eva2.tools.SerializedObject;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;

View File

@@ -9,8 +9,10 @@ package eva2.gui;
* $Date: 2007-10-23 16:58:12 +0200 (Tue, 23 Oct 2007) $ * $Date: 2007-10-23 16:58:12 +0200 (Tue, 23 Oct 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Toolkit; import java.awt.Toolkit;
@@ -25,24 +27,28 @@ import javax.swing.event.HyperlinkEvent;
import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkListener;
import javax.swing.text.html.HTMLDocument; import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLFrameHyperlinkEvent; import javax.swing.text.html.HTMLFrameHyperlinkEvent;
/** /**
* *
*/ */
public class HtmlDemo { public class HtmlDemo {
private JEditorPane m_html; private JEditorPane m_html;
private String m_name; private String m_name;
/** /**
* *
*/ */
public HtmlDemo(String name) { public HtmlDemo(String name) {
m_name = name; m_name = name;
} }
/** /**
* *
*/ */
public JEditorPane getPane() { public JEditorPane getPane() {
return m_html; return m_html;
} }
/** /**
* *
*/ */
@@ -60,6 +66,7 @@ public class HtmlDemo {
URL url = ClassLoader.getSystemResource("html/" + mname); URL url = ClassLoader.getSystemResource("html/" + mname);
return (url != null); return (url != null);
} }
/** /**
* *
*/ */

View File

@@ -12,28 +12,37 @@ import eva2.optimization.mocco.paretofrontviewer.InterfaceRefSolutionListener;
*/ */
public interface InterfaceSelectablePointIcon { public interface InterfaceSelectablePointIcon {
/** This method allows to add a selection listner to the PointIcon /**
* This method allows to add a selection listner to the PointIcon
* it should need more than one listener to this abstruse event * it should need more than one listener to this abstruse event
*
* @param a The selection listener * @param a The selection listener
*/ */
public void addSelectionListener(InterfaceRefSolutionListener a); public void addSelectionListener(InterfaceRefSolutionListener a);
/** This method allows to remove the selection listner to the PointIcon /**
* This method allows to remove the selection listner to the PointIcon
*/ */
public void removeSelectionListeners(); public void removeSelectionListeners();
/** This method returns the selection listner to the PointIcon /**
* This method returns the selection listner to the PointIcon
*
* @return InterfacePointIconSelectionListener * @return InterfacePointIconSelectionListener
*/ */
public InterfaceRefSolutionListener getSelectionListener(); public InterfaceRefSolutionListener getSelectionListener();
/** Of course the PointIcon needs a reference to the individual /**
* Of course the PointIcon needs a reference to the individual
* otherwise it can't tell the listener what has been selected. * otherwise it can't tell the listener what has been selected.
*
* @param indy * @param indy
*/ */
public void setEAIndividual(AbstractEAIndividual indy); public void setEAIndividual(AbstractEAIndividual indy);
/** This method allows you to get the EAIndividual the icon stands for /**
* This method allows you to get the EAIndividual the icon stands for
*
* @return AbstractEAIndividual * @return AbstractEAIndividual
*/ */
public AbstractEAIndividual getEAIndividual(); public AbstractEAIndividual getEAIndividual();

View File

@@ -9,10 +9,12 @@ package eva2.gui;
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ * $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $ * $Author: streiche $
*/ */
import java.io.File; import java.io.File;
import javax.swing.JInternalFrame; import javax.swing.JInternalFrame;
import javax.swing.JMenu; import javax.swing.JMenu;
import javax.swing.JToolBar; import javax.swing.JToolBar;
/** /**
* *
*/ */
@@ -20,6 +22,7 @@ public abstract class JDocFrame extends JInternalFrame{
private File m_file; private File m_file;
private String titleStr; private String titleStr;
protected boolean changed = false; protected boolean changed = false;
/** /**
* *
*/ */
@@ -27,6 +30,7 @@ public abstract class JDocFrame extends JInternalFrame{
super(title, true, true /* not closable*/, true, true); super(title, true, true /* not closable*/, true, true);
titleStr = title; titleStr = title;
} }
/** /**
* *
*/ */
@@ -34,18 +38,21 @@ public abstract class JDocFrame extends JInternalFrame{
this(file.getName()); this(file.getName());
m_file = file; m_file = file;
} }
/** /**
* *
*/ */
public File getFile() { public File getFile() {
return m_file; return m_file;
} }
/** /**
* *
*/ */
public String getFileTitle() { public String getFileTitle() {
return titleStr; return titleStr;
} }
/** /**
* *
*/ */
@@ -54,6 +61,7 @@ public abstract class JDocFrame extends JInternalFrame{
save(m_file); save(m_file);
} }
} }
/** /**
* *
*/ */
@@ -64,6 +72,7 @@ public abstract class JDocFrame extends JInternalFrame{
} }
setChangedImpl(false); setChangedImpl(false);
} }
/** /**
* *
*/ */
@@ -71,11 +80,11 @@ public abstract class JDocFrame extends JInternalFrame{
changed = value; changed = value;
if (changed) { if (changed) {
setTitle(titleStr + " *"); setTitle(titleStr + " *");
} } else {
else {
setTitle(titleStr); setTitle(titleStr);
} }
} }
/** /**
* *
*/ */
@@ -84,14 +93,18 @@ public abstract class JDocFrame extends JInternalFrame{
setChangedImpl(value); setChangedImpl(value);
} }
} }
/** /**
* *
*/ */
public boolean isChanged() { public boolean isChanged() {
return changed; return changed;
} }
public abstract String[] getActionGroups(); public abstract String[] getActionGroups();
public abstract JMenu getMenu(String group); public abstract JMenu getMenu(String group);
public abstract JToolBar getToolBar(String group); public abstract JToolBar getToolBar(String group);
} }

View File

@@ -1,4 +1,5 @@
package eva2.gui; package eva2.gui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.swing.JDesktopPane; import javax.swing.JDesktopPane;

View File

@@ -90,9 +90,9 @@ public class JExtDesktopPane extends JDesktopPane {
/** /**
* Method to access the window actions. * Method to access the window actions.
* *
* @deprecated
* @param action The desired action (use JExtDesktopPane constants). Default is null * @param action The desired action (use JExtDesktopPane constants). Default is null
* @return The ExtAction * @return The ExtAction
* @deprecated
*/ */
public ExtAction getWindowAction(int action) { public ExtAction getWindowAction(int action) {
switch (action) { switch (action) {

View File

@@ -1,6 +1,7 @@
package eva2.gui; package eva2.gui;
import eva2.tools.ToolBoxGui; import eva2.tools.ToolBoxGui;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import javax.swing.JButton; import javax.swing.JButton;
@@ -8,7 +9,6 @@ import javax.swing.JToolBar;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
/** /**
*
* @author becker * @author becker
*/ */
public class JExtDesktopPaneToolBar extends JToolBar { public class JExtDesktopPaneToolBar extends JToolBar {

View File

@@ -12,6 +12,7 @@ package eva2.gui;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import java.io.File; import java.io.File;
import javax.swing.*; import javax.swing.*;

View File

@@ -9,11 +9,13 @@ package eva2.gui;
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ * $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $ * $Author: streiche $
*/ */
import java.awt.Insets; import java.awt.Insets;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener; import java.beans.PropertyChangeListener;
import javax.swing.*; import javax.swing.*;
/** /**
* *
*/ */
@@ -62,17 +64,14 @@ public class JExtToolBar extends JToolBar{
String propertyName = e.getPropertyName(); String propertyName = e.getPropertyName();
if (propertyName.equals(Action.NAME)) { if (propertyName.equals(Action.NAME)) {
/* Nichts tun! */ /* Nichts tun! */
} } else if (propertyName.equals("enabled")) {
else if(propertyName.equals("enabled")){
button.setEnabled(((Boolean) e.getNewValue()).booleanValue()); button.setEnabled(((Boolean) e.getNewValue()).booleanValue());
button.repaint(); button.repaint();
} } else if (e.getPropertyName().equals(Action.SMALL_ICON)) {
else if(e.getPropertyName().equals(Action.SMALL_ICON)){
button.setIcon((Icon) e.getNewValue()); button.setIcon((Icon) e.getNewValue());
button.invalidate(); button.invalidate();
button.repaint(); button.repaint();
} } else if (propertyName.equals(ExtAction.TOOLTIP) || propertyName.equals(ExtAction.KEYSTROKE)) {
else if(propertyName.equals(ExtAction.TOOLTIP) || propertyName.equals(ExtAction.KEYSTROKE)){
Action source = (Action) e.getSource(); Action source = (Action) e.getSource();
Object o = source.getValue(ExtAction.TOOLTIP); Object o = source.getValue(ExtAction.TOOLTIP);

View File

@@ -68,7 +68,9 @@ public class JParaPanel implements Serializable, PanelMaker {
return propertyEditor; return propertyEditor;
} }
/** This method will allow you to add a new Editor to a given class /**
* This method will allow you to add a new Editor to a given class
*
* @param object * @param object
* @param editor * @param editor
* @return False if failed true else. * @return False if failed true else.

View File

@@ -12,6 +12,7 @@ package eva2.gui;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import java.awt.Event; import java.awt.Event;
import java.awt.event.*; import java.awt.event.*;
import java.io.*; import java.io.*;
@@ -27,6 +28,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
private JTextArea textArea; private JTextArea textArea;
private final String[] actionGroups = {GROUP_EDIT}; private final String[] actionGroups = {GROUP_EDIT};
protected UndoManager undo = new UndoManager(); protected UndoManager undo = new UndoManager();
private class UndoAction extends ExtAction { private class UndoAction extends ExtAction {
public UndoAction() { public UndoAction() {
super("R<EFBFBD>ckg<EFBFBD>ngig", new ImageIcon("images/EditUndo.gif"), "Macht die letzte Aktion r<>ckg<6B>ngig", super("R<EFBFBD>ckg<EFBFBD>ngig", new ImageIcon("images/EditUndo.gif"), "Macht die letzte Aktion r<>ckg<6B>ngig",
@@ -38,8 +40,8 @@ public class JTextEditorInternalFrame extends JDocFrame{
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
undo.undo(); undo.undo();
} catch (CannotUndoException exc) {
} }
catch(CannotUndoException exc){}
update(); update();
actRedo.update(); actRedo.update();
@@ -49,13 +51,13 @@ public class JTextEditorInternalFrame extends JDocFrame{
if (undo.canUndo()) { if (undo.canUndo()) {
setEnabled(true); setEnabled(true);
putValue(Action.NAME, undo.getUndoPresentationName()); putValue(Action.NAME, undo.getUndoPresentationName());
} } else {
else{
setEnabled(false); setEnabled(false);
putValue(Action.NAME, "R<EFBFBD>ckg<EFBFBD>ngig"); putValue(Action.NAME, "R<EFBFBD>ckg<EFBFBD>ngig");
} }
} }
} // end of inner class UndoAction } // end of inner class UndoAction
/////////////////////////////////////////// ///////////////////////////////////////////
// //
/////////////////////////////////////////// ///////////////////////////////////////////
@@ -69,8 +71,8 @@ public class JTextEditorInternalFrame extends JDocFrame{
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
undo.redo(); undo.redo();
} catch (CannotRedoException exc) {
} }
catch(CannotRedoException exc){}
update(); update();
actUndo.update(); actUndo.update();
@@ -80,8 +82,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
if (undo.canRedo()) { if (undo.canRedo()) {
setEnabled(true); setEnabled(true);
putValue(Action.NAME, undo.getRedoPresentationName()); putValue(Action.NAME, undo.getRedoPresentationName());
} } else {
else{
setEnabled(false); setEnabled(false);
putValue(Action.NAME, "Wiederholen"); putValue(Action.NAME, "Wiederholen");
} }
@@ -92,6 +93,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
private RedoAction actRedo; private RedoAction actRedo;
public final static String undoAction = "undo"; public final static String undoAction = "undo";
public final static String redoAction = "redo"; public final static String redoAction = "redo";
/////////////////////////////////////////// ///////////////////////////////////////////
// //
///////////////////////////////////////// /////////////////////////////////////////
@@ -102,15 +104,16 @@ public class JTextEditorInternalFrame extends JDocFrame{
private JMenu mnuEdit; private JMenu mnuEdit;
private JToolBar barEdit; private JToolBar barEdit;
@Override @Override
public JMenu getMenu(String group) { public JMenu getMenu(String group) {
if (GROUP_EDIT.equals(group)) { if (GROUP_EDIT.equals(group)) {
return mnuEdit; return mnuEdit;
} } else {
else {
return null; return null;
} }
} }
@Override @Override
public JToolBar getToolBar(String group) { public JToolBar getToolBar(String group) {
if (GROUP_EDIT.equals(group)) { if (GROUP_EDIT.equals(group)) {
@@ -131,11 +134,12 @@ public class JTextEditorInternalFrame extends JDocFrame{
ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray()); ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray());
ObjectInputStream in = new ObjectInputStream(bIn); ObjectInputStream in = new ObjectInputStream(bIn);
result = (Action) in.readObject(); result = (Action) in.readObject();
} catch (Exception exc) {
} }
catch(Exception exc){}
return result; return result;
} }
/////////////////////////////////////////////// ///////////////////////////////////////////////
// //
////////////////////////////////////////////// //////////////////////////////////////////////
@@ -208,6 +212,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
a.putValue(ExtAction.TOOLTIP, "Markiert das ganze Dokument"); a.putValue(ExtAction.TOOLTIP, "Markiert das ganze Dokument");
mnuEdit.add(a); mnuEdit.add(a);
} }
////////////////////////////////////////// //////////////////////////////////////////
// //
///////////////////////////////////////// /////////////////////////////////////////
@@ -215,6 +220,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
textArea = new JTextArea(); textArea = new JTextArea();
getContentPane().add(new JScrollPane(textArea)); getContentPane().add(new JScrollPane(textArea));
} }
///////////////////////////////////// /////////////////////////////////////
// //
///////////////////////////////////// /////////////////////////////////////
@@ -249,6 +255,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
} }
}); });
} }
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// //
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
@@ -258,6 +265,7 @@ public class JTextEditorInternalFrame extends JDocFrame{
createListeners(); createListeners();
createActions(); createActions();
} }
////////////////////////////////////////////////// //////////////////////////////////////////////////
// //
///////////////////////////////////////////////// /////////////////////////////////////////////////
@@ -270,14 +278,13 @@ public class JTextEditorInternalFrame extends JDocFrame{
try { try {
in = new FileReader(file); in = new FileReader(file);
textArea.read(in, null); textArea.read(in, null);
} } catch (IOException exc) {
catch(IOException exc){} } finally {
finally{
if (in != null) { if (in != null) {
try { try {
in.close(); in.close();
} catch (IOException exc) {
} }
catch(IOException exc){}
} }
} }
} }
@@ -292,14 +299,13 @@ catch(IOException exc){}
try { try {
out = new FileWriter(f); out = new FileWriter(f);
textArea.write(out); textArea.write(out);
} } catch (IOException exc) {
catch(IOException exc){} } finally {
finally{
if (out != null) { if (out != null) {
try { try {
out.close(); out.close();
} catch (IOException exc) {
} }
catch(IOException exc){}
} }
} }

View File

@@ -8,6 +8,7 @@ package eva2.gui;
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.optimization.tools.FileTools; import eva2.optimization.tools.FileTools;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Point; import java.awt.Point;
import java.awt.event.*; import java.awt.event.*;

View File

@@ -9,6 +9,7 @@ package eva2.gui;
* $Date: 2007-10-23 12:56:51 +0200 (Tue, 23 Oct 2007) $ * $Date: 2007-10-23 12:56:51 +0200 (Tue, 23 Oct 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Point; import java.awt.Point;
@@ -31,6 +32,7 @@ public class LoggingPanel extends JPanel {
protected boolean firstMessage = true; protected boolean firstMessage = true;
protected Handler loggingHandler; protected Handler loggingHandler;
protected JPopupMenu loggingLevelMenu; protected JPopupMenu loggingLevelMenu;
/** /**
* *
*/ */
@@ -53,6 +55,7 @@ public class LoggingPanel extends JPanel {
add(scrollpane, BorderLayout.CENTER); add(scrollpane, BorderLayout.CENTER);
scrollpane.getViewport().addChangeListener(new ChangeListener() { scrollpane.getViewport().addChangeListener(new ChangeListener() {
private int lastHeight; private int lastHeight;
// //
@Override @Override
public void stateChanged(ChangeEvent e) { public void stateChanged(ChangeEvent e) {
@@ -66,12 +69,14 @@ public class LoggingPanel extends JPanel {
} }
}); });
} }
/** /**
* *
*/ */
protected static String getTimestamp() { protected static String getTimestamp() {
return (new SimpleDateFormat("HH:mm:ss:")).format(new Date()); return (new SimpleDateFormat("HH:mm:ss:")).format(new Date());
} }
/** /**
* *
*/ */

View File

@@ -114,7 +114,6 @@ public class Main extends JFrame implements OptimizationStateListener {
* Constructor of GUI of EvA2. Works as client for the EvA2 server. Note * Constructor of GUI of EvA2. Works as client for the EvA2 server. Note
* that the Main initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * that the Main initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
*
*/ */
public Main(final String hostName) { public Main(final String hostName) {
this(hostName, null, false, false); this(hostName, null, false, false);
@@ -126,11 +125,11 @@ public class Main extends JFrame implements OptimizationStateListener {
* efficiency. Use {@link #awaitGuiInitialized()} to await full * efficiency. Use {@link #awaitGuiInitialized()} to await full
* initialization if necessary. * initialization if necessary.
* *
* @see #EvAClient(String, java.awt.Window, String, boolean, boolean, boolean)
* @param hostName * @param hostName
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param nosplash * @param nosplash
* @see #EvAClient(String, java.awt.Window, String, boolean, boolean, boolean)
*/ */
public Main(final String hostName, final String paramsFile, boolean autorun, boolean nosplash) { public Main(final String hostName, final String paramsFile, boolean autorun, boolean nosplash) {
this(hostName, null, paramsFile, null, autorun, nosplash, false, false); this(hostName, null, paramsFile, null, autorun, nosplash, false, false);
@@ -141,11 +140,10 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @see #Main(String, String, boolean, boolean)
*
* @param hostName * @param hostName
* @param autorun * @param autorun
* @param nosplash * @param nosplash
* @see #Main(String, String, boolean, boolean)
*/ */
public Main(final String hostName, boolean autorun, boolean nosplash) { public Main(final String hostName, boolean autorun, boolean nosplash) {
this(hostName, null, autorun, nosplash); this(hostName, null, autorun, nosplash);
@@ -156,12 +154,12 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @see #Main(String, String, boolean, boolean)
* @param hostName * @param hostName
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
* @see #Main(String, String, boolean, boolean)
*/ */
public Main(final String hostName, String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) { public Main(final String hostName, String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) {
this(hostName, null, paramsFile, null, autorun, noSplash, noGui, withTreeView); this(hostName, null, paramsFile, null, autorun, noSplash, noGui, withTreeView);
@@ -172,13 +170,12 @@ public class Main extends JFrame implements OptimizationStateListener {
* initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()} * initialized multi-threaded for efficiency. Use {@link #awaitGuiInitialized()}
* to await full initialization if necessary. * to await full initialization if necessary.
* *
* @see #Main(String, String, boolean, boolean)
*
* @param hostName * @param hostName
* @param paramsFile * @param paramsFile
* @param autorun * @param autorun
* @param noSplash * @param noSplash
* @param noGui * @param noGui
* @see #Main(String, String, boolean, boolean)
*/ */
public Main(final String hostName, InterfaceOptimizationParameters goParams, boolean autorun, boolean noSplash, boolean noGui) { public Main(final String hostName, InterfaceOptimizationParameters goParams, boolean autorun, boolean noSplash, boolean noGui) {
this(hostName, null, null, goParams, autorun, noSplash, noGui, false); this(hostName, null, null, goParams, autorun, noSplash, noGui, false);
@@ -551,7 +548,6 @@ public class Main extends JFrame implements OptimizationStateListener {
/** /**
* Refresh the parameter panels (if settings have been changed outside of * Refresh the parameter panels (if settings have been changed outside of
* the GUI which should be updated in the GUI. * the GUI which should be updated in the GUI.
*
*/ */
public void refreshMainPanels() { public void refreshMainPanels() {
frameMaker.refreshPanels(); frameMaker.refreshPanels();
@@ -931,10 +927,10 @@ public class Main extends JFrame implements OptimizationStateListener {
* Create a tree view of an object based on EvATreeNode. It is encapsulated * Create a tree view of an object based on EvATreeNode. It is encapsulated
* in a JScrollPane. * in a JScrollPane.
* *
* @see eva2.gui.EvATreeNode
* @param title * @param title
* @param object * @param object
* @return * @return
* @see eva2.gui.EvATreeNode
*/ */
public JComponent getEvATreeView(JParaPanel goPanel, String title, Object object) { public JComponent getEvATreeView(JParaPanel goPanel, String title, Object object) {
EvATreeNode root = new EvATreeNode(title, object); // the root of the tree EvATreeNode root = new EvATreeNode(title, object); // the root of the tree

View File

@@ -7,6 +7,7 @@ package eva2.gui;
* Time: 18:30:44 * Time: 18:30:44
* To change this template use Options | File Templates. * To change this template use Options | File Templates.
*/ */
/** /**
* *
*/ */

View File

@@ -15,9 +15,11 @@ public class MultiLineString {
public static void main(String[] args) { public static void main(String[] args) {
MultiLineString multiLineString1 = new MultiLineString(); MultiLineString multiLineString1 = new MultiLineString();
} }
public String getString() { public String getString() {
return string; return string;
} }
public void setString(String string) { public void setString(String string) {
this.string = string; this.string = string;
} }

View File

@@ -4,8 +4,8 @@ import javax.swing.JComponent;
/** /**
* Simple helper interface. * Simple helper interface.
* @author mkron
* *
* @author mkron
*/ */
public interface PanelMaker { public interface PanelMaker {
public JComponent makePanel(); public JComponent makePanel();

View File

@@ -8,6 +8,7 @@ package eva2.gui;
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import eva2.tools.EVAHELP; import eva2.tools.EVAHELP;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.beans.PropertyEditor; import java.beans.PropertyEditor;

View File

@@ -24,6 +24,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
/** /**
* Constructor that creates a double matrix with given dimensions and fills * Constructor that creates a double matrix with given dimensions and fills
* it cyclically with values given. * it cyclically with values given.
*
* @param rows * @param rows
* @param cols * @param cols
* @param d * @param d
@@ -31,8 +32,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
public PropertyDoubleArray(int rows, int cols, double... d) { public PropertyDoubleArray(int rows, int cols, double... d) {
if (rows > 0 && cols > 0) { if (rows > 0 && cols > 0) {
this.m_DoubleArray = new double[rows][cols]; this.m_DoubleArray = new double[rows][cols];
} } else {
else {
this.m_DoubleArray = null; this.m_DoubleArray = null;
} }
this.m_numCols = cols; this.m_numCols = cols;
@@ -53,7 +53,9 @@ public class PropertyDoubleArray implements java.io.Serializable {
return (Object) new PropertyDoubleArray(this); return (Object) new PropertyDoubleArray(this);
} }
/** This method will allow you to set the value of the double array /**
* This method will allow you to set the value of the double array
*
* @param d The double[] * @param d The double[]
*/ */
public void setDoubleArray(double[] d) { public void setDoubleArray(double[] d) {
@@ -64,15 +66,16 @@ public class PropertyDoubleArray implements java.io.Serializable {
m_numCols = 1; m_numCols = 1;
} }
/** This method will allow you to set the value of the double array /**
* This method will allow you to set the value of the double array
*
* @param d The double[] * @param d The double[]
*/ */
public void setDoubleArray(double[][] d) { public void setDoubleArray(double[][] d) {
this.m_DoubleArray = d; this.m_DoubleArray = d;
if (d.length > 0) { if (d.length > 0) {
m_numCols = d[0].length; m_numCols = d[0].length;
} } else {
else {
m_numCols = 1; m_numCols = 1;
} }
} }
@@ -86,6 +89,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
/** /**
* Return a column as a vector (in copy) * Return a column as a vector (in copy)
*
* @return a column as a vector (in copy) * @return a column as a vector (in copy)
*/ */
public double[] getDoubleColumnAsVector(int col) { public double[] getDoubleColumnAsVector(int col) {
@@ -121,8 +125,7 @@ public class PropertyDoubleArray implements java.io.Serializable {
for (int j = 0; j < m_numCols; j++) { for (int j = 0; j < m_numCols; j++) {
if (i < m_DoubleArray.length) { if (i < m_DoubleArray.length) {
newDD[i][j] = m_DoubleArray[i][j]; newDD[i][j] = m_DoubleArray[i][j];
} } else {
else {
newDD[i][j] = m_DoubleArray[m_DoubleArray.length - 1][j]; newDD[i][j] = m_DoubleArray[m_DoubleArray.length - 1][j];
} }
} }
@@ -168,11 +171,12 @@ public class PropertyDoubleArray implements java.io.Serializable {
if (k >= 0) { if (k >= 0) {
for (int j = 0; j < getNumCols(); j++) { for (int j = 0; j < getNumCols(); j++) {
newDD[newDD.length - 1][j] = newDD[k][j]; newDD[newDD.length - 1][j] = newDD[k][j];
} } }
else { } else {
for (int j = 0; j < getNumCols(); j++) { for (int j = 0; j < getNumCols(); j++) {
newDD[newDD.length - 1][j] = 1.; newDD[newDD.length - 1][j] = 1.;
} } // if the array was empty }
} // if the array was empty
setDoubleArray(newDD); setDoubleArray(newDD);
} }
@@ -189,12 +193,14 @@ public class PropertyDoubleArray implements java.io.Serializable {
if (colSum != 0) { if (colSum != 0) {
for (int i = 0; i < getNumRows(); i++) { for (int i = 0; i < getNumRows(); i++) {
m_DoubleArray[i][j] /= colSum; m_DoubleArray[i][j] /= colSum;
} } }
}
} }
} }
/** /**
* Check if k is a valid row index (within 0 and numRows-1). * Check if k is a valid row index (within 0 and numRows-1).
*
* @param k * @param k
* @return * @return
*/ */

View File

@@ -50,8 +50,7 @@ public class PropertyFilePath implements java.io.Serializable {
String fName = ReflectPackage.getResourcePathFromCP(relPath); String fName = ReflectPackage.getResourcePathFromCP(relPath);
if (fName == null) { if (fName == null) {
return null; return null;
} } else {
else {
return new PropertyFilePath(fName); return new PropertyFilePath(fName);
} }
} }
@@ -61,8 +60,10 @@ public class PropertyFilePath implements java.io.Serializable {
return (Object) new PropertyFilePath(this); return (Object) new PropertyFilePath(this);
} }
/** This method will allow you to set a complete string /**
* This method will allow you to set a complete string
* which will be separated into Path, Name and extension * which will be separated into Path, Name and extension
*
* @param s The complete filepath and filename * @param s The complete filepath and filename
*/ */
public void setCompleteFilePath(String s) { public void setCompleteFilePath(String s) {
@@ -96,8 +97,10 @@ public class PropertyFilePath implements java.io.Serializable {
} }
} }
/** This method will return the complete name of the file /**
* This method will return the complete name of the file
* which filepath * which filepath
*
* @return The complete filename with path. * @return The complete filename with path.
*/ */
public String getCompleteFilePath() { public String getCompleteFilePath() {

View File

@@ -24,14 +24,18 @@ public class PropertyIntArray implements java.io.Serializable {
return (Object) new PropertyIntArray(this); return (Object) new PropertyIntArray(this);
} }
/** This method will allow you to set the value of the double array /**
* This method will allow you to set the value of the double array
*
* @param d The int[] * @param d The int[]
*/ */
public void setIntArray(int[] d) { public void setIntArray(int[] d) {
this.m_IntArray = d; this.m_IntArray = d;
} }
/** This method will return the int array /**
* This method will return the int array
*
* @return The int array * @return The int array
*/ */
public int[] getIntArray() { public int[] getIntArray() {

View File

@@ -17,6 +17,7 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
this.m_AvailableObjectives = d; this.m_AvailableObjectives = d;
this.m_SelectedObjectives = null; this.m_SelectedObjectives = null;
} }
public PropertyOptimizationObjectives(PropertyOptimizationObjectives d) { public PropertyOptimizationObjectives(PropertyOptimizationObjectives d) {
this.m_AvailableObjectives = new InterfaceOptimizationObjective[d.m_AvailableObjectives.length]; this.m_AvailableObjectives = new InterfaceOptimizationObjective[d.m_AvailableObjectives.length];
for (int i = 0; i < this.m_AvailableObjectives.length; i++) { for (int i = 0; i < this.m_AvailableObjectives.length; i++) {
@@ -33,28 +34,36 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
return (Object) new PropertyOptimizationObjectives(this); return (Object) new PropertyOptimizationObjectives(this);
} }
/** This method will allow you to set the value of the InterfaceOptimizationTarget array /**
* This method will allow you to set the value of the InterfaceOptimizationTarget array
*
* @param d The InterfaceOptimizationTarget[] * @param d The InterfaceOptimizationTarget[]
*/ */
public void setSelectedTargets(InterfaceOptimizationObjective[] d) { public void setSelectedTargets(InterfaceOptimizationObjective[] d) {
this.m_SelectedObjectives = d; this.m_SelectedObjectives = d;
} }
/** This method will return the InterfaceOptimizationTarget array /**
* This method will return the InterfaceOptimizationTarget array
*
* @return The InterfaceOptimizationTarget[]. * @return The InterfaceOptimizationTarget[].
*/ */
public InterfaceOptimizationObjective[] getSelectedTargets() { public InterfaceOptimizationObjective[] getSelectedTargets() {
return this.m_SelectedObjectives; return this.m_SelectedObjectives;
} }
/** This method will return the InterfaceOptimizationTarget array /**
* This method will return the InterfaceOptimizationTarget array
*
* @return The InterfaceOptimizationTarget[]. * @return The InterfaceOptimizationTarget[].
*/ */
public InterfaceOptimizationObjective[] getAvailableTargets() { public InterfaceOptimizationObjective[] getAvailableTargets() {
return this.m_AvailableObjectives; return this.m_AvailableObjectives;
} }
/** This method allows you to remove a Target from the list /**
* This method allows you to remove a Target from the list
*
* @param index The index of the target to be removed. * @param index The index of the target to be removed.
*/ */
public void removeTarget(int index) { public void removeTarget(int index) {
@@ -73,7 +82,9 @@ public class PropertyOptimizationObjectives implements java.io.Serializable {
this.m_SelectedObjectives = newList; this.m_SelectedObjectives = newList;
} }
/** This method allows you to add a new target to the list /**
* This method allows you to add a new target to the list
*
* @param optTarget * @param optTarget
*/ */
public void addTarget(InterfaceOptimizationObjective optTarget) { public void addTarget(InterfaceOptimizationObjective optTarget) {

View File

@@ -22,6 +22,7 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
this.m_AvailableObjectives = d; this.m_AvailableObjectives = d;
this.m_SelectedObjectives = null; this.m_SelectedObjectives = null;
} }
public PropertyOptimizationObjectivesWithParam(PropertyOptimizationObjectivesWithParam d) { public PropertyOptimizationObjectivesWithParam(PropertyOptimizationObjectivesWithParam d) {
this.m_DescriptiveString = d.m_DescriptiveString; this.m_DescriptiveString = d.m_DescriptiveString;
this.m_WeightsLabel = d.m_WeightsLabel; this.m_WeightsLabel = d.m_WeightsLabel;
@@ -45,7 +46,9 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
return (Object) new PropertyOptimizationObjectivesWithParam(this); return (Object) new PropertyOptimizationObjectivesWithParam(this);
} }
/** This method will allow you to set the value of the InterfaceOptimizationTarget array /**
* This method will allow you to set the value of the InterfaceOptimizationTarget array
*
* @param d The InterfaceOptimizationTarget[] * @param d The InterfaceOptimizationTarget[]
*/ */
public void setSelectedTargets(InterfaceOptimizationObjective[] d) { public void setSelectedTargets(InterfaceOptimizationObjective[] d) {
@@ -78,61 +81,79 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
} }
} }
/** This method will return the InterfaceOptimizationTarget array /**
* This method will return the InterfaceOptimizationTarget array
*
* @return The InterfaceOptimizationTarget[]. * @return The InterfaceOptimizationTarget[].
*/ */
public InterfaceOptimizationObjective[] getSelectedTargets() { public InterfaceOptimizationObjective[] getSelectedTargets() {
return this.m_SelectedObjectives; return this.m_SelectedObjectives;
} }
/** This method will return the InterfaceOptimizationTarget array /**
* This method will return the InterfaceOptimizationTarget array
*
* @return The InterfaceOptimizationTarget[]. * @return The InterfaceOptimizationTarget[].
*/ */
public InterfaceOptimizationObjective[] getAvailableTargets() { public InterfaceOptimizationObjective[] getAvailableTargets() {
return this.m_AvailableObjectives; return this.m_AvailableObjectives;
} }
/** This method allows you to read the weights /**
* This method allows you to read the weights
*
* @return the weights * @return the weights
*/ */
public double[] getWeights() { public double[] getWeights() {
return this.m_Weights; return this.m_Weights;
} }
public void setWeights(double[] d) { public void setWeights(double[] d) {
this.m_Weights = d; this.m_Weights = d;
} }
/** This method allows you to set/get the descriptive string /**
* This method allows you to set/get the descriptive string
*
* @return the string * @return the string
*/ */
public String getDescriptiveString() { public String getDescriptiveString() {
return this.m_DescriptiveString; return this.m_DescriptiveString;
} }
public void setDescriptiveString(String d) { public void setDescriptiveString(String d) {
this.m_DescriptiveString = d; this.m_DescriptiveString = d;
} }
/** This method allows you to set/get the weights label /**
* This method allows you to set/get the weights label
*
* @return the string * @return the string
*/ */
public String getWeigthsLabel() { public String getWeigthsLabel() {
return this.m_WeightsLabel; return this.m_WeightsLabel;
} }
public void setWeightsLabel(String d) { public void setWeightsLabel(String d) {
this.m_WeightsLabel = d; this.m_WeightsLabel = d;
} }
/** This method allows you to set/get the weights label /**
* This method allows you to set/get the weights label
*
* @return the string * @return the string
*/ */
public boolean isNormalizationEnabled() { public boolean isNormalizationEnabled() {
return this.m_NormalizationEnabled; return this.m_NormalizationEnabled;
} }
public void enableNormalization(boolean d) { public void enableNormalization(boolean d) {
this.m_NormalizationEnabled = d; this.m_NormalizationEnabled = d;
} }
/** This method allows you to remove a Target from the list /**
* This method allows you to remove a Target from the list
*
* @param index The index of the target to be removed. * @param index The index of the target to be removed.
*/ */
public void removeTarget(int index) { public void removeTarget(int index) {
@@ -154,7 +175,9 @@ public class PropertyOptimizationObjectivesWithParam implements java.io.Serializ
this.m_Weights = newWeights; this.m_Weights = newWeights;
} }
/** This method allows you to add a new target to the list /**
* This method allows you to add a new target to the list
*
* @param optTarget * @param optTarget
*/ */
public void addTarget(InterfaceOptimizationObjective optTarget) { public void addTarget(InterfaceOptimizationObjective optTarget) {

View File

@@ -9,7 +9,9 @@ package eva2.gui;
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ * $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $
* $Author: streiche $ * $Author: streiche $
*/ */
import eva2.tools.EVAHELP; import eva2.tools.EVAHELP;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@@ -18,6 +20,7 @@ import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
/** /**
* *
*/ */
@@ -26,6 +29,7 @@ public class PropertyPanel extends JPanel {
private PropertyDialog propertyDialog; private PropertyDialog propertyDialog;
private JLabel textLabel; private JLabel textLabel;
/** /**
* *
*/ */
@@ -54,8 +58,7 @@ public class PropertyPanel extends JPanel {
propertyDialog.setPreferredSize(new Dimension(500, 300)); propertyDialog.setPreferredSize(new Dimension(500, 300));
propertyDialog.setModal(true); propertyDialog.setModal(true);
propertyDialog.setVisible(true); propertyDialog.setVisible(true);
} } else {
else {
propertyDialog.updateFrameTitle(propertyEditor); propertyDialog.updateFrameTitle(propertyEditor);
propertyDialog.setVisible(false); propertyDialog.setVisible(false);
propertyDialog.requestFocus(); propertyDialog.requestFocus();

View File

@@ -60,6 +60,7 @@ public class PropertySelectableList<T> implements java.io.Serializable {
/** /**
* Returns the elements represented by this list where only the selected elements are non-null. * Returns the elements represented by this list where only the selected elements are non-null.
*
* @return * @return
*/ */
public T[] getSelectedObjects() { public T[] getSelectedObjects() {
@@ -104,8 +105,7 @@ public class PropertySelectableList<T> implements java.io.Serializable {
public int size() { public int size() {
if (m_Objects == null) { if (m_Objects == null) {
return 0; return 0;
} } else {
else {
return m_Objects.length; return m_Objects.length;
} }
} }

View File

@@ -9,8 +9,10 @@ package eva2.gui;
* $Date: 2007-12-05 11:29:32 +0100 (Wed, 05 Dec 2007) $ * $Date: 2007-12-05 11:29:32 +0100 (Wed, 05 Dec 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.gui.editor.GenericObjectEditor; import eva2.gui.editor.GenericObjectEditor;
import eva2.tools.EVAHELP; import eva2.tools.EVAHELP;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@@ -25,6 +27,7 @@ import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer; import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
/** /**
* There are some trick methods interpreted here. Check EvA2Notes.txt. * There are some trick methods interpreted here. Check EvA2Notes.txt.
*/ */
@@ -1145,5 +1148,4 @@ class PropertyCellEditor extends AbstractCellEditor implements TableCellEditor {
} }
} }

View File

@@ -12,6 +12,7 @@ package eva2.gui;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.GridBagConstraints; import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
@@ -24,6 +25,7 @@ import javax.swing.JCheckBox;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
/** /**
* *
*/ */
@@ -42,6 +44,7 @@ public class PropertySheetPanelStat extends JPanel implements Serializable {
// setBorder(BorderFactory.createLineBorder(Color.red)); // setBorder(BorderFactory.createLineBorder(Color.red));
setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
} }
/** /**
* A support object for handling property change listeners * A support object for handling property change listeners
*/ */

View File

@@ -4,6 +4,7 @@ package eva2.gui;
* Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 10 $ * Architecture @author Holger Ulmer, Felix Streichert, Hannes Planatscher @version: $Revision: 10 $
* $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ $Author: streiche $ * $Date: 2006-01-18 11:02:22 +0100 (Wed, 18 Jan 2006) $ $Author: streiche $
*/ */
import java.awt.event.FocusAdapter; import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent; import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter; import java.awt.event.KeyAdapter;

View File

@@ -11,7 +11,6 @@ import javax.swing.JTextField;
/** /**
* A text property editor view. Updates the editor on key release and lost focus * A text property editor view. Updates the editor on key release and lost focus
* events. * events.
*
*/ */
public class PropertyText extends JTextField { public class PropertyText extends JTextField {

View File

@@ -11,6 +11,7 @@ package eva2.gui;
* @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007)$ * @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007)$
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.*; import java.awt.*;
@@ -28,7 +29,7 @@ class SplashScreen extends Frame {
/** /**
* Show the splash screen to the end user. * Show the splash screen to the end user.
* * <p/>
* <P>Once this method returns, the splash screen is realized, which means * <P>Once this method returns, the splash screen is realized, which means
* that almost all work on the splash screen should proceed through the * that almost all work on the splash screen should proceed through the
* event dispatch thread. In particular, any call to * event dispatch thread. In particular, any call to

View File

@@ -28,12 +28,18 @@ import javax.swing.SwingConstants;
*/ */
public abstract class AbstractListSelectionEditor extends JPanel implements PropertyEditor, PropertyChangeListener { public abstract class AbstractListSelectionEditor extends JPanel implements PropertyEditor, PropertyChangeListener {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
protected JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); protected JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The graphics stuff */ /**
* The graphics stuff
*/
private JPanel m_CustomEditor, m_NodePanel; private JPanel m_CustomEditor, m_NodePanel;
protected JCheckBox[] m_BlackCheck; protected JCheckBox[] m_BlackCheck;
@@ -41,7 +47,8 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
public AbstractListSelectionEditor() { public AbstractListSelectionEditor() {
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -54,6 +61,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** /**
* Return the number of elements in the list. * Return the number of elements in the list.
*
* @return * @return
*/ */
protected abstract int getElementCount(); protected abstract int getElementCount();
@@ -122,7 +130,9 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
*/ */
protected abstract boolean setObject(Object o); protected abstract boolean setObject(Object o);
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -134,6 +144,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** /**
* Returns the current object. * Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -175,13 +186,16 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
public boolean isPaintable() { public boolean isPaintable() {
return true; return true;
} }
/** /**
* Paints a representation of the current classifier. * Paints a representation of the current classifier.
* *
@@ -198,6 +212,7 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
/** /**
* Returns true because we do support a custom editor. * Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -205,7 +220,9 @@ public abstract class AbstractListSelectionEditor extends JPanel implements Prop
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -12,6 +12,7 @@ package eva2.gui.editor;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import eva2.gui.PropertyDialog; import eva2.gui.PropertyDialog;
import java.awt.*; import java.awt.*;
@@ -31,6 +32,7 @@ public class BigStringEditor implements PropertyEditor {
// private Source m_Source; // private Source m_Source;
private JButton m_SetButton; private JButton m_SetButton;
static private boolean m_finished = false; static private boolean m_finished = false;
/** /**
* *
*/ */
@@ -81,8 +83,9 @@ public class BigStringEditor implements PropertyEditor {
} }
); );
while (m_finished == false) { while (m_finished == false) {
try {Thread.sleep(1000);} try {
catch (Exception e) { Thread.sleep(1000);
} catch (Exception e) {
System.out.println("e+" + e.getMessage()); System.out.println("e+" + e.getMessage());
} }
} }
@@ -93,6 +96,7 @@ public class BigStringEditor implements PropertyEditor {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
} }
} }
/** /**
* *
*/ */
@@ -117,6 +121,7 @@ public class BigStringEditor implements PropertyEditor {
m_Panel.add(m_ScrollPane, BorderLayout.CENTER); m_Panel.add(m_ScrollPane, BorderLayout.CENTER);
m_Panel.add(m_SetButton, BorderLayout.SOUTH); m_Panel.add(m_SetButton, BorderLayout.SOUTH);
} }
/** /**
* *
*/ */
@@ -134,6 +139,7 @@ public class BigStringEditor implements PropertyEditor {
}*/ }*/
m_Support.firePropertyChange("", null, null); m_Support.firePropertyChange("", null, null);
} }
/** /**
* *
*/ */
@@ -142,6 +148,7 @@ public class BigStringEditor implements PropertyEditor {
// m_Source.setString(m_TextArea.getText()); // m_Source.setString(m_TextArea.getText());
return null; return null;
} }
/** /**
* *
*/ */
@@ -206,6 +213,7 @@ public class BigStringEditor implements PropertyEditor {
public boolean supportsCustomEditor() { public boolean supportsCustomEditor() {
return true; return true;
} }
/** /**
* *
*/ */

View File

@@ -1,4 +1,5 @@
package eva2.gui.editor; package eva2.gui.editor;
/* /*
* Title: EvA2 * Title: EvA2
* Description: * Description:

View File

@@ -16,7 +16,9 @@ import javax.swing.JFrame;
* To change this template use Options | File Templates. * To change this template use Options | File Templates.
*/ */
public class EnumEditor extends PropertyEditorSupport { public class EnumEditor extends PropertyEditorSupport {
/** The Enum values that may be chosen */ /**
* The Enum values that may be chosen
*/
private Enum[] enumConstants; private Enum[] enumConstants;
@Override @Override

View File

@@ -11,7 +11,9 @@ import eva2.optimization.individuals.codings.gp.GPArea;
* To change this template use Options | File Templates. * To change this template use Options | File Templates.
*/ */
public class GenericAreaEditor extends AbstractListSelectionEditor { public class GenericAreaEditor extends AbstractListSelectionEditor {
/** The GPArea that is to be edited*/ /**
* The GPArea that is to be edited
*/
private GPArea m_AreaObject; private GPArea m_AreaObject;
public GenericAreaEditor() { public GenericAreaEditor() {

View File

@@ -3,6 +3,7 @@ package eva2.gui.editor;
import eva2.gui.*; import eva2.gui.*;
import eva2.tools.EVAHELP; import eva2.tools.EVAHELP;
import eva2.tools.SerializedObject; import eva2.tools.SerializedObject;
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeEvent;

View File

@@ -28,7 +28,6 @@ import javax.swing.SwingConstants;
* A simple focus listener with an object ID and callback. * A simple focus listener with an object ID and callback.
* *
* @author mkron * @author mkron
*
*/ */
class MyFocusListener implements FocusListener { class MyFocusListener implements FocusListener {
private int myID = -1; private int myID = -1;
@@ -44,14 +43,19 @@ class MyFocusListener implements FocusListener {
* @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent) * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
*/ */
@Override @Override
public void focusLost(FocusEvent e) { } public void focusLost(FocusEvent e) {
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent) * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
*/ */
@Override @Override
public void focusGained(FocusEvent e) { arrEditor.notifyFocusID(myID);}; public void focusGained(FocusEvent e) {
arrEditor.notifyFocusID(myID);
}
;
}; };
@@ -61,25 +65,37 @@ class MyFocusListener implements FocusListener {
public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor { public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
private static final long serialVersionUID = 7749892624600018812L; private static final long serialVersionUID = 7749892624600018812L;
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyDoubleArray m_DoubleArray; private PropertyDoubleArray m_DoubleArray;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel; private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel;
private JTextField[][] m_InputTextFields; private JTextField[][] m_InputTextFields;
private JButton m_OKButton, m_AddButton, m_DeleteButton, m_NormalizeButton; private JButton m_OKButton, m_AddButton, m_DeleteButton, m_NormalizeButton;
/** Which columns has the focus? **/ /**
* Which columns has the focus? *
*/
private int lastFocussedRow = -1; private int lastFocussedRow = -1;
public GenericDoubleArrayEditor() { public GenericDoubleArrayEditor() {
// compiled code // compiled code
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -120,7 +136,8 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
this.updateEditor(); this.updateEditor();
} }
/** This action listener adds an element to DoubleArray /**
* This action listener adds an element to DoubleArray
*/ */
ActionListener addAction = new ActionListener() { ActionListener addAction = new ActionListener() {
@Override @Override
@@ -130,7 +147,8 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
} }
}; };
/** This action listener removes an element from the DoubleArray. /**
* This action listener removes an element from the DoubleArray.
*/ */
ActionListener deleteAction = new ActionListener() { ActionListener deleteAction = new ActionListener() {
@Override @Override
@@ -155,12 +173,14 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
} }
}; };
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -187,7 +207,8 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_CustomEditor != null) { if (this.m_CustomEditor != null) {
@@ -215,7 +236,8 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
// } // }
// } // }
/** This method updates the data panel /**
* This method updates the data panel
*/ */
private void updateDataPanel() { private void updateDataPanel() {
int numRows = m_DoubleArray.getNumRows(); int numRows = m_DoubleArray.getNumRows();
@@ -242,7 +264,9 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
// System.out.println("Focus now on " + id); // System.out.println("Focus now on " + id);
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -253,7 +277,9 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -306,21 +332,27 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
m_OKButton.addActionListener(a); m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
m_OKButton.removeActionListener(a); m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -328,7 +360,8 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -341,7 +374,9 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -349,7 +384,9 @@ public class GenericDoubleArrayEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -18,14 +18,22 @@ import javax.swing.*;
*/ */
public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEditor { public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEditor {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyEpsilonConstraint m_EpsilonConstraint; private PropertyEpsilonConstraint m_EpsilonConstraint;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel; private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
private JTextField[] m_TargetTextField; private JTextField[] m_TargetTextField;
private JComboBox m_Objective; private JComboBox m_Objective;
@@ -35,7 +43,8 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
// compiled code // compiled code
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -77,7 +86,8 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
this.updateEditor(); this.updateEditor();
} }
/** This action listener adds an element to DoubleArray /**
* This action listener adds an element to DoubleArray
*/ */
ItemListener objectiveAction = new ItemListener() { ItemListener objectiveAction = new ItemListener() {
@Override @Override
@@ -87,12 +97,14 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
} }
}; };
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -116,7 +128,8 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_CustomEditor != null) { if (this.m_CustomEditor != null) {
@@ -126,7 +139,8 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
} }
} }
/** This method updates the data panel /**
* This method updates the data panel
*/ */
private void updateDataPanel() { private void updateDataPanel() {
double[] tmpT = this.m_EpsilonConstraint.m_TargetValue; double[] tmpT = this.m_EpsilonConstraint.m_TargetValue;
@@ -149,7 +163,9 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -160,7 +176,9 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -213,21 +231,27 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
m_OKButton.addActionListener(a); m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
m_OKButton.removeActionListener(a); m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -235,7 +259,8 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -248,7 +273,9 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -256,7 +283,9 @@ public class GenericEpsilonConstraintEditor extends JPanel implements PropertyEd
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -18,14 +18,22 @@ import javax.swing.*;
*/ */
public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEditor { public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEditor {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyEpsilonThreshold m_EpsilonThreshhold; private PropertyEpsilonThreshold m_EpsilonThreshhold;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel; private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
private JTextField[] m_TargetTextField, m_PunishTextField; private JTextField[] m_TargetTextField, m_PunishTextField;
private JComboBox m_Objective; private JComboBox m_Objective;
@@ -35,7 +43,8 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
// compiled code // compiled code
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -77,7 +86,8 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
this.updateEditor(); this.updateEditor();
} }
/** This action listener adds an element to DoubleArray /**
* This action listener adds an element to DoubleArray
*/ */
ItemListener objectiveAction = new ItemListener() { ItemListener objectiveAction = new ItemListener() {
@Override @Override
@@ -87,12 +97,14 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
} }
}; };
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -125,7 +137,8 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_CustomEditor != null) { if (this.m_CustomEditor != null) {
@@ -135,7 +148,8 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
} }
} }
/** This method updates the data panel /**
* This method updates the data panel
*/ */
private void updateDataPanel() { private void updateDataPanel() {
double[] tmpT = this.m_EpsilonThreshhold.m_TargetValue; double[] tmpT = this.m_EpsilonThreshhold.m_TargetValue;
@@ -166,7 +180,9 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -177,7 +193,9 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -230,21 +248,27 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
m_OKButton.addActionListener(a); m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
m_OKButton.removeActionListener(a); m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -252,7 +276,8 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -265,7 +290,9 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -273,7 +300,9 @@ public class GenericEpsilonThresholdEditor extends JPanel implements PropertyEdi
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -23,14 +23,22 @@ import javax.swing.SwingConstants;
*/ */
public class GenericFilePathEditor extends JPanel implements PropertyEditor { public class GenericFilePathEditor extends JPanel implements PropertyEditor {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyFilePath m_FilePath; private PropertyFilePath m_FilePath;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JFileChooser m_FileChooser; private JFileChooser m_FileChooser;
private JPanel m_Panel; private JPanel m_Panel;
@@ -38,7 +46,9 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
// compiled code // compiled code
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -48,7 +58,9 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -101,7 +113,9 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -109,7 +123,8 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -122,7 +137,9 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -130,7 +147,9 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override
@@ -145,7 +164,8 @@ public class GenericFilePathEditor extends JPanel implements PropertyEditor {
return this.m_Panel; return this.m_Panel;
} }
/** This action listener, called by the "train" button, causes /**
* This action listener, called by the "train" button, causes
* the SOM to recalculate the mapping. * the SOM to recalculate the mapping.
*/ */
ActionListener fileChooserAction = new ActionListener() { ActionListener fileChooserAction = new ActionListener() {

View File

@@ -21,14 +21,22 @@ import javax.swing.*;
*/ */
public class GenericIntArrayEditor extends JPanel implements PropertyEditor { public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyIntArray m_IntArray; private PropertyIntArray m_IntArray;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel; private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel;
private JTextField[] m_InputTextField; private JTextField[] m_InputTextField;
private JButton m_OKButton; private JButton m_OKButton;
@@ -37,7 +45,8 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
// compiled code // compiled code
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -69,12 +78,14 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
this.updateEditor(); this.updateEditor();
} }
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readIntArrayAction = new KeyListener() { KeyListener readIntArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -96,7 +107,8 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_CustomEditor != null) { if (this.m_CustomEditor != null) {
@@ -106,7 +118,8 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
} }
} }
/** This method updates the data panel /**
* This method updates the data panel
*/ */
private void updateDataPanel() { private void updateDataPanel() {
int[] tmpD = this.m_IntArray.getIntArray(); int[] tmpD = this.m_IntArray.getIntArray();
@@ -125,7 +138,9 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -136,7 +151,9 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -189,21 +206,27 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
m_OKButton.addActionListener(a); m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
m_OKButton.removeActionListener(a); m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -211,7 +234,8 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -224,7 +248,9 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -232,7 +258,9 @@ public class GenericIntArrayEditor extends JPanel implements PropertyEditor {
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -8,6 +8,7 @@ package eva2.gui.editor;
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.gui.GOEPanel; import eva2.gui.GOEPanel;
import eva2.tools.ReflectPackage; import eva2.tools.ReflectPackage;
import java.awt.Component; import java.awt.Component;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
@@ -76,9 +77,9 @@ public class GenericObjectEditor implements PropertyEditor {
* "hideFromGOE" this method will skip it. Abstract classes and interfaces will be skipped as * "hideFromGOE" this method will skip it. Abstract classes and interfaces will be skipped as
* well. * well.
* *
* @see ReflectPackage.getAssignableClassesInPackage
* @param className * @param className
* @return * @return
* @see ReflectPackage.getAssignableClassesInPackage
*/ */
public static ArrayList<String> getClassesFromClassPath(String className, ArrayList<Class<?>> instances) { public static ArrayList<String> getClassesFromClassPath(String className, ArrayList<Class<?>> instances) {
ArrayList<String> classes = new ArrayList<String>(); ArrayList<String> classes = new ArrayList<String>();
@@ -439,7 +440,7 @@ public class GenericObjectEditor implements PropertyEditor {
* Returns null as we don't support getting/setting values as text. * Returns null as we don't support getting/setting values as text.
* *
* @param text the text value * @param text the text value
* @exception IllegalArgumentException as we don't support getting/setting values as text. * @throws IllegalArgumentException as we don't support getting/setting values as text.
*/ */
@Override @Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {

View File

@@ -4,12 +4,12 @@ import eva2.gui.PropertySelectableList;
/** /**
* An editor for a selectable List. * An editor for a selectable List.
*
*/ */
public class GenericObjectListSelectionEditor extends AbstractListSelectionEditor { public class GenericObjectListSelectionEditor extends AbstractListSelectionEditor {
private PropertySelectableList objList; private PropertySelectableList objList;
public GenericObjectListSelectionEditor() {} public GenericObjectListSelectionEditor() {
}
@Override @Override
protected int getElementCount() { protected int getElementCount() {
@@ -49,7 +49,9 @@ public class GenericObjectListSelectionEditor extends AbstractListSelectionEdito
} }
} }
/** Retruns the current object. /**
* Retruns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override

View File

@@ -8,6 +8,7 @@ import eva2.optimization.problems.InterfaceOptimizationTarget;
import eva2.optimization.tools.AbstractObjectEditor; import eva2.optimization.tools.AbstractObjectEditor;
import eva2.optimization.tools.GeneralGOEProperty; import eva2.optimization.tools.GeneralGOEProperty;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@@ -44,14 +45,22 @@ import javax.swing.SwingConstants;
*/ */
public class GenericOptimizationObjectivesEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener { public class GenericOptimizationObjectivesEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyOptimizationObjectives m_OptimizationObjectives; private PropertyOptimizationObjectives m_OptimizationObjectives;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JComponent m_Editor; private JComponent m_Editor;
private JPanel m_TargetList; private JPanel m_TargetList;
private JComponent[] m_Targets; private JComponent[] m_Targets;
@@ -65,7 +74,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
m_self = this; m_self = this;
@@ -137,8 +147,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
this.updateEditor(); this.updateEditor();
} }
/** This method updates the server list /**
* * This method updates the server list
*/ */
private void updateTargetList() { private void updateTargetList() {
BasicResourceLoader loader = BasicResourceLoader.instance(); BasicResourceLoader loader = BasicResourceLoader.instance();
@@ -197,7 +207,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
} }
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener updateTargets = new ActionListener() { ActionListener updateTargets = new ActionListener() {
@Override @Override
@@ -206,7 +217,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
}; };
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener addTarget = new ActionListener() { ActionListener addTarget = new ActionListener() {
@Override @Override
@@ -244,7 +256,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
}; };
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener deleteTarget = new ActionListener() { ActionListener deleteTarget = new ActionListener() {
@Override @Override
@@ -254,8 +267,7 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
for (int i = 0; i < m_Delete.length; i++) { for (int i = 0; i < m_Delete.length; i++) {
if (event.getSource().equals(m_Delete[i])) { if (event.getSource().equals(m_Delete[i])) {
m_OptimizationObjectives.removeTarget(i); m_OptimizationObjectives.removeTarget(i);
} } else {
else {
newEdit[j] = m_Editors[i]; newEdit[j] = m_Editors[i];
j++; j++;
} }
@@ -265,7 +277,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_Editor != null) { if (this.m_Editor != null) {
@@ -279,7 +292,9 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -290,7 +305,9 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -327,21 +344,27 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
return null; return null;
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
//m_OKButton.addActionListener(a); //m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
//m_OKButton.removeActionListener(a); //m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -349,7 +372,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -362,7 +386,9 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -370,7 +396,9 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override
@@ -381,7 +409,8 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
return m_Editor; return m_Editor;
} }
/** This method will udate the status of the object taking the values from all /**
* This method will udate the status of the object taking the values from all
* supsequent editors and setting them to my object. * supsequent editors and setting them to my object.
*/ */
public void updateCenterComponent(PropertyChangeEvent evt) { public void updateCenterComponent(PropertyChangeEvent evt) {
@@ -389,7 +418,9 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
this.updateEditor(); this.updateEditor();
} }
/********************************* java.beans.PropertyChangeListener *************************/ /**
* ****************************** java.beans.PropertyChangeListener ************************
*/
@Override @Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
@@ -406,8 +437,11 @@ public class GenericOptimizationObjectivesEditor extends JPanel implements Prope
} }
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This will wait for the GenericObjectEditor to finish
/**
* This will wait for the GenericObjectEditor to finish
* editing an object. * editing an object.
*
* @param evt * @param evt
*/ */
@Override @Override

View File

@@ -7,6 +7,7 @@ import eva2.optimization.problems.InterfaceOptimizationObjective;
import eva2.optimization.tools.AbstractObjectEditor; import eva2.optimization.tools.AbstractObjectEditor;
import eva2.optimization.tools.GeneralGOEProperty; import eva2.optimization.tools.GeneralGOEProperty;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension; import java.awt.Dimension;
@@ -47,14 +48,22 @@ import javax.swing.SwingConstants;
*/ */
public class GenericOptimizationObjectivesWithParamEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener { public class GenericOptimizationObjectivesWithParamEditor extends JPanel implements PropertyEditor, java.beans.PropertyChangeListener {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyOptimizationObjectivesWithParam m_OptimizationObjectivesWithWeights; private PropertyOptimizationObjectivesWithParam m_OptimizationObjectivesWithWeights;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JComponent m_Editor; private JComponent m_Editor;
private JPanel m_TargetList; private JPanel m_TargetList;
private JTextField[] m_Weights; private JTextField[] m_Weights;
@@ -68,7 +77,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
m_self = this; m_self = this;
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
m_self = this; m_self = this;
@@ -149,8 +159,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
this.updateEditor(); this.updateEditor();
} }
/** This method updates the server list /**
* * This method updates the server list
*/ */
private void updateTargetList() { private void updateTargetList() {
BasicResourceLoader loader = BasicResourceLoader.instance(); BasicResourceLoader loader = BasicResourceLoader.instance();
@@ -222,7 +232,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
} }
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener updateTargets = new ActionListener() { ActionListener updateTargets = new ActionListener() {
@Override @Override
@@ -231,7 +242,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
}; };
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener addTarget = new ActionListener() { ActionListener addTarget = new ActionListener() {
@Override @Override
@@ -269,7 +281,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
}; };
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener deleteTarget = new ActionListener() { ActionListener deleteTarget = new ActionListener() {
@Override @Override
@@ -279,8 +292,7 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
for (int i = 0; i < m_Delete.length; i++) { for (int i = 0; i < m_Delete.length; i++) {
if (event.getSource().equals(m_Delete[i])) { if (event.getSource().equals(m_Delete[i])) {
m_OptimizationObjectivesWithWeights.removeTarget(i); m_OptimizationObjectivesWithWeights.removeTarget(i);
} } else {
else {
newEdit[j] = m_Editors[i]; newEdit[j] = m_Editors[i];
j++; j++;
} }
@@ -290,7 +302,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
}; };
/** This action listener,... /**
* This action listener,...
*/ */
ActionListener normalizeWeights = new ActionListener() { ActionListener normalizeWeights = new ActionListener() {
@Override @Override
@@ -310,12 +323,14 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
}; };
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -337,7 +352,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_Editor != null) { if (this.m_Editor != null) {
@@ -350,7 +366,9 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -361,7 +379,9 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -398,21 +418,27 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
return null; return null;
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
//m_OKButton.addActionListener(a); //m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
//m_OKButton.removeActionListener(a); //m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -420,7 +446,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -433,7 +460,9 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -441,7 +470,9 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override
@@ -452,7 +483,8 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
return m_Editor; return m_Editor;
} }
/** This method will udate the status of the object taking the values from all /**
* This method will udate the status of the object taking the values from all
* supsequent editors and setting them to my object. * supsequent editors and setting them to my object.
*/ */
public void updateCenterComponent(PropertyChangeEvent evt) { public void updateCenterComponent(PropertyChangeEvent evt) {
@@ -460,7 +492,9 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
this.updateEditor(); this.updateEditor();
} }
/********************************* java.beans.PropertyChangeListener *************************/ /**
* ****************************** java.beans.PropertyChangeListener ************************
*/
@Override @Override
public void addPropertyChangeListener(PropertyChangeListener l) { public void addPropertyChangeListener(PropertyChangeListener l) {
@@ -477,8 +511,11 @@ public class GenericOptimizationObjectivesWithParamEditor extends JPanel impleme
} }
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This will wait for the GenericObjectEditor to finish
/**
* This will wait for the GenericObjectEditor to finish
* editing an object. * editing an object.
*
* @param evt * @param evt
*/ */
@Override @Override

View File

@@ -18,14 +18,22 @@ import javax.swing.*;
*/ */
public class GenericWeigthedLPTchebycheffEditor extends JPanel implements PropertyEditor { public class GenericWeigthedLPTchebycheffEditor extends JPanel implements PropertyEditor {
/** Handles property change notification */ /**
* Handles property change notification
*/
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this); private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
/** The label for when we can't edit that type */ /**
* The label for when we can't edit that type
*/
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER); private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
/** The FilePath that is to be edited*/ /**
* The FilePath that is to be edited
*/
private PropertyWeightedLPTchebycheff m_WLPT; private PropertyWeightedLPTchebycheff m_WLPT;
/** The gaphix stuff */ /**
* The gaphix stuff
*/
private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel; private JPanel m_CustomEditor, m_DataPanel, m_ButtonPanel, m_TargetPanel;
private JTextField[] m_IdealTextField, m_WeightTextField; private JTextField[] m_IdealTextField, m_WeightTextField;
private JTextField m_PValue; private JTextField m_PValue;
@@ -35,7 +43,8 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
// compiled code // compiled code
} }
/** This method will init the CustomEditor Panel /**
* This method will init the CustomEditor Panel
*/ */
private void initCustomEditor() { private void initCustomEditor() {
this.m_CustomEditor = new JPanel(); this.m_CustomEditor = new JPanel();
@@ -74,12 +83,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
this.updateEditor(); this.updateEditor();
} }
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleAction = new KeyListener() { KeyListener readDoubleAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -95,12 +106,14 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
} }
}; };
/** This action listener reads all values /**
* This action listener reads all values
*/ */
KeyListener readDoubleArrayAction = new KeyListener() { KeyListener readDoubleArrayAction = new KeyListener() {
@Override @Override
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
} }
@Override @Override
public void keyTyped(KeyEvent event) { public void keyTyped(KeyEvent event) {
} }
@@ -133,7 +146,8 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
} }
}; };
/** The object may have changed update the editor. /**
* The object may have changed update the editor.
*/ */
private void updateEditor() { private void updateEditor() {
if (this.m_CustomEditor != null) { if (this.m_CustomEditor != null) {
@@ -143,7 +157,8 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
} }
} }
/** This method updates the data panel /**
* This method updates the data panel
*/ */
private void updateDataPanel() { private void updateDataPanel() {
double[] tmpT = this.m_WLPT.m_IdealValue; double[] tmpT = this.m_WLPT.m_IdealValue;
@@ -173,7 +188,9 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
} }
/** This method will set the value of object that is to be edited. /**
* This method will set the value of object that is to be edited.
*
* @param o an object that must be an array. * @param o an object that must be an array.
*/ */
@Override @Override
@@ -184,7 +201,9 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
} }
} }
/** Returns the current object. /**
* Returns the current object.
*
* @return the current object * @return the current object
*/ */
@Override @Override
@@ -237,21 +256,27 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
m_Support.removePropertyChangeListener(l); m_Support.removePropertyChangeListener(l);
} }
/** This is used to hook an action listener to the ok button /**
* This is used to hook an action listener to the ok button
*
* @param a The action listener. * @param a The action listener.
*/ */
public void addOkListener(ActionListener a) { public void addOkListener(ActionListener a) {
m_OKButton.addActionListener(a); m_OKButton.addActionListener(a);
} }
/** This is used to remove an action listener from the ok button /**
* This is used to remove an action listener from the ok button
*
* @param a The action listener * @param a The action listener
*/ */
public void removeOkListener(ActionListener a) { public void removeOkListener(ActionListener a) {
m_OKButton.removeActionListener(a); m_OKButton.removeActionListener(a);
} }
/** Returns true since the Object can be shown /**
* Returns true since the Object can be shown
*
* @return true * @return true
*/ */
@Override @Override
@@ -259,7 +284,8 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
return true; return true;
} }
/** Paints a representation of the current classifier. /**
* Paints a representation of the current classifier.
* *
* @param gfx the graphics context to use * @param gfx the graphics context to use
* @param box the area we are allowed to paint into * @param box the area we are allowed to paint into
@@ -272,7 +298,9 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3); gfx.drawString(rep, 2, fm.getHeight() + vpad - 3);
} }
/** Returns true because we do support a custom editor. /**
* Returns true because we do support a custom editor.
*
* @return true * @return true
*/ */
@Override @Override
@@ -280,7 +308,9 @@ public class GenericWeigthedLPTchebycheffEditor extends JPanel implements Proper
return true; return true;
} }
/** Returns the array editing component. /**
* Returns the array editing component.
*
* @return a value of type 'java.awt.Component' * @return a value of type 'java.awt.Component'
*/ */
@Override @Override

View File

@@ -12,6 +12,7 @@ import java.beans.*;
* <p>Description: </p> * <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p> * <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p> * <p>Company: </p>
*
* @author not attributable * @author not attributable
* @version 1.0 * @version 1.0
*/ */
@@ -20,19 +21,35 @@ public class MultiLineStringEditor implements PropertyEditor {
protected MultiLineString value; // The value we will be editing. protected MultiLineString value; // The value we will be editing.
@Override @Override
public void setValue(Object o) { value=(MultiLineString) o;} public void setValue(Object o) {
value = (MultiLineString) o;
}
@Override @Override
public Object getValue() { return value; } public Object getValue() {
return value;
}
@Override @Override
public void setAsText(String s) { value.setString(s); } public void setAsText(String s) {
value.setString(s);
}
@Override @Override
public String getAsText() { return value.getString(); } public String getAsText() {
return value.getString();
}
@Override @Override
public String[] getTags() { return null; } // not enumerated; no tags public String[] getTags() {
return null;
} // not enumerated; no tags
// Say that we allow custom editing. // Say that we allow custom editing.
@Override @Override
public boolean supportsCustomEditor() { return true; } public boolean supportsCustomEditor() {
return true;
}
// Return the custom editor. This just creates and returns a TextArea // Return the custom editor. This just creates and returns a TextArea
// to edit the multi-line text. But it also registers a listener on the // to edit the multi-line text. But it also registers a listener on the
@@ -56,7 +73,9 @@ public class MultiLineStringEditor implements PropertyEditor {
// Just print some instructions and hope they fit in the in the box. // Just print some instructions and hope they fit in the in the box.
// This could be more sophisticated. // This could be more sophisticated.
@Override @Override
public boolean isPaintable() { return true; } public boolean isPaintable() {
return true;
}
@Override @Override
public void paintValue(Graphics g, Rectangle r) { public void paintValue(Graphics g, Rectangle r) {
@@ -67,7 +86,9 @@ public class MultiLineStringEditor implements PropertyEditor {
// Important method for code generators. Note that it // Important method for code generators. Note that it
// ought to add any necessary escape sequences. // ought to add any necessary escape sequences.
@Override @Override
public String getJavaInitializationString() { return "\"" + value + "\""; } public String getJavaInitializationString() {
return "\"" + value + "\"";
}
// This code uses the PropertyChangeSupport class to maintain a list of // This code uses the PropertyChangeSupport class to maintain a list of
// listeners interested in the edits we make to the value. // listeners interested in the edits we make to the value.

View File

@@ -9,8 +9,10 @@ package eva2.gui.editor;
* $Date: 2007-10-23 13:43:24 +0200 (Tue, 23 Oct 2007) $ * $Date: 2007-10-23 13:43:24 +0200 (Tue, 23 Oct 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.gui.PropertySheetPanelStat; import eva2.gui.PropertySheetPanelStat;
import eva2.optimization.stat.GenericStatistics; import eva2.optimization.stat.GenericStatistics;
import java.awt.*; import java.awt.*;
import java.beans.*; import java.beans.*;
import javax.swing.*; import javax.swing.*;

View File

@@ -15,6 +15,7 @@ import eva2.gui.PropertyValueSelector;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import eva2.tools.SelectedTag; import eva2.tools.SelectedTag;
import eva2.tools.Tag; import eva2.tools.Tag;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Toolkit; import java.awt.Toolkit;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@@ -22,6 +23,7 @@ import java.awt.event.WindowEvent;
import java.beans.PropertyEditorManager; import java.beans.PropertyEditorManager;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import javax.swing.JFrame; import javax.swing.JFrame;
/** /**
* *
*/ */
@@ -66,7 +68,8 @@ public class TagEditor extends PropertyEditorSupport {
* Sets the current property value as text. * Sets the current property value as text.
* *
* @param text the text of the selected tag. * @param text the text of the selected tag.
* @exception java.lang.IllegalArgumentException if an error occurs * @throws java.lang.IllegalArgumentException
* if an error occurs
*/ */
@Override @Override
public void setAsText(String text) throws java.lang.IllegalArgumentException { public void setAsText(String text) throws java.lang.IllegalArgumentException {

View File

@@ -1,7 +1,6 @@
package eva2.gui.plot; package eva2.gui.plot;
import eva2.tools.chart2d.DArray; import eva2.tools.chart2d.DArray;
import eva2.tools.chart2d.DBorder; import eva2.tools.chart2d.DBorder;
import eva2.tools.chart2d.DComponent; import eva2.tools.chart2d.DComponent;
@@ -11,6 +10,7 @@ import eva2.tools.chart2d.DPoint;
import eva2.tools.chart2d.DPointIcon; import eva2.tools.chart2d.DPointIcon;
import eva2.tools.chart2d.DPointSet; import eva2.tools.chart2d.DPointSet;
import eva2.tools.chart2d.DRectangle; import eva2.tools.chart2d.DRectangle;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.Point; import java.awt.Point;
@@ -25,74 +25,61 @@ import java.util.ArrayList;
* Time: 16:17:35 * Time: 16:17:35
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class DPointSetMultiIcon extends DComponent public class DPointSetMultiIcon extends DComponent {
{
//~ Instance fields //////////////////////////////////////////////////////// //~ Instance fields ////////////////////////////////////////////////////////
/** /**
* this class stores the jump positions (see this.jump) * this class stores the jump positions (see this.jump)
*/ */
class JumpManager class JumpManager {
{
protected int index = -1; protected int index = -1;
protected ArrayList<Integer> jumps = new ArrayList<Integer>(); protected ArrayList<Integer> jumps = new ArrayList<Integer>();
public void addJump() public void addJump() {
{
jumps.add(getSize()); jumps.add(getSize());
} }
public boolean hasMoreIntervals() public boolean hasMoreIntervals() {
{
return index < jumps.size(); return index < jumps.size();
} }
public int[] nextInterval() public int[] nextInterval() {
{
int no_jumps = jumps.size(); int no_jumps = jumps.size();
if (index >= no_jumps) if (index >= no_jumps) {
{
throw new ArrayIndexOutOfBoundsException( throw new ArrayIndexOutOfBoundsException(
"No more intervals in JumpManager"); "No more intervals in JumpManager");
} }
int[] inter = new int[2]; int[] inter = new int[2];
if (index == -1) if (index == -1) {
{
inter[0] = 0; inter[0] = 0;
} } else {
else
{
inter[0] = jumps.get(index); inter[0] = jumps.get(index);
} }
index++; index++;
if (index < no_jumps) if (index < no_jumps) {
{
inter[1] = jumps.get(index); inter[1] = jumps.get(index);
} } else {
else
{
inter[1] = getSize(); inter[1] = getSize();
} }
return inter; return inter;
} }
public void reset() public void reset() {
{
index = -1; index = -1;
jumps.clear(); jumps.clear();
} }
public void restore() public void restore() {
{
index = -1; index = -1;
} }
} }
protected boolean connectedMI; protected boolean connectedMI;
protected DPointIcon iconMI = null; protected DPointIcon iconMI = null;
protected DPointSetMultiIcon.JumpManager jumperMI = new DPointSetMultiIcon.JumpManager(); protected DPointSetMultiIcon.JumpManager jumperMI = new DPointSetMultiIcon.JumpManager();
@@ -104,15 +91,12 @@ public class DPointSetMultiIcon extends DComponent
protected DIntDoubleMap yMI; protected DIntDoubleMap yMI;
public DPointSetMultiIcon() public DPointSetMultiIcon() {
{
this(10, 2); this(10, 2);
} }
public DPointSetMultiIcon(DIntDoubleMap x_values, DIntDoubleMap y_values) public DPointSetMultiIcon(DIntDoubleMap x_values, DIntDoubleMap y_values) {
{ if (x_values.getSize() != y_values.getSize()) {
if (x_values.getSize() != y_values.getSize())
{
throw new IllegalArgumentException( throw new IllegalArgumentException(
"The number of x-values has to be the same than the number of y-values"); "The number of x-values has to be the same than the number of y-values");
} }
@@ -123,26 +107,22 @@ public class DPointSetMultiIcon extends DComponent
setDBorder(new DBorder(1, 1, 1, 1)); setDBorder(new DBorder(1, 1, 1, 1));
} }
public DPointSetMultiIcon(int initial_capacity) public DPointSetMultiIcon(int initial_capacity) {
{
this(initial_capacity, 2); this(initial_capacity, 2);
} }
//~ Methods //////////////////////////////////////////////////////////////// //~ Methods ////////////////////////////////////////////////////////////////
public DPointSetMultiIcon(int initial_capacity, int length_multiplier) public DPointSetMultiIcon(int initial_capacity, int length_multiplier) {
{
this(new DArray(initial_capacity, length_multiplier), this(new DArray(initial_capacity, length_multiplier),
new DArray(initial_capacity, length_multiplier)); new DArray(initial_capacity, length_multiplier));
} }
public void addDPoint(double x, double y) public void addDPoint(double x, double y) {
{
addDPoint(new DPoint(x, y)); addDPoint(new DPoint(x, y));
} }
public void addDPoint(DPoint p) public void addDPoint(DPoint p) {
{
xMI.addImage(p.x); xMI.addImage(p.x);
yMI.addImage(p.y); yMI.addImage(p.y);
m_IconsMI.add(p.getIcon()); m_IconsMI.add(p.getIcon());
@@ -156,10 +136,8 @@ public class DPointSetMultiIcon extends DComponent
* @param index the index of the DPoint * @param index the index of the DPoint
* @return the DPoint at the given index * @return the DPoint at the given index
*/ */
public DPoint getDPoint(int index) public DPoint getDPoint(int index) {
{ if (index >= xMI.getSize()) {
if (index >= xMI.getSize())
{
throw new ArrayIndexOutOfBoundsException(index); throw new ArrayIndexOutOfBoundsException(index);
} }
@@ -170,8 +148,7 @@ public class DPointSetMultiIcon extends DComponent
return p; return p;
} }
public DPointSet getDPointSet() public DPointSet getDPointSet() {
{
return new DPointSet(xMI, yMI); return new DPointSet(xMI, yMI);
} }
@@ -180,8 +157,7 @@ public class DPointSetMultiIcon extends DComponent
* *
* @return the DPointIcon * @return the DPointIcon
*/ */
public DPointIcon getIcon() public DPointIcon getIcon() {
{
return iconMI; return iconMI;
} }
@@ -194,16 +170,12 @@ public class DPointSetMultiIcon extends DComponent
* *
* @return the nearest <code>DPoint</code> * @return the nearest <code>DPoint</code>
*/ */
public DPoint getNearestDPoint(DPoint point) public DPoint getNearestDPoint(DPoint point) {
{
int minIndex = getNearestDPointIndex(point); int minIndex = getNearestDPointIndex(point);
if (minIndex == -1) if (minIndex == -1) {
{
return null; return null;
} } else {
else
{
DPoint result = new DPoint(xMI.getImage(minIndex), DPoint result = new DPoint(xMI.getImage(minIndex),
yMI.getImage(minIndex)); yMI.getImage(minIndex));
result.setIcon((DPointIcon) this.m_IconsMI.get(minIndex)); result.setIcon((DPointIcon) this.m_IconsMI.get(minIndex));
@@ -212,22 +184,21 @@ public class DPointSetMultiIcon extends DComponent
} }
} }
/** method returns the index to the nearest <code>DPoint</code> in this <code>DPointSet</code>. /**
* method returns the index to the nearest <code>DPoint</code> in this <code>DPointSet</code>.
*
* @return the index to the nearest <code>DPoint</code>. -1 if no nearest <code>DPoint</code> was found. * @return the index to the nearest <code>DPoint</code>. -1 if no nearest <code>DPoint</code> was found.
*/ */
public int getNearestDPointIndex(DPoint point) public int getNearestDPointIndex(DPoint point) {
{
double minValue = Double.MAX_VALUE; double minValue = Double.MAX_VALUE;
int minIndex = -1; int minIndex = -1;
for (int i = 0; i < xMI.getSize(); i++) for (int i = 0; i < xMI.getSize(); i++) {
{
double dx = point.x - xMI.getImage(i); double dx = point.x - xMI.getImage(i);
double dy = point.y - yMI.getImage(i); double dy = point.y - yMI.getImage(i);
double dummy = (dx * dx) + (dy * dy); double dummy = (dx * dx) + (dy * dy);
if (dummy < minValue) if (dummy < minValue) {
{
minValue = dummy; minValue = dummy;
minIndex = i; minIndex = i;
} }
@@ -236,8 +207,7 @@ public class DPointSetMultiIcon extends DComponent
return minIndex; return minIndex;
} }
public int getSize() public int getSize() {
{
int size = Math.min(xMI.getSize(), yMI.getSize()); int size = Math.min(xMI.getSize(), yMI.getSize());
// int size = x.getSize(); // int size = x.getSize();
@@ -254,8 +224,7 @@ public class DPointSetMultiIcon extends DComponent
* *
* @return the stroke * @return the stroke
*/ */
public Stroke getStroke() public Stroke getStroke() {
{
return strokeMI; return strokeMI;
} }
@@ -263,58 +232,46 @@ public class DPointSetMultiIcon extends DComponent
* This method causes the DPointSet to interupt the connected painting at the * This method causes the DPointSet to interupt the connected painting at the
* current position. * current position.
*/ */
public void jump() public void jump() {
{
jumperMI.addJump(); jumperMI.addJump();
} }
@Override @Override
public void paint(DMeasures m) public void paint(DMeasures m) {
{ try {
try
{
Graphics2D g = (Graphics2D) m.getGraphics(); Graphics2D g = (Graphics2D) m.getGraphics();
g.setStroke(strokeMI); g.setStroke(strokeMI);
if (color != null) if (color != null) {
{
g.setColor(color); g.setColor(color);
} }
int size = getSize(); int size = getSize();
if (connectedMI && (size > 1)) if (connectedMI && (size > 1)) {
{
jumperMI.restore(); jumperMI.restore();
while (jumperMI.hasMoreIntervals()) while (jumperMI.hasMoreIntervals()) {
{
int[] interval = jumperMI.nextInterval(); int[] interval = jumperMI.nextInterval();
Point p1 = null; Point p1 = null;
Point p2; Point p2;
for (int i = interval[0]; i < interval[1]; i++) for (int i = interval[0]; i < interval[1]; i++) {
{
p2 = m.getPoint(xMI.getImage(i), yMI.getImage(i)); p2 = m.getPoint(xMI.getImage(i), yMI.getImage(i));
if (p1 != null) if (p1 != null) {
{
if (p2 != null) { if (p2 != null) {
g.drawLine(p1.x, p1.y, p2.x, p2.y); g.drawLine(p1.x, p1.y, p2.x, p2.y);
} }
} }
if ((i < this.m_IconsMI.size()) && (this.m_IconsMI.get(i) != null)) if ((i < this.m_IconsMI.size()) && (this.m_IconsMI.get(i) != null)) {
{
g.setStroke(new BasicStroke()); g.setStroke(new BasicStroke());
g.translate(p2.x, p2.y); g.translate(p2.x, p2.y);
((DPointIcon) this.m_IconsMI.get(i)).paint(g); ((DPointIcon) this.m_IconsMI.get(i)).paint(g);
g.translate(-p2.x, -p2.y); g.translate(-p2.x, -p2.y);
g.setStroke(strokeMI); g.setStroke(strokeMI);
} } else {
else if (iconMI != null) {
{
if (iconMI != null)
{
g.setStroke(new BasicStroke()); g.setStroke(new BasicStroke());
g.translate(p2.x, p2.y); g.translate(p2.x, p2.y);
iconMI.paint(g); iconMI.paint(g);
@@ -326,48 +283,36 @@ public class DPointSetMultiIcon extends DComponent
p1 = p2; p1 = p2;
} }
} }
} } else {
else
{
Point p; Point p;
//for (int i = 0; i < size; i++) //for (int i = 0; i < size; i++)
// @todo Streiche: Mal wieder eine index out of bounds exception, dass ist einfach mist... // @todo Streiche: Mal wieder eine index out of bounds exception, dass ist einfach mist...
for (int i = 0; i < this.m_IconsMI.size(); i++) for (int i = 0; i < this.m_IconsMI.size(); i++) {
{ try {
try
{
p = m.getPoint(xMI.getImage(i), yMI.getImage(i)); p = m.getPoint(xMI.getImage(i), yMI.getImage(i));
if (p == null) { if (p == null) {
continue; continue;
} }
if (this.m_IconsMI.get(i) != null) if (this.m_IconsMI.get(i) != null) {
{
g.setStroke(new BasicStroke()); g.setStroke(new BasicStroke());
g.translate(p.x, p.y); g.translate(p.x, p.y);
((DPointIcon) this.m_IconsMI.get(i)).paint(g); ((DPointIcon) this.m_IconsMI.get(i)).paint(g);
g.translate(-p.x, -p.y); g.translate(-p.x, -p.y);
g.setStroke(strokeMI); g.setStroke(strokeMI);
} } else {
else if (iconMI == null) {
{
if (iconMI == null)
{
g.drawLine(p.x - 1, p.y - 1, p.x + 1, p.y + 1); g.drawLine(p.x - 1, p.y - 1, p.x + 1, p.y + 1);
g.drawLine(p.x + 1, p.y - 1, p.x - 1, p.y + 1); g.drawLine(p.x + 1, p.y - 1, p.x - 1, p.y + 1);
} } else {
else
{
g.setStroke(new BasicStroke()); g.setStroke(new BasicStroke());
g.translate(p.x, p.y); g.translate(p.x, p.y);
iconMI.paint(g); iconMI.paint(g);
g.translate(-p.x, -p.y); g.translate(-p.x, -p.y);
} }
} }
} } catch (java.lang.IllegalArgumentException e) {
catch (java.lang.IllegalArgumentException e)
{
System.out.println( System.out.println(
"The rectangle lies not in the currently painted rectangle."); "The rectangle lies not in the currently painted rectangle.");
} }
@@ -375,17 +320,13 @@ public class DPointSetMultiIcon extends DComponent
} }
g.setStroke(new BasicStroke()); g.setStroke(new BasicStroke());
} } catch (java.lang.ArrayIndexOutOfBoundsException e) {
catch (java.lang.ArrayIndexOutOfBoundsException e)
{
// *pff* // *pff*
} }
} }
public void removeAllPoints() public void removeAllPoints() {
{ if (xMI.getSize() == 0) {
if (xMI.getSize() == 0)
{
return; return;
} }
@@ -401,15 +342,12 @@ public class DPointSetMultiIcon extends DComponent
* if the DPointSet is connected, all points will be painted connected to * if the DPointSet is connected, all points will be painted connected to
* their following point * their following point
*/ */
public void removeJumps() public void removeJumps() {
{
jumperMI.reset(); jumperMI.reset();
} }
protected void restore() protected void restore() {
{ if (getSize() == 0) {
if (getSize() == 0)
{
rectangle = DRectangle.getEmpty(); rectangle = DRectangle.getEmpty();
return; return;
@@ -422,13 +360,11 @@ public class DPointSetMultiIcon extends DComponent
rectangle = new DRectangle(min_x, min_y, max_x - min_x, max_y - min_y); rectangle = new DRectangle(min_x, min_y, max_x - min_x, max_y - min_y);
} }
public void setConnected(boolean aFlag) public void setConnected(boolean aFlag) {
{
boolean changed = !(aFlag == connectedMI); boolean changed = !(aFlag == connectedMI);
connectedMI = aFlag; connectedMI = aFlag;
if (changed) if (changed) {
{
repaint(); repaint();
} }
} }
@@ -439,10 +375,8 @@ public class DPointSetMultiIcon extends DComponent
* @param index the index of the point * @param index the index of the point
* @param p the point to insert * @param p the point to insert
*/ */
public void setDPoint(int index, DPoint p) public void setDPoint(int index, DPoint p) {
{ if (index >= xMI.getSize()) {
if (index >= xMI.getSize())
{
throw new ArrayIndexOutOfBoundsException(index); throw new ArrayIndexOutOfBoundsException(index);
} }
@@ -459,16 +393,12 @@ public class DPointSetMultiIcon extends DComponent
* *
* @param icon the DPointIcon * @param icon the DPointIcon
*/ */
public void setIcon(DPointIcon icon) public void setIcon(DPointIcon icon) {
{
this.iconMI = icon; this.iconMI = icon;
if (icon == null) if (icon == null) {
{
setDBorder(new DBorder(1, 1, 1, 1)); setDBorder(new DBorder(1, 1, 1, 1));
} } else {
else
{
setDBorder(icon.getDBorder()); setDBorder(icon.getDBorder());
} }
} }
@@ -479,10 +409,8 @@ public class DPointSetMultiIcon extends DComponent
* *
* @param s the new stroke * @param s the new stroke
*/ */
public void setStroke(Stroke s) public void setStroke(Stroke s) {
{ if (s == null) {
if (s == null)
{
s = new BasicStroke(); s = new BasicStroke();
} }
@@ -493,12 +421,10 @@ public class DPointSetMultiIcon extends DComponent
//~ Inner Classes ////////////////////////////////////////////////////////// //~ Inner Classes //////////////////////////////////////////////////////////
@Override @Override
public String toString() public String toString() {
{
String text = "eva2.tools.chart2d.DPointSet[size:" + getSize(); String text = "eva2.tools.chart2d.DPointSet[size:" + getSize();
for (int i = 0; i < xMI.getSize(); i++) for (int i = 0; i < xMI.getSize(); i++) {
{
text += (",(" + xMI.getImage(i) + "," + yMI.getImage(i) + ")"); text += (",(" + xMI.getImage(i) + "," + yMI.getImage(i) + ")");
} }

View File

@@ -89,7 +89,8 @@ class ViewContainer extends ArrayList {
/** /**
* *
*/ */
public ViewContainer() { } public ViewContainer() {
}
/** /**
* *

View File

@@ -17,5 +17,6 @@ import eva2.gui.plot.Graph;
*==========================================================================*/ *==========================================================================*/
public interface DataViewerInterface { public interface DataViewerInterface {
public Graph getNewGraph(String InfoString); public Graph getNewGraph(String InfoString);
public void init(); public void init();
} }

View File

@@ -11,6 +11,7 @@ package eva2.gui.plot;
* IMPORTS * IMPORTS
*========================================================================== *==========================================================================
*/ */
import eva2.gui.*; import eva2.gui.*;
import eva2.optimization.individuals.AbstractEAIndividual; import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.mocco.paretofrontviewer.InterfaceRefPointListener; import eva2.optimization.mocco.paretofrontviewer.InterfaceRefPointListener;
@@ -27,6 +28,7 @@ import eva2.tools.chart2d.DPoint;
import eva2.tools.chart2d.DPointIcon; import eva2.tools.chart2d.DPointIcon;
import eva2.tools.chart2d.DPointSet; import eva2.tools.chart2d.DPointSet;
import eva2.tools.chart2d.ScaledBorder; import eva2.tools.chart2d.ScaledBorder;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
@@ -431,7 +433,6 @@ public class FunctionArea extends DArea implements Serializable {
/** /**
* Re-color all graphs which are nonempty by their index. * Re-color all graphs which are nonempty by their index.
*
*/ */
public void recolorAllGraphsByIndex() { public void recolorAllGraphsByIndex() {
int index = 0; int index = 0;
@@ -446,7 +447,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @return * @return
*/ */
public boolean checkLoggable() { public boolean checkLoggable() {
@@ -656,7 +656,6 @@ public class FunctionArea extends DArea implements Serializable {
/** /**
* Export contained data to standard output. * Export contained data to standard output.
*
*/ */
public void exportToAscii() { public void exportToAscii() {
exportToAscii((File) null); exportToAscii((File) null);
@@ -758,7 +757,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param x * @param x
* @param y * @param y
* @return * @return
@@ -798,7 +796,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param GraphLabel * @param GraphLabel
* @return * @return
*/ */
@@ -857,7 +854,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param x * @param x
* @param y * @param y
* @return * @return
@@ -941,7 +937,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @return * @return
*/ */
public DPointSet[] printPoints() { public DPointSet[] printPoints() {
@@ -957,7 +952,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param i * @param i
* @return * @return
*/ */
@@ -971,7 +965,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param x * @param x
* @param y * @param y
*/ */
@@ -1004,7 +997,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param p * @param p
* @param graphLabel * @param graphLabel
*/ */
@@ -1013,7 +1005,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param GraphLabel * @param GraphLabel
* @param color * @param color
*/ */
@@ -1022,7 +1013,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param GraphLabel * @param GraphLabel
* @param colorindex * @param colorindex
*/ */
@@ -1031,7 +1021,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param GraphLabel * @param GraphLabel
* @param Info * @param Info
* @param stroke * @param stroke
@@ -1054,7 +1043,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param x * @param x
* @param y * @param y
* @param GraphLabel * @param GraphLabel
@@ -1073,7 +1061,6 @@ public class FunctionArea extends DArea implements Serializable {
} }
/** /**
*
* @param p * @param p
* @param GraphLabel * @param GraphLabel
*/ */
@@ -1201,7 +1188,6 @@ public class FunctionArea extends DArea implements Serializable {
/** /**
* Recreate the legend object with the current point sets. * Recreate the legend object with the current point sets.
*
*/ */
public void updateLegend() { public void updateLegend() {
GraphPointSetLegend lb = new GraphPointSetLegend(pointSetContainer, GraphPointSetLegend lb = new GraphPointSetLegend(pointSetContainer,

View File

@@ -32,7 +32,6 @@ public class Graph implements Serializable {
} }
/** /**
*
* @param Info * @param Info
* @param stroke * @param stroke
*/ */

View File

@@ -20,6 +20,7 @@ import eva2.tools.chart2d.DPoint;
import eva2.tools.chart2d.DPointIcon; import eva2.tools.chart2d.DPointIcon;
import eva2.tools.chart2d.DPointSet; import eva2.tools.chart2d.DPointSet;
import eva2.tools.math.Mathematics; import eva2.tools.math.Mathematics;
import java.awt.BasicStroke; import java.awt.BasicStroke;
import java.awt.Color; import java.awt.Color;
import java.io.Serializable; import java.io.Serializable;
@@ -28,6 +29,7 @@ import java.util.ArrayList;
/*==========================================================================* /*==========================================================================*
* CLASS DECLARATION * CLASS DECLARATION
*==========================================================================*/ *==========================================================================*/
/** /**
* *
*/ */
@@ -57,7 +59,6 @@ public class GraphPointSet {
private double[] m_Y; private double[] m_Y;
/** /**
*
* @param pointset * @param pointset
*/ */
public PointSet(DPointSet pointset) { public PointSet(DPointSet pointset) {
@@ -72,7 +73,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public DPointSet getDPointSet() { public DPointSet getDPointSet() {
@@ -85,7 +85,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public int getSize() { public int getSize() {
@@ -163,7 +162,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param size * @param size
* @param GraphLabel * @param GraphLabel
*/ */
@@ -205,7 +203,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param x * @param x
* @param y * @param y
*/ */
@@ -225,7 +222,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param p * @param p
*/ */
public void addDPoint(DPoint p) { public void addDPoint(DPoint p) {
@@ -238,8 +234,7 @@ public class GraphPointSet {
* *
* @param set * @param set
* @param measures * @param measures
* @param useForce * @param useForce forces the add even if point counts mismatch, maybe losing
* forces the add even if point counts mismatch, maybe losing
* some data points * some data points
*/ */
public void addGraph(GraphPointSet set, DMeasures measures, boolean useForce) { public void addGraph(GraphPointSet set, DMeasures measures, boolean useForce) {
@@ -335,7 +330,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public Color getColor() { public Color getColor() {
@@ -343,7 +337,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public DPointSet getConnectedPointSet() { public DPointSet getConnectedPointSet() {
@@ -351,7 +344,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public int getGraphLabel() { public int getGraphLabel() {
@@ -364,6 +356,7 @@ public class GraphPointSet {
// public void setUnconnectedPoint (double x, double y) { // public void setUnconnectedPoint (double x, double y) {
// m_PointSet_1.addDPoint(x,y); // m_PointSet_1.addDPoint(x,y);
// } // }
/** /**
* *
*/ */
@@ -372,7 +365,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param p * @param p
* @return * @return
*/ */
@@ -381,7 +373,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public int getPointCount() { public int getPointCount() {
@@ -389,7 +380,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public PointSet getPointSet() { public PointSet getPointSet() {
@@ -397,7 +387,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public DPointSetMultiIcon getReference2ConnectedPointSet() { public DPointSetMultiIcon getReference2ConnectedPointSet() {
@@ -413,7 +402,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param index * @param index
* @return * @return
*/ */
@@ -423,7 +411,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param Area * @param Area
*/ */
public void initGraph(DArea Area) { public void initGraph(DArea Area) {
@@ -450,7 +437,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public boolean isStatisticsGraph() { public boolean isStatisticsGraph() {
@@ -466,7 +452,6 @@ public class GraphPointSet {
} }
/** /**
*
* @return * @return
*/ */
public DPointSet printPoints() { public DPointSet printPoints() {
@@ -490,7 +475,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param x * @param x
*/ */
public void removePoint(DPoint x) { public void removePoint(DPoint x) {
@@ -503,8 +487,7 @@ public class GraphPointSet {
for (int i = 0; i < buf.length; i++) { for (int i = 0; i < buf.length; i++) {
if (buf[i].x == x.x && buf[i].y == x.y) { if (buf[i].x == x.x && buf[i].y == x.y) {
System.out.println("point found"); System.out.println("point found");
} } else {
else {
m_ConnectedPointSet.addDPoint(buf[i]); m_ConnectedPointSet.addDPoint(buf[i]);
} }
@@ -512,7 +495,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param c * @param c
*/ */
public void setColor(Color c) { public void setColor(Color c) {
@@ -525,7 +507,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param p * @param p
*/ */
public void setConnectedMode(boolean p) { public void setConnectedMode(boolean p) {
@@ -533,7 +514,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param p * @param p
*/ */
public void setIcon(DPointIcon p) { public void setIcon(DPointIcon p) {
@@ -542,7 +522,6 @@ public class GraphPointSet {
} }
/** /**
*
* @param x * @param x
* @param stroke * @param stroke
*/ */

View File

@@ -3,6 +3,7 @@ package eva2.gui.plot;
import eva2.tools.Pair; import eva2.tools.Pair;
import eva2.tools.StringTools; import eva2.tools.StringTools;
import eva2.tools.chart2d.SlimRect; import eva2.tools.chart2d.SlimRect;
import java.awt.Color; import java.awt.Color;
import java.awt.FontMetrics; import java.awt.FontMetrics;
import java.awt.Graphics; import java.awt.Graphics;
@@ -24,15 +25,12 @@ import javax.swing.JPanel;
* an alternative, an own frame could be created. * an alternative, an own frame could be created.
* *
* @author mkron, draeger * @author mkron, draeger
*
*/ */
public class GraphPointSetLegend { public class GraphPointSetLegend {
SortedSet<Pair<String, Color>> legendEntries; SortedSet<Pair<String, Color>> legendEntries;
/** /**
*
* @author draeger * @author draeger
*
*/ */
private static class PairComp implements Comparator<Pair<String, Color>> { private static class PairComp implements Comparator<Pair<String, Color>> {
@@ -67,8 +65,7 @@ public class GraphPointSetLegend {
String entryStr; String entryStr;
if (appendIndex) { if (appendIndex) {
entryStr = StringTools.expandPrefixZeros(i, pointSetContainer.size() - 1) + ": " + pointset.getInfoString(); entryStr = StringTools.expandPrefixZeros(i, pointSetContainer.size() - 1) + ": " + pointset.getInfoString();
} } else {
else {
entryStr = pointset.getInfoString(); entryStr = pointset.getInfoString();
} }
legendEntries.add(new Pair<String, Color>(entryStr, pointset.getColor())); legendEntries.add(new Pair<String, Color>(entryStr, pointset.getColor()));
@@ -99,7 +96,6 @@ public class GraphPointSetLegend {
} }
/** /**
*
* @param bgCol * @param bgCol
* @param pointSetContainer * @param pointSetContainer
* @return * @return
@@ -115,7 +111,6 @@ public class GraphPointSetLegend {
} }
/** /**
*
* @param bgCol * @param bgCol
* @param pointSetContainer * @param pointSetContainer
* @return * @return
@@ -131,7 +126,6 @@ public class GraphPointSetLegend {
} }
/** /**
*
* @param component * @param component
*/ */
public void paintIn(JComponent component) { public void paintIn(JComponent component) {
@@ -172,7 +166,6 @@ public class GraphPointSetLegend {
} }
/** /**
*
* @param g * @param g
* @param x * @param x
* @param y * @param y

View File

@@ -12,15 +12,20 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
*/ */
public interface InterfaceDPointWithContent { public interface InterfaceDPointWithContent {
public void setEAIndividual(AbstractEAIndividual indy); public void setEAIndividual(AbstractEAIndividual indy);
public AbstractEAIndividual getEAIndividual(); public AbstractEAIndividual getEAIndividual();
/** This method allows you to set the according optimization problem /**
* This method allows you to set the according optimization problem
*
* @param problem InterfaceOptimizationProblem * @param problem InterfaceOptimizationProblem
*/ */
public void setProblem(InterfaceOptimizationProblem problem); public void setProblem(InterfaceOptimizationProblem problem);
public InterfaceOptimizationProblem getProblem(); public InterfaceOptimizationProblem getProblem();
/** This method allows you to draw additional data of the individual /**
* This method allows you to draw additional data of the individual
*/ */
public void showIndividual(); public void showIndividual();
} }

View File

@@ -6,12 +6,14 @@ package eva2.gui.plot;
* Hannes Planatscher @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07 * Hannes Planatscher @version: $Revision: 322 $ $Date: 2007-12-11 17:24:07
* +0100 (Tue, 11 Dec 2007) $ $Author: mkron $ * +0100 (Tue, 11 Dec 2007) $ $Author: mkron $
*/ */
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.gui.JEFrame; import eva2.gui.JEFrame;
import eva2.optimization.individuals.AbstractEAIndividual; import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.tools.BasicResourceLoader; import eva2.tools.BasicResourceLoader;
import eva2.tools.chart2d.DPointSet; import eva2.tools.chart2d.DPointSet;
import java.awt.*; import java.awt.*;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;

View File

@@ -1,4 +1,5 @@
package eva2.gui.plot; package eva2.gui.plot;
/* /*
* Title: EvA2 * Title: EvA2
* Description: * Description:
@@ -23,15 +24,24 @@ public interface PlotInterface {
* @param forceAdd if the graph mismatch in point counts, try to add them anyway in a useful manner. * @param forceAdd if the graph mismatch in point counts, try to add them anyway in a useful manner.
*/ */
public void addGraph(int g1, int g2, boolean forceAdd); public void addGraph(int g1, int g2, boolean forceAdd);
public void setUnconnectedPoint(double x, double y, int GraphLabel); public void setUnconnectedPoint(double x, double y, int GraphLabel);
public void clearAll(); public void clearAll();
public void clearGraph(int GraphNumber); public void clearGraph(int GraphNumber);
public void setInfoString(int GraphLabel, String Info, float stroke); public void setInfoString(int GraphLabel, String Info, float stroke);
public void jump(); public void jump();
public String getName(); public String getName();
public int getPointCount(int graphLabel); public int getPointCount(int graphLabel);
// public FunctionArea getFunctionArea(); // this is bad for RMI // public FunctionArea getFunctionArea(); // this is bad for RMI
public boolean isValid(); public boolean isValid();
public void init(); public void init();
} }

View File

@@ -12,11 +12,13 @@ package eva2.gui.plot;
/*==========================================================================* /*==========================================================================*
* IMPORTS * IMPORTS
*==========================================================================*/ *==========================================================================*/
import eva2.optimization.problems.Interface2DBorderProblem; import eva2.optimization.problems.Interface2DBorderProblem;
import eva2.optimization.problems.InterfaceFirstOrderDerivableProblem; import eva2.optimization.problems.InterfaceFirstOrderDerivableProblem;
import eva2.tools.chart2d.DRectangle; import eva2.tools.chart2d.DRectangle;
import eva2.tools.diagram.ColorBarCalculator; import eva2.tools.diagram.ColorBarCalculator;
import eva2.tools.math.Mathematics; import eva2.tools.math.Mathematics;
import java.awt.Color; import java.awt.Color;
import javax.swing.JPanel; import javax.swing.JPanel;
@@ -24,6 +26,7 @@ import javax.swing.JPanel;
/*==========================================================================* /*==========================================================================*
* CLASS DECLARATION * CLASS DECLARATION
*==========================================================================*/ *==========================================================================*/
/** /**
* *
*/ */
@@ -42,12 +45,15 @@ public class TopoPlot extends Plot {
super(PlotName, xname, yname, true); super(PlotName, xname, yname, true);
//if (TRACE) System.out.println("Constructor TopoPlot "+PlotName); //if (TRACE) System.out.println("Constructor TopoPlot "+PlotName);
} }
public TopoPlot(String PlotName, String xname, String yname, double[] a, double[] b) { public TopoPlot(String PlotName, String xname, String yname, double[] a, double[] b) {
super(PlotName, xname, yname, a, b); super(PlotName, xname, yname, a, b);
//if (TRACE) System.out.println("Constructor TopoPlot "+PlotName); //if (TRACE) System.out.println("Constructor TopoPlot "+PlotName);
} }
/** /**
* Defines parameters used for drawing the topology. * Defines parameters used for drawing the topology.
*
* @param gridX the x-resolution of the topology, higher value means higher resolution * @param gridX the x-resolution of the topology, higher value means higher resolution
* @param gridY the y-resolution of the topology, higher value means higher resolution * @param gridY the y-resolution of the topology, higher value means higher resolution
* @param color_scale the topologies color coding. Values (0-3) are valid. @See ColorBarCalculator. * @param color_scale the topologies color coding. Values (0-3) are valid. @See ColorBarCalculator.
@@ -65,7 +71,6 @@ public class TopoPlot extends Plot {
} }
@Override @Override
protected void installButtons(JPanel buttonPan) { protected void installButtons(JPanel buttonPan) {
super.installButtons(buttonPan); super.installButtons(buttonPan);
@@ -81,8 +86,10 @@ public class TopoPlot extends Plot {
// }); // });
// buttonPan.add(refineButton); // buttonPan.add(refineButton);
} }
/** /**
* Defines parameters used for drawing the topology. * Defines parameters used for drawing the topology.
*
* @param gridX the x-resolution of the topology, higher value means higher resolution * @param gridX the x-resolution of the topology, higher value means higher resolution
* @param gridY the y-resolution of the topology, higher value means higher resolution * @param gridY the y-resolution of the topology, higher value means higher resolution
*/ */
@@ -96,6 +103,7 @@ public class TopoPlot extends Plot {
public void setTopology(Interface2DBorderProblem problem) { public void setTopology(Interface2DBorderProblem problem) {
setTopology(problem, problem.get2DBorder(), false); setTopology(problem, problem.get2DBorder(), false);
} }
/** /**
* Defines the topology (by setting a specific problem) and draws the topology * Defines the topology (by setting a specific problem) and draws the topology
*/ */

View File

@@ -58,8 +58,7 @@ public class VerticalButtonUI extends BasicButtonUI {
g2.translate(0, -c.getWidth()); g2.translate(0, -c.getWidth());
paintViewR.x = c.getHeight() / 2 - (int) fm.getStringBounds(text, g).getWidth() / 2; paintViewR.x = c.getHeight() / 2 - (int) fm.getStringBounds(text, g).getWidth() / 2;
paintViewR.y = c.getWidth() / 2 - (int) fm.getStringBounds(text, g).getHeight() / 2; paintViewR.y = c.getWidth() / 2 - (int) fm.getStringBounds(text, g).getHeight() / 2;
} } else if (angle == 270 || angle == -90) {
else if (angle == 270 || angle == -90) {
g2.rotate(-Math.PI / 2); g2.rotate(-Math.PI / 2);
g2.translate(-c.getHeight(), 0); g2.translate(-c.getHeight(), 0);
paintViewR.x = c.getHeight() / 2 - (int) fm.getStringBounds(text, g).getWidth() / 2; paintViewR.x = c.getHeight() / 2 - (int) fm.getStringBounds(text, g).getWidth() / 2;

View File

@@ -8,8 +8,10 @@ package eva2.optimization;
* $Date: 2007-11-16 17:25:09 +0100 (Fri, 16 Nov 2007) $ * $Date: 2007-11-16 17:25:09 +0100 (Fri, 16 Nov 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.optimization.go.InterfaceOptimizationParameters; import eva2.optimization.go.InterfaceOptimizationParameters;
import eva2.optimization.modules.ModuleAdapter; import eva2.optimization.modules.ModuleAdapter;
/** /**
* *
*/ */

View File

@@ -9,9 +9,11 @@ package eva2.optimization;
* $Date: 2007-12-04 15:23:57 +0100 (Tue, 04 Dec 2007) $ * $Date: 2007-12-04 15:23:57 +0100 (Tue, 04 Dec 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.EvAInfo; import eva2.EvAInfo;
import eva2.optimization.go.InterfaceOptimizationParameters; import eva2.optimization.go.InterfaceOptimizationParameters;
import eva2.optimization.modules.ModuleAdapter; import eva2.optimization.modules.ModuleAdapter;
/** /**
* *
*/ */

View File

@@ -10,11 +10,13 @@ package eva2.optimization;
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $ * $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
* $Author: mkron $ * $Author: mkron $
*/ */
import eva2.optimization.go.InterfaceOptimizationParameters; import eva2.optimization.go.InterfaceOptimizationParameters;
import eva2.optimization.modules.GOModuleAdapter; import eva2.optimization.modules.GOModuleAdapter;
import eva2.optimization.modules.ModuleAdapter; import eva2.optimization.modules.ModuleAdapter;
import eva2.tools.EVAERROR; import eva2.tools.EVAERROR;
import eva2.tools.ReflectPackage; import eva2.tools.ReflectPackage;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -5,12 +5,14 @@
package eva2.optimization; package eva2.optimization;
/** /**
*
* @author becker * @author becker
*/ */
public interface OptimizationStateListener { public interface OptimizationStateListener {
void performedStop(); void performedStop();
void performedStart(String infoString); void performedStart(String infoString);
void performedRestart(String infoString); void performedRestart(String infoString);
void updateProgress(final int percent, String msg); void updateProgress(final int percent, String msg);
} }

View File

@@ -33,20 +33,30 @@ public enum PSOTopologyEnum {
/** /**
* A method to translate the "old" integer tags into the enum type. * A method to translate the "old" integer tags into the enum type.
*
* @param oldID * @param oldID
* @return * @return
*/ */
public static PSOTopologyEnum translateOldID(int oldID) { public static PSOTopologyEnum translateOldID(int oldID) {
switch (oldID) { switch (oldID) {
case 0: return linear; case 0:
case 1: return grid; return linear;
case 2: return star; case 1:
case 3: return multiSwarm; return grid;
case 4: return tree; case 2:
case 5: return hpso; return star;
case 6: return random; case 3:
case 7: return dms; return multiSwarm;
default: System.err.println("Error: invalid old topology ID in PSOTopologyEnum translateOldID! Returning grid."); case 4:
return tree;
case 5:
return hpso;
case 6:
return random;
case 7:
return dms;
default:
System.err.println("Error: invalid old topology ID in PSOTopologyEnum translateOldID! Returning grid.");
return grid; return grid;
} }
} }

View File

@@ -20,6 +20,7 @@ import eva2.optimization.strategies.EvolutionStrategies;
import eva2.optimization.strategies.GeneticAlgorithm; import eva2.optimization.strategies.GeneticAlgorithm;
import eva2.optimization.strategies.InterfaceOptimizer; import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.List; import java.awt.List;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@@ -97,7 +98,6 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
/** /**
* This method allows you to get the current GO parameters * This method allows you to get the current GO parameters
*
*/ */
public OptimizationParameters getGOParameters() { public OptimizationParameters getGOParameters() {
return this.m_GO; return this.m_GO;
@@ -192,6 +192,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
this.m_Frame.validate(); this.m_Frame.validate();
this.m_Frame.setVisible(true); this.m_Frame.setVisible(true);
} }
/** /**
* This action listener, called by the "Run/Restart" button, will init the * This action listener, called by the "Run/Restart" button, will init the
* problem and start the computation. * problem and start the computation.
@@ -695,6 +696,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
// public String seedTipText() { // public String seedTipText() {
// return "Choose the seed for the random number generator."; // return "Choose the seed for the random number generator.";
// } // }
/** /**
* This method sets the name of the current experiment as it will occur in * This method sets the name of the current experiment as it will occur in
* the plot legend. * the plot legend.

View File

@@ -9,5 +9,6 @@ package eva2.optimization.go;
*/ */
public interface InterfaceGOStandalone { public interface InterfaceGOStandalone {
void startExperiment(); void startExperiment();
void setShow(boolean t); void setShow(boolean t);
} }

View File

@@ -1,6 +1,7 @@
package eva2.optimization.go; package eva2.optimization.go;
import eva2.optimization.problems.InterfaceAdditionalPopulationInformer; import eva2.optimization.problems.InterfaceAdditionalPopulationInformer;
import java.util.List; import java.util.List;
public interface InterfaceNotifyOnInformers { public interface InterfaceNotifyOnInformers {

View File

@@ -19,63 +19,85 @@ public interface InterfaceOptimizationParameters {
*/ */
// public String globalInfo(); // public String globalInfo();
/** This method allows you to serialize the current parameters into a *.ser file /**
* This method allows you to serialize the current parameters into a *.ser file
*/ */
public void saveInstance(); public void saveInstance();
/** This method returns the name /**
* This method returns the name
*
* @return string * @return string
*/ */
public String getName(); public String getName();
/** This methods allow you to set and get the Seed for the Random Number Generator. /**
* This methods allow you to set and get the Seed for the Random Number Generator.
*
* @param x Long seed. * @param x Long seed.
*/ */
public void setSeed(long x); public void setSeed(long x);
public long getSeed(); public long getSeed();
public String seedTipText(); public String seedTipText();
/** This method allows you to choose a termination criteria for the /**
* This method allows you to choose a termination criteria for the
* evolutionary algorithm. * evolutionary algorithm.
*
* @param term The new terminator * @param term The new terminator
*/ */
public void setTerminator(InterfaceTerminator term); public void setTerminator(InterfaceTerminator term);
public InterfaceTerminator getTerminator(); public InterfaceTerminator getTerminator();
public String terminatorTipText(); public String terminatorTipText();
/** This method allows you to set the current optimizing algorithm /**
* This method allows you to set the current optimizing algorithm
*
* @param optimizer The new optimizing algorithm * @param optimizer The new optimizing algorithm
*/ */
public void setOptimizer(InterfaceOptimizer optimizer); public void setOptimizer(InterfaceOptimizer optimizer);
public InterfaceOptimizer getOptimizer(); public InterfaceOptimizer getOptimizer();
// public String optimizerTipText(); // public String optimizerTipText();
/** This method will set the problem that is to be optimized /**
* This method will set the problem that is to be optimized
*
* @param problem * @param problem
*/ */
public void setProblem(InterfaceOptimizationProblem problem); public void setProblem(InterfaceOptimizationProblem problem);
public InterfaceOptimizationProblem getProblem(); public InterfaceOptimizationProblem getProblem();
public String problemTipText(); public String problemTipText();
/** This method will set the output filename /**
* @param name * This method will set the output filename
* TODO invalidate these! *
* @param name TODO invalidate these!
*/ */
// public void setOutputFileName (String name); // public void setOutputFileName (String name);
// public String getOutputFileName (); // public String getOutputFileName ();
// public String outputFileNameTipText(); // public String outputFileNameTipText();
public InterfacePostProcessParams getPostProcessParams(); public InterfacePostProcessParams getPostProcessParams();
public void setPostProcessParams(InterfacePostProcessParams ppp); public void setPostProcessParams(InterfacePostProcessParams ppp);
public String postProcessParamsTipText(); public String postProcessParamsTipText();
public void setDoPostProcessing(boolean doPP); public void setDoPostProcessing(boolean doPP);
/** /**
* Give an instance which should be informed about elements which are additional informers. * Give an instance which should be informed about elements which are additional informers.
* *
* @see InterfaceAdditionalPopulationInformer
* @param o * @param o
* @see InterfaceAdditionalPopulationInformer
*/ */
public void addInformableInstance(InterfaceNotifyOnInformers o); public void addInformableInstance(InterfaceNotifyOnInformers o);
public boolean removeInformableInstance(InterfaceNotifyOnInformers o); public boolean removeInformableInstance(InterfaceNotifyOnInformers o);
} }

View File

@@ -10,7 +10,9 @@ package eva2.optimization.go;
*/ */
public interface InterfacePopulationChangedEventListener { public interface InterfacePopulationChangedEventListener {
/** This method allows an optimizer to register a change in the optimizer. /**
* This method allows an optimizer to register a change in the optimizer.
*
* @param source The source of the event. * @param source The source of the event.
* @param name Could be used to indicate the nature of the event. * @param name Could be used to indicate the nature of the event.
*/ */

View File

@@ -32,6 +32,7 @@ public interface InterfaceProcessor {
/** /**
* Get Info String about the Optimization. * Get Info String about the Optimization.
*
* @return The info String * @return The info String
*/ */
String getInfoString(); String getInfoString();

View File

@@ -8,7 +8,6 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
* Interface for a termination criterion. * Interface for a termination criterion.
* *
* @author mkron, streiche * @author mkron, streiche
*
*/ */
public interface InterfaceTerminator { public interface InterfaceTerminator {
/** /**
@@ -18,10 +17,13 @@ public interface InterfaceTerminator {
* @return true if the population fulfills the termination criterion, else false * @return true if the population fulfills the termination criterion, else false
*/ */
public boolean isTerminated(PopulationInterface pop); public boolean isTerminated(PopulationInterface pop);
public boolean isTerminated(InterfaceSolutionSet pop); public boolean isTerminated(InterfaceSolutionSet pop);
@Override @Override
public String toString(); public String toString();
public String lastTerminationMessage(); public String lastTerminationMessage();
public void init(InterfaceOptimizationProblem prob); public void init(InterfaceOptimizationProblem prob);
} }

View File

@@ -29,6 +29,7 @@ import eva2.optimization.operator.terminators.EvaluationTerminator;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.optimization.strategies.InterfaceOptimizer; import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.optimization.strategies.IslandModelEA; import eva2.optimization.strategies.IslandModelEA;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.GridLayout; import java.awt.GridLayout;
@@ -62,7 +63,8 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.m_State = new MOCCOState(); this.m_State = new MOCCOState();
} }
/** This method will init the main MOCCO GUI /**
* This method will init the main MOCCO GUI
* frame * frame
*/ */
public void initMOCCOFrame() { public void initMOCCOFrame() {
@@ -113,18 +115,33 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
InterfaceProcessElement tmpP; InterfaceProcessElement tmpP;
while (cont) { while (cont) {
this.m_Iteration++; this.m_Iteration++;
while (m_StillWorking) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (m_StillWorking) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
if (this.m_State.m_OriginalProblem == null) { if (this.m_State.m_OriginalProblem == null) {
this.m_State.m_OriginalProblem = new TF1Problem(); this.m_State.m_OriginalProblem = new TF1Problem();
tmpP = new MOCCOProblemInitialization(this); tmpP = new MOCCOProblemInitialization(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { }} while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
this.m_State.m_CurrentProblem = (InterfaceOptimizationProblem) this.m_State.m_OriginalProblem.clone(); this.m_State.m_CurrentProblem = (InterfaceOptimizationProblem) this.m_State.m_OriginalProblem.clone();
this.m_View.problemChanged(true); this.m_View.problemChanged(true);
this.m_JPanelParameters.removeAll(); this.m_JPanelParameters.removeAll();
tmpP = new MOCCOInitialPopulationSize(this); tmpP = new MOCCOInitialPopulationSize(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { }} while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
this.m_State.m_InitialPopulationSize = Math.max(1, this.m_State.m_InitialPopulationSize); this.m_State.m_InitialPopulationSize = Math.max(1, this.m_State.m_InitialPopulationSize);
Population pop = new Population(); Population pop = new Population();
pop.setTargetSize(this.m_State.m_InitialPopulationSize); pop.setTargetSize(this.m_State.m_InitialPopulationSize);
@@ -138,7 +155,12 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.updateStatus("Analysis/Redefinition", 33); this.updateStatus("Analysis/Redefinition", 33);
tmpP = new MOCCOProblemRedefinition(this); tmpP = new MOCCOProblemRedefinition(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
this.m_State.makeFitnessCache(true); this.m_State.makeFitnessCache(true);
this.m_State.m_CurrentProblem.initializeProblem(); this.m_State.m_CurrentProblem.initializeProblem();
this.m_State.makeBackup(); this.m_State.makeBackup();
@@ -147,70 +169,125 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.updateStatus("MO Strategy Selection", 50); this.updateStatus("MO Strategy Selection", 50);
tmpP = new MOCCOChooseMOStrategy(this); tmpP = new MOCCOChooseMOStrategy(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
switch (((MOCCOChooseMOStrategy) tmpP).getMOStrategy()) { switch (((MOCCOChooseMOStrategy) tmpP).getMOStrategy()) {
case MOCCOChooseMOStrategy.STRATEGY_MOEA: { case MOCCOChooseMOStrategy.STRATEGY_MOEA: {
this.updateStatus("MOEA Parameterization", 75); this.updateStatus("MOEA Parameterization", 75);
tmpP = new MOCCOParameterizeMO(this); tmpP = new MOCCOParameterizeMO(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
case MOCCOChooseMOStrategy.STRATEGY_STEP: { case MOCCOChooseMOStrategy.STRATEGY_STEP: {
this.updateStatus("Reference Solution...", 75); this.updateStatus("Reference Solution...", 75);
tmpP = new MOCCOChooseReferenceSolution(this); tmpP = new MOCCOChooseReferenceSolution(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
AbstractEAIndividual reference = ((MOCCOChooseReferenceSolution) tmpP).getReferenceSolution(); AbstractEAIndividual reference = ((MOCCOChooseReferenceSolution) tmpP).getReferenceSolution();
this.updateStatus("STEP Parameterization...", 90); this.updateStatus("STEP Parameterization...", 90);
tmpP = new MOCCOParameterizeSTEP(this); tmpP = new MOCCOParameterizeSTEP(this);
((MOCCOParameterizeSTEP) tmpP).setReferenceSolution(reference); ((MOCCOParameterizeSTEP) tmpP).setReferenceSolution(reference);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
case MOCCOChooseMOStrategy.STRATEGY_REFP: { case MOCCOChooseMOStrategy.STRATEGY_REFP: {
this.updateStatus("Reference Point...", 75); this.updateStatus("Reference Point...", 75);
tmpP = new MOCCOChooseReferencePoint(this); tmpP = new MOCCOChooseReferencePoint(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
double[] reference = ((MOCCOChooseReferencePoint) tmpP).getReferencePoint(); double[] reference = ((MOCCOChooseReferencePoint) tmpP).getReferencePoint();
this.updateStatus("Reference Point Parameterization...", 90); this.updateStatus("Reference Point Parameterization...", 90);
tmpP = new MOCCOParameterizeRefPoint(this); tmpP = new MOCCOParameterizeRefPoint(this);
((MOCCOParameterizeRefPoint) tmpP).setReferencePoint(reference); ((MOCCOParameterizeRefPoint) tmpP).setReferencePoint(reference);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
case MOCCOChooseMOStrategy.STRATEGY_TBCH: { case MOCCOChooseMOStrategy.STRATEGY_TBCH: {
this.updateStatus("Reference Point...", 75); this.updateStatus("Reference Point...", 75);
tmpP = new MOCCOChooseReferencePoint(this); tmpP = new MOCCOChooseReferencePoint(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
double[] reference = ((MOCCOChooseReferencePoint) tmpP).getReferencePoint(); double[] reference = ((MOCCOChooseReferencePoint) tmpP).getReferencePoint();
this.updateStatus("Tchebycheff Method Parameterization...", 90); this.updateStatus("Tchebycheff Method Parameterization...", 90);
tmpP = new MOCCOParameterizeTchebycheff(this); tmpP = new MOCCOParameterizeTchebycheff(this);
((MOCCOParameterizeTchebycheff) tmpP).setReferencePoint(reference); ((MOCCOParameterizeTchebycheff) tmpP).setReferencePoint(reference);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
case MOCCOChooseMOStrategy.STRATEGY_GDF: { case MOCCOChooseMOStrategy.STRATEGY_GDF: {
this.updateStatus("Reference Solution...", 75); this.updateStatus("Reference Solution...", 75);
tmpP = new MOCCOChooseReferenceSolution(this); tmpP = new MOCCOChooseReferenceSolution(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
AbstractEAIndividual reference = ((MOCCOChooseReferenceSolution) tmpP).getReferenceSolution(); AbstractEAIndividual reference = ((MOCCOChooseReferenceSolution) tmpP).getReferenceSolution();
this.updateStatus("Geoffrion-Dyer-Feinberg Method Parameterization...", 90); this.updateStatus("Geoffrion-Dyer-Feinberg Method Parameterization...", 90);
tmpP = new MOCCOParameterizeGDF(this); tmpP = new MOCCOParameterizeGDF(this);
((MOCCOParameterizeGDF) tmpP).setReferenceSolution(reference); ((MOCCOParameterizeGDF) tmpP).setReferenceSolution(reference);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
default: { default: {
tmpP = new MOCCOParameterizeMO(this); tmpP = new MOCCOParameterizeMO(this);
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
break; break;
} }
} }
@@ -218,7 +295,12 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.updateStatus("SO-Optimizer Parameterization", 66); this.updateStatus("SO-Optimizer Parameterization", 66);
tmpP = new MOCCOParameterizeSO(this); tmpP = new MOCCOParameterizeSO(this);
tmpP.initProcessElementParametrization(); tmpP.initProcessElementParametrization();
while (!tmpP.isFinished()) { try { Thread.sleep(1000); } catch (java.lang.InterruptedException e) { } } while (!tmpP.isFinished()) {
try {
Thread.sleep(1000);
} catch (java.lang.InterruptedException e) {
}
}
} }
// now optimize // now optimize
this.updateStatus("Optimizing...", 0); this.updateStatus("Optimizing...", 0);
@@ -231,23 +313,20 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
System.out.print("Original Problem is "); System.out.print("Original Problem is ");
if (this.m_State.m_OriginalProblem.isMultiObjective()) { if (this.m_State.m_OriginalProblem.isMultiObjective()) {
System.out.println("multi-objective."); System.out.println("multi-objective.");
} } else {
else {
System.out.println("single-objective."); System.out.println("single-objective.");
} }
System.out.print("Current Problem is "); System.out.print("Current Problem is ");
if (this.m_State.m_CurrentProblem.isMultiObjective()) { if (this.m_State.m_CurrentProblem.isMultiObjective()) {
System.out.println("multi-objective."); System.out.println("multi-objective.");
} } else {
else {
System.out.println("single-objective."); System.out.println("single-objective.");
} }
if (this.m_State.m_BackupProblem != null) { if (this.m_State.m_BackupProblem != null) {
System.out.print("Backup Problem is "); System.out.print("Backup Problem is ");
if (this.m_State.m_BackupProblem.isMultiObjective()) { if (this.m_State.m_BackupProblem.isMultiObjective()) {
System.out.println("multi-objective."); System.out.println("multi-objective.");
} } else {
else {
System.out.println("single-objective."); System.out.println("single-objective.");
} }
} else { } else {
@@ -318,7 +397,8 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
} }
}*/ }*/
/** This is the main method /**
* This is the main method
* *
* @param args * @param args
*/ */
@@ -347,7 +427,9 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
} }
} }
/** This methods loads the current state of MOCO from a serialized file /**
* This methods loads the current state of MOCO from a serialized file
*
* @param loadFrom The name of the serialized file * @param loadFrom The name of the serialized file
* @return The new state of MOCO * @return The new state of MOCO
*/ */
@@ -359,19 +441,21 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
oi.close(); oi.close();
if (!(obj instanceof MOCCOState)) { if (!(obj instanceof MOCCOState)) {
throw new Exception("Object not of type MOCCOState"); throw new Exception("Object not of type MOCCOState");
} return obj; }
return obj;
} catch (Exception ex) { } catch (Exception ex) {
if (this.m_JFrame != null) { if (this.m_JFrame != null) {
JOptionPane.showMessageDialog(this.m_JFrame, "Couldn't read object: " + selected.getName() + "\n" + ex.getMessage(), "Open object file", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this.m_JFrame, "Couldn't read object: " + selected.getName() + "\n" + ex.getMessage(), "Open object file", JOptionPane.ERROR_MESSAGE);
} } else {
else {
System.out.println("Couldn't read object: " + selected.getName() + "\n" + ex.getMessage()); System.out.println("Couldn't read object: " + selected.getName() + "\n" + ex.getMessage());
} }
} }
return null; return null;
} }
/** This method saves the current MOCOData into a serialized file /**
* This method saves the current MOCOData into a serialized file
*
* @param saveAs The name of the outputfile * @param saveAs The name of the outputfile
*/ */
public void saveObject(String saveAs) { public void saveObject(String saveAs) {
@@ -383,8 +467,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
} catch (Exception ex) { } catch (Exception ex) {
if (this.m_JFrame != null) { if (this.m_JFrame != null) {
JOptionPane.showMessageDialog(this.m_JFrame, "Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage(), "Save object", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this.m_JFrame, "Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage(), "Save object", JOptionPane.ERROR_MESSAGE);
} } else {
else {
System.out.println("Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage()); System.out.println("Couldn't write to file: " + sFile.getName() + "\n" + ex.getMessage());
} }
} }
@@ -394,7 +477,8 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
* InterfaceGOStandalone * InterfaceGOStandalone
*/ */
/** This method starts the actual optimization procedure /**
* This method starts the actual optimization procedure
*/ */
@Override @Override
public void startExperiment() { public void startExperiment() {
@@ -416,6 +500,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
public Object construct() { public Object construct() {
return doWork(); return doWork();
} }
@Override @Override
public void finished() { public void finished() {
Population[] pop = null; Population[] pop = null;
@@ -444,7 +529,8 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
worker.start(); worker.start();
} }
/** When the worker needs to update the GUI we do so by queuing /**
* When the worker needs to update the GUI we do so by queuing
* a Runnable for the event dispatching thread with * a Runnable for the event dispatching thread with
* SwingUtilities.invokeLater(). In this case we're just * SwingUtilities.invokeLater(). In this case we're just
* changing the progress bars value. * changing the progress bars value.
@@ -462,7 +548,8 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.m_CurrentState.setText(t); this.m_CurrentState.setText(t);
} }
/** This method represents the application code that we'd like to /**
* This method represents the application code that we'd like to
* run on a separate thread. It simulates slowly computing * run on a separate thread. It simulates slowly computing
* a value, in this case just a string 'All Done'. It updates the * a value, in this case just a string 'All Done'. It updates the
* progress bar every half second to remind the user that * progress bar every half second to remind the user that
@@ -480,8 +567,7 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
this.m_State.m_Optimizer.optimize(); this.m_State.m_Optimizer.optimize();
} }
System.gc(); System.gc();
} } catch (InterruptedException e) {
catch (InterruptedException e) {
updateStatus("Interrupted", 0); updateStatus("Interrupted", 0);
return "Interrupted"; return "Interrupted";
} }
@@ -497,7 +583,9 @@ public class MOCCOStandalone implements InterfaceGOStandalone, InterfacePopulati
/*********************************************************************************************** /***********************************************************************************************
* InterfacePopulationChangedEventListener * InterfacePopulationChangedEventListener
*/ */
/** This method allows an optimizer to register a change in the optimizer. /**
* This method allows an optimizer to register a change in the optimizer.
*
* @param source The source of the event. * @param source The source of the event.
* @param name Could be used to indicate the nature of the event. * @param name Could be used to indicate the nature of the event.
*/ */

View File

@@ -1,4 +1,5 @@
package eva2.optimization.go; package eva2.optimization.go;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
/** /**
@@ -6,11 +7,11 @@ import javax.swing.SwingUtilities;
* SwingWorker 3), an abstract class that you subclass to * SwingWorker 3), an abstract class that you subclass to
* perform GUI-related work in a dedicated thread. For * perform GUI-related work in a dedicated thread. For
* instructions on using this class, see: * instructions on using this class, see:
* * <p/>
* http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html * http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
* or * or
* http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html * http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html
* * <p/>
* Note that the API changed slightly in the 3rd version: * Note that the API changed slightly in the 3rd version:
* You must now invoke start() on the SwingWorker after * You must now invoke start() on the SwingWorker after
* creating it. * creating it.
@@ -26,9 +27,18 @@ public abstract class SwingWorker {
*/ */
private static class ThreadVar { private static class ThreadVar {
private Thread thread; private Thread thread;
ThreadVar(Thread t) { thread = t; }
synchronized Thread get() { return thread; } ThreadVar(Thread t) {
synchronized void clear() { thread = null; } thread = t;
}
synchronized Thread get() {
return thread;
}
synchronized void clear() {
thread = null;
}
} }
private ThreadVar threadVar; private ThreadVar threadVar;
@@ -75,8 +85,7 @@ public abstract class SwingWorker {
} }
try { try {
t.join(); t.join();
} } catch (InterruptedException e) {
catch (InterruptedException e) {
Thread.currentThread().interrupt(); // propagate Thread.currentThread().interrupt(); // propagate
return null; return null;
} }
@@ -90,7 +99,9 @@ public abstract class SwingWorker {
public SwingWorker() { public SwingWorker() {
final Runnable doFinished = new Runnable() { final Runnable doFinished = new Runnable() {
@Override @Override
public void run() { finished(); } public void run() {
finished();
}
}; };
Runnable doConstruct = new Runnable() { Runnable doConstruct = new Runnable() {
@@ -98,8 +109,7 @@ public abstract class SwingWorker {
public void run() { public void run() {
try { try {
setValue(construct()); setValue(construct());
} } finally {
finally {
threadVar.clear(); threadVar.clear();
} }

View File

@@ -14,9 +14,11 @@ import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR; import eva2.tools.EVAERROR;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.*; import java.util.*;
/** This is the abstract EA individual implementing the most important methods giving /**
* This is the abstract EA individual implementing the most important methods giving
* access to mutation and crossover rates and operators, fitness values and selection * access to mutation and crossover rates and operators, fitness values and selection
* probabilities. All EA individuals should typically extend this abstract EA individual. * probabilities. All EA individuals should typically extend this abstract EA individual.
* In that case the EA individuals only implement the genotype and phenotype interfaces. * In that case the EA individuals only implement the genotype and phenotype interfaces.
@@ -249,6 +251,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
// public String getIndividualName() { // public String getIndividualName() {
// return this.m_Name; // return this.m_Name;
// } // }
/** /**
* This method is used when a new offspring is created the increment the * This method is used when a new offspring is created the increment the
* name. * name.
@@ -307,6 +310,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
// return false; // return false;
// } // }
// } // }
/** /**
* This method will allow a default initialisation of the individual * This method will allow a default initialisation of the individual
* *
@@ -385,6 +389,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
// public void setLogHeritagetLen(int logLen) { // public void setLogHeritagetLen(int logLen) {
// logParentLen = logLen; // logParentLen = logLen;
// } // }
/** /**
* Add an ancestor generation with multiple parents. * Add an ancestor generation with multiple parents.
* *
@@ -446,6 +451,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
// heritage.add(parentIDs); // heritage.add(parentIDs);
//// if (heritage.size() > logParentLen) heritage.remove(0); //// if (heritage.size() > logParentLen) heritage.remove(0);
// } // }
/** /**
* Add an ancestor generation with only one parent. * Add an ancestor generation with only one parent.
* *
@@ -468,6 +474,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
// if (heritage != null) return heritage.getLast(); // if (heritage != null) return heritage.getLast();
// else return null; // else return null;
// } // }
/** /**
* This method will allow you to get the current age of an individual Zero * This method will allow you to get the current age of an individual Zero
* means it has not even been evaluated. * means it has not even been evaluated.
@@ -1286,7 +1293,6 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
/** /**
* @return true if parent history logging is activated * @return true if parent history logging is activated
*
*/ */
protected boolean isLogParents() { protected boolean isLogParents() {
return logParents; return logParents;

View File

@@ -16,9 +16,8 @@ import java.util.Comparator;
* the comparison is based on those. This may be used to access alternative (e.g. older or * the comparison is based on those. This may be used to access alternative (e.g. older or
* best-so-far fitness values) for individual comparison. * best-so-far fitness values) for individual comparison.
* *
* @see #AbstractEAIndividual().isDominatingFitness(double[], double[])
* @author mkron * @author mkron
* * @see #AbstractEAIndividual().isDominatingFitness(double[], double[])
*/ */
public class AbstractEAIndividualComparator implements Comparator<Object>, Serializable { public class AbstractEAIndividualComparator implements Comparator<Object>, Serializable {
// flag whether a data field should be used. // flag whether a data field should be used.
@@ -30,7 +29,6 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
* Comparator implementation which compares two individuals based on their fitness. * Comparator implementation which compares two individuals based on their fitness.
* The default version calls compares based on dominance with priority of feasibility if there are constraints. * The default version calls compares based on dominance with priority of feasibility if there are constraints.
* It assigns -1 if first is better, 1 if second is better, 0 if the two ind.s are not comparable. * It assigns -1 if first is better, 1 if second is better, 0 if the two ind.s are not comparable.
*
*/ */
public AbstractEAIndividualComparator() { public AbstractEAIndividualComparator() {
this("", -1, true); this("", -1, true);
@@ -92,11 +90,11 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
/** /**
* Generic constructor. * Generic constructor.
* *
* @see #AbstractEAIndividualComparator(int)
* @see #AbstractEAIndividualComparator(String)
* @param indyDataKey * @param indyDataKey
* @param fitnessCriterion * @param fitnessCriterion
* @param priorizeConstraints * @param priorizeConstraints
* @see #AbstractEAIndividualComparator(int)
* @see #AbstractEAIndividualComparator(String)
*/ */
public AbstractEAIndividualComparator(String indDataKey, int fitnessCriterion, boolean preferFeasible) { public AbstractEAIndividualComparator(String indDataKey, int fitnessCriterion, boolean preferFeasible) {
this.indyDataKey = indDataKey; this.indyDataKey = indDataKey;
@@ -131,8 +129,7 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
int constrViolComp = ((AbstractEAIndividual) o1).compareConstraintViolation((AbstractEAIndividual) o2); int constrViolComp = ((AbstractEAIndividual) o1).compareConstraintViolation((AbstractEAIndividual) o2);
if (constrViolComp > 0) { if (constrViolComp > 0) {
return -1; return -1;
} } else if (constrViolComp < 0) {
else if (constrViolComp < 0) {
return 1; return 1;
} }
// otherwise both do not violate, so regard fitness // otherwise both do not violate, so regard fitness
@@ -149,8 +146,7 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
} else { } else {
if (fit1[fitCriterion] == fit2[fitCriterion]) { if (fit1[fitCriterion] == fit2[fitCriterion]) {
return 0; return 0;
} } else {
else {
return (fit1[fitCriterion] < fit2[fitCriterion]) ? -1 : 1; return (fit1[fitCriterion] < fit2[fitCriterion]) ? -1 : 1;
} }
} }
@@ -176,9 +172,11 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
public String getIndyDataKey() { public String getIndyDataKey() {
return indyDataKey; return indyDataKey;
} }
public void setIndyDataKey(String indyDataKey) { public void setIndyDataKey(String indyDataKey) {
this.indyDataKey = indyDataKey; this.indyDataKey = indyDataKey;
} }
public String indyDataKeyTipText() { public String indyDataKeyTipText() {
return "A String can be given which retrievies individual properties based on which the comparison is performed."; return "A String can be given which retrievies individual properties based on which the comparison is performed.";
} }
@@ -186,9 +184,11 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
public int getFitCriterion() { public int getFitCriterion() {
return fitCriterion; return fitCriterion;
} }
public void setFitCriterion(int fitCriterion) { public void setFitCriterion(int fitCriterion) {
this.fitCriterion = fitCriterion; this.fitCriterion = fitCriterion;
} }
public String fitCriterionTipText() { public String fitCriterionTipText() {
return "If -1, dominance is used, otherwise the indexed fitness criterion (for multiobjective problems)"; return "If -1, dominance is used, otherwise the indexed fitness criterion (for multiobjective problems)";
} }
@@ -196,9 +196,11 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
public boolean isPreferFeasible() { public boolean isPreferFeasible() {
return preferFeasible; return preferFeasible;
} }
public void setPreferFeasible(boolean priorConst) { public void setPreferFeasible(boolean priorConst) {
preferFeasible = priorConst; preferFeasible = priorConst;
} }
public String preferFeasibleTipText() { public String preferFeasibleTipText() {
return "Activate preference of feasible individuals in any comparison acc. to Deb's rules."; return "Activate preference of feasible individuals in any comparison acc. to Deb's rules.";
} }
@@ -206,6 +208,7 @@ public class AbstractEAIndividualComparator implements Comparator<Object>, Seria
public static String globalInfo() { public static String globalInfo() {
return "A comparator class for general EA individuals. Compares individuals based on their fitness in context of minimization."; return "A comparator class for general EA individuals. Compares individuals based on their fitness in context of minimization.";
} }
public String getName() { public String getName() {
return "IndividualComparator"; return "IndividualComparator";
} }

View File

@@ -6,10 +6,12 @@ import eva2.optimization.operator.mutation.MutateESGlobal;
import eva2.optimization.problems.InterfaceHasInitRange; import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.BitSet; import java.util.BitSet;
/** This individual uses a real-valued genotype to code for binary values, either /**
* This individual uses a real-valued genotype to code for binary values, either
* by using a threshold value of by interpreting the double value as probability. * by using a threshold value of by interpreting the double value as probability.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
@@ -70,7 +72,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return (Object) new ESIndividualBinaryData(this); return (Object) new ESIndividualBinaryData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -104,7 +108,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeBinary methods * InterfaceDataTypeBinary methods
*/ */
/** This method allows you to request a certain amount of binary data /**
* This method allows you to request a certain amount of binary data
*
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override @Override
@@ -117,7 +123,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
} }
} }
/** This method returns the length of the binary data set /**
* This method returns the length of the binary data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -125,7 +133,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Genotype.length; return this.m_Genotype.length;
} }
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -152,8 +162,10 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the binary data without /**
* This method allows you to read the binary data without
* an update from the genotype * an update from the genotype
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -161,15 +173,20 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the binary data. /**
* This method allows you to set the binary data.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
public void SetBinaryPhenotype(BitSet binaryData) { public void SetBinaryPhenotype(BitSet binaryData) {
this.m_Phenotype = binaryData; this.m_Phenotype = binaryData;
} }
/** This method allows you to set the binary data, this can be used for
/**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -179,15 +196,13 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
if (this.m_UseHardSwitch) { if (this.m_UseHardSwitch) {
if (binaryData.get(i)) { if (binaryData.get(i)) {
this.m_Genotype[i] = RNG.randomDouble(0.55, 1.0); this.m_Genotype[i] = RNG.randomDouble(0.55, 1.0);
} } else {
else {
this.m_Genotype[i] = RNG.randomDouble(0.0, 0.45); this.m_Genotype[i] = RNG.randomDouble(0.0, 0.45);
} }
} else { } else {
if (binaryData.get(i)) { if (binaryData.get(i)) {
this.m_Genotype[i] = 0.9; this.m_Genotype[i] = 0.9;
} } else {
else {
this.m_Genotype[i] = 0.1; this.m_Genotype[i] = 0.1;
} }
} }
@@ -197,8 +212,10 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -215,8 +232,10 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -244,7 +263,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
* InterfaceESIndividual methods * InterfaceESIndividual methods
*/ */
/** This method will allow the user to read the ES 'genotype' /**
* This method will allow the user to read the ES 'genotype'
*
* @return BitSet * @return BitSet
*/ */
@Override @Override
@@ -252,7 +273,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Genotype; return this.m_Genotype;
} }
/** This method will allow the user to set the current ES 'genotype'. /**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override @Override
@@ -277,7 +300,9 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
// this.m_Range = range; // this.m_Range = range;
// } // }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -285,7 +310,8 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Range; return this.m_Range;
} }
/** This method performs a simple one element mutation on the double vector /**
* This method performs a simple one element mutation on the double vector
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -296,16 +322,17 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) { if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
ESIndividualDoubleData.defaultInit(m_Genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange()); ESIndividualDoubleData.defaultInit(m_Genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange());
} } else {
else {
ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
} }
} }
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -313,23 +340,29 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
return "ES individual"; return "ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is an ES individual adopted to optimize binary values."; return "This is an ES individual adopted to optimize binary values.";
} }
/** This method will toggle between genotype interpretation as bit probability and /**
* This method will toggle between genotype interpretation as bit probability and
* fixed switch. * fixed switch.
*
* @param b the Switch. * @param b the Switch.
*/ */
public void setToggleInterpretation(boolean b) { public void setToggleInterpretation(boolean b) {
this.m_UseHardSwitch = b; this.m_UseHardSwitch = b;
} }
public boolean getToggleInterpretation() { public boolean getToggleInterpretation() {
return this.m_UseHardSwitch; return this.m_UseHardSwitch;
} }
public String toggleInterpretationTipText() { public String toggleInterpretationTipText() {
return "Toggle between interpretation as probability or if(>0.5)."; return "Toggle between interpretation as probability or if(>0.5).";
} }

View File

@@ -11,7 +11,8 @@ import eva2.tools.EVAERROR;
import eva2.tools.math.Mathematics; import eva2.tools.math.Mathematics;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual uses a real-valued genotype to code for double values. /**
* This individual uses a real-valued genotype to code for double values.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 24.03.2003 * Date: 24.03.2003
@@ -71,7 +72,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
return (Object) new ESIndividualDoubleData(this); return (Object) new ESIndividualDoubleData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -111,7 +114,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeDouble methods * InterfaceDataTypeDouble methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -145,7 +150,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
// } // }
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -153,9 +160,11 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Genotype.length; return this.m_Genotype.length;
} }
/** This method will set the range of the double attributes. If range.length /**
* This method will set the range of the double attributes. If range.length
* does not equal doubledata.length only range[i] will be used to set all * does not equal doubledata.length only range[i] will be used to set all
* ranges. * ranges.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -170,7 +179,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -178,8 +189,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Range; return this.m_Range;
} }
/** This method allows you to read the double data. A new phenotype array is allocated /**
* This method allows you to read the double data. A new phenotype array is allocated
* and the genotype copied. * and the genotype copied.
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -188,8 +201,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
// it should now be save to only perform the copy if the phenotype is null // it should now be save to only perform the copy if the phenotype is null
if (this.m_Phenotype != null) { if (this.m_Phenotype != null) {
return m_Phenotype; return m_Phenotype;
} } else {
else {
this.m_Phenotype = new double[this.m_Genotype.length]; this.m_Phenotype = new double[this.m_Genotype.length];
System.arraycopy(this.m_Genotype, 0, this.m_Phenotype, 0, this.m_Genotype.length); System.arraycopy(this.m_Genotype, 0, this.m_Phenotype, 0, this.m_Genotype.length);
return this.m_Phenotype; return this.m_Phenotype;
@@ -199,20 +211,22 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/** /**
* This method allows you to read the double data without * This method allows you to read the double data without
* an update from the genotype. * an update from the genotype.
*
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override @Override
public double[] getDoubleDataWithoutUpdate() { public double[] getDoubleDataWithoutUpdate() {
if (m_Phenotype == null) { if (m_Phenotype == null) {
return getDoubleData(); return getDoubleData();
} } else {
else {
return this.m_Phenotype; return this.m_Phenotype;
} }
} }
/** This method allows you to set the phenotype double data. To change the genotype, /**
* This method allows you to set the phenotype double data. To change the genotype,
* use SetDoubleDataLamarckian(). * use SetDoubleDataLamarckian().
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -220,8 +234,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
/** This method allows you to set the genotype data, this can be used for /**
* This method allows you to set the genotype data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -235,7 +251,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will allow a default initialisation of the individual /**
* This method will allow a default initialisation of the individual
*
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override @Override
@@ -247,8 +265,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
} }
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -268,8 +288,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -298,7 +320,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* InterfaceESIndividual methods * InterfaceESIndividual methods
*/ */
/** This method will allow the user to read the ES 'genotype' /**
* This method will allow the user to read the ES 'genotype'
*
* @return BitSet * @return BitSet
*/ */
@Override @Override
@@ -306,7 +330,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Genotype; return this.m_Genotype;
} }
/** This method will allow the user to set the current ES 'genotype'. /**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override @Override
@@ -323,7 +349,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
} }
/** This method will allow the user to set the current ES 'genotype'. /**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
public void SetDGenotypeNocheck(double[] b) { public void SetDGenotypeNocheck(double[] b) {
@@ -331,7 +359,8 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
this.m_Genotype = b; this.m_Genotype = b;
} }
/** This method performs a simple one element mutation on the double vector /**
* This method performs a simple one element mutation on the double vector
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -362,8 +391,7 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
public void defaultInit(InterfaceOptimizationProblem prob) { public void defaultInit(InterfaceOptimizationProblem prob) {
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) { if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
ESIndividualDoubleData.defaultInit(m_Genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange()); ESIndividualDoubleData.defaultInit(m_Genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange());
} } else {
else {
ESIndividualDoubleData.defaultInit(m_Genotype, m_Range); ESIndividualDoubleData.defaultInit(m_Genotype, m_Range);
} }
m_Phenotype = null; // mark as invalid m_Phenotype = null; // mark as invalid
@@ -385,8 +413,10 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -394,7 +424,9 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
return "ES individual"; return "ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {

View File

@@ -7,7 +7,8 @@ import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual uses a real-valued genotype to code for integer values. /**
* This individual uses a real-valued genotype to code for integer values.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 15.04.2004 * Date: 15.04.2004
@@ -66,7 +67,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return (Object) new ESIndividualIntegerData(this); return (Object) new ESIndividualIntegerData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -100,7 +103,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeInteger methods * InterfaceDataTypeInteger methods
*/ */
/** This method allows you to request a certain amount of int data /**
* This method allows you to request a certain amount of int data
*
* @param length The lenght of the int[] that is to be optimized * @param length The lenght of the int[] that is to be optimized
*/ */
@Override @Override
@@ -125,7 +130,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Range = newRange; this.m_Range = newRange;
} }
/** This method returns the length of the int data set /**
* This method returns the length of the int data set
*
* @return The number of ints stored * @return The number of ints stored
*/ */
@Override @Override
@@ -133,9 +140,11 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Genotype.length; return this.m_Genotype.length;
} }
/** This method will set the range of the int attributes. If range.length /**
* This method will set the range of the int attributes. If range.length
* does not equal intdata.length only range[i] will be used to set all * does not equal intdata.length only range[i] will be used to set all
* ranges. * ranges.
*
* @param range The new range for the int data. * @param range The new range for the int data.
*/ */
@Override @Override
@@ -150,7 +159,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
} }
} }
/** This method will return the range for all int attributes. /**
* This method will return the range for all int attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -158,7 +169,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Range; return this.m_Range;
} }
/** This method allows you to read the int data /**
* This method allows you to read the int data
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -176,8 +189,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the int data without /**
* This method allows you to read the int data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -185,7 +200,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the int data. /**
* This method allows you to set the int data.
*
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override @Override
@@ -193,8 +210,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Phenotype = intData; this.m_Phenotype = intData;
} }
/** This method allows you to set the int data, this can be used for /**
* This method allows you to set the int data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override @Override
@@ -209,8 +228,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -230,8 +251,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -258,7 +281,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceESIndividual methods * InterfaceESIndividual methods
*/ */
/** This method will allow the user to read the ES 'genotype' /**
* This method will allow the user to read the ES 'genotype'
*
* @return BitSet * @return BitSet
*/ */
@Override @Override
@@ -266,7 +291,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Genotype; return this.m_Genotype;
} }
/** This method will allow the user to set the current ES 'genotype'. /**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override @Override
@@ -282,7 +309,8 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
} }
} }
/** This method performs a simple one element mutation on the double vector /**
* This method performs a simple one element mutation on the double vector
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -296,7 +324,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
} }
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -322,8 +352,10 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -331,7 +363,9 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
return "ES individual"; return "ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {

View File

@@ -84,7 +84,9 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return (Object) new ESIndividualPermutationData(this); return (Object) new ESIndividualPermutationData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -118,7 +120,8 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
} }
/************************************************************************************ /**
* *********************************************************************************
* InterfaceDataTypePermutation methods * InterfaceDataTypePermutation methods
*/ */
@@ -221,8 +224,10 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the permutation data without /**
* This method allows you to read the permutation data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the permutation. * @return int[] representing the permutation.
*/ */
@Override @Override
@@ -233,6 +238,7 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
public int[] getFirstindex() { public int[] getFirstindex() {
return firstindex; return firstindex;
} }
@Override @Override
public void setFirstindex(int[] firstindex) { public void setFirstindex(int[] firstindex) {
this.firstindex = firstindex; this.firstindex = firstindex;
@@ -242,8 +248,10 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -263,8 +271,10 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -291,7 +301,9 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/************************************************************************************ /************************************************************************************
* InterfaceESIndividual methods * InterfaceESIndividual methods
*/ */
/** This method will allow the user to read the ES 'genotype' /**
* This method will allow the user to read the ES 'genotype'
*
* @return BitSet * @return BitSet
*/ */
@Override @Override
@@ -330,7 +342,9 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return matrix; return matrix;
} }
/** This method will allow the user to set the current ES 'genotype'. /**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override @Override
@@ -350,7 +364,8 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
/** This method performs a one element mutation on every permutation coded by a double vector. /**
* This method performs a one element mutation on every permutation coded by a double vector.
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -371,7 +386,9 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
} }
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -395,8 +412,10 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -404,7 +423,9 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
return "ES individual"; return "ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {

View File

@@ -5,9 +5,11 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.population.Population; import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.BitSet; import java.util.BitSet;
/** This individual combines a binary and a real-valued phenotype. /**
* This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 13.05.2003 * Date: 13.05.2003
@@ -52,7 +54,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return (Object) new GAESIndividualBinaryDoubleData(this); return (Object) new GAESIndividualBinaryDoubleData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -72,7 +76,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
} }
} }
/** This method will allow a default initialisation of the individual /**
* This method will allow a default initialisation of the individual
*
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override @Override
@@ -87,8 +93,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
((AbstractEAIndividual) this.m_BitSet).defaultInit(prob); ((AbstractEAIndividual) this.m_BitSet).defaultInit(prob);
} }
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -109,7 +117,8 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
} }
} }
/** This method will mutate the individual randomly /**
* This method will mutate the individual randomly
*/ */
@Override @Override
public void mutate() { public void mutate() {
@@ -127,8 +136,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
((AbstractEAIndividual) this.m_BitSet).defaultMutate(); ((AbstractEAIndividual) this.m_BitSet).defaultMutate();
} }
/** This method will mate the Individual with given other individuals /**
* This method will mate the Individual with given other individuals
* of the same type. * of the same type.
*
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@@ -189,8 +200,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return result; return result;
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -201,10 +214,12 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return result; return result;
} }
/********************************************************************************************************************** /**
* *******************************************************************************************************************
* These are for InterfaceDataTypeDouble * These are for InterfaceDataTypeDouble
* <p/>
/** This method allows you to request a certain amount of double data * /** This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -213,7 +228,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_BitSet.setBinaryDataLength(length); this.m_BitSet.setBinaryDataLength(length);
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -221,9 +238,11 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_Numbers.size(); return this.m_Numbers.size();
} }
/** This method will set the range of the double attributes. /**
* This method will set the range of the double attributes.
* Note: range[d][0] gives the lower bound and range[d] gives the upper bound * Note: range[d][0] gives the lower bound and range[d] gives the upper bound
* for dimension d. * for dimension d.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -231,7 +250,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_Numbers.SetDoubleRange(range); this.m_Numbers.SetDoubleRange(range);
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -239,7 +260,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_Numbers.getDoubleRange(); return this.m_Numbers.getDoubleRange();
} }
/** This method allows you to read the double data /**
* This method allows you to read the double data
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -247,8 +270,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_Numbers.getDoubleData(); return this.m_Numbers.getDoubleData();
} }
/** This method allows you to read the double data without /**
* This method allows you to read the double data without
* an update from the genotype * an update from the genotype
*
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override @Override
@@ -256,7 +281,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_Numbers.getDoubleDataWithoutUpdate(); return this.m_Numbers.getDoubleDataWithoutUpdate();
} }
/** This method allows you to set the double data. /**
* This method allows you to set the double data.
*
* @param doubleData The new double data. * @param doubleData The new double data.
* @see InterfaceDataTypeDouble.SetDoubleData() * @see InterfaceDataTypeDouble.SetDoubleData()
*/ */
@@ -265,8 +292,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_Numbers.SetDoublePhenotype(doubleData); this.m_Numbers.SetDoublePhenotype(doubleData);
} }
/** This method allows you to set the double data, this can be used for /**
* This method allows you to set the double data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
* @see InterfaceDataTypeDouble.SetDoubleDataLamarckian() * @see InterfaceDataTypeDouble.SetDoubleDataLamarckian()
*/ */
@@ -275,10 +304,12 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_Numbers.SetDoubleGenotype(doubleData); this.m_Numbers.SetDoubleGenotype(doubleData);
} }
/********************************************************************************************************************** /**
* *******************************************************************************************************************
* These are for InterfaceDataTypeBinary * These are for InterfaceDataTypeBinary
* <p/>
/** This method allows you to request a certain amount of binary data * /** This method allows you to request a certain amount of binary data
*
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override @Override
@@ -287,14 +318,18 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_BitSet.setBinaryDataLength(length); this.m_BitSet.setBinaryDataLength(length);
} }
/** This method returns the length of the binary data set /**
* This method returns the length of the binary data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
public int GetBinaryDataLength() { public int GetBinaryDataLength() {
return this.m_BitSet.size(); return this.m_BitSet.size();
} }
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -302,8 +337,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_BitSet.getBinaryData(); return this.m_BitSet.getBinaryData();
} }
/** This method allows you to read the binary data without /**
* This method allows you to read the binary data without
* an update from the genotype * an update from the genotype
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -311,7 +348,9 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return this.m_BitSet.getBinaryDataWithoutUpdate(); return this.m_BitSet.getBinaryDataWithoutUpdate();
} }
/** This method allows you to set the binary data. /**
* This method allows you to set the binary data.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
* @see InterfaceDataTypeBinary.SetBinaryData() * @see InterfaceDataTypeBinary.SetBinaryData()
*/ */
@@ -320,8 +359,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
this.m_BitSet.SetBinaryPhenotype(binaryData); this.m_BitSet.SetBinaryPhenotype(binaryData);
} }
/** This method allows you to set the binary data, this can be used for /**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
* @see InterfaceBinaryData.SetBinaryDataLamarckian() * @see InterfaceBinaryData.SetBinaryDataLamarckian()
*/ */
@@ -333,8 +374,10 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -342,34 +385,45 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
return "GA/ES individual"; return "GA/ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a mixed data type combining a BitSet and a real-valued vector."; return "This is a mixed data type combining a BitSet and a real-valued vector.";
} }
/** This method will allow you to set the inner constants /**
* This method will allow you to set the inner constants
*
* @param Numbers The new representation for the inner constants. * @param Numbers The new representation for the inner constants.
*/ */
public void setNumbers(InterfaceDataTypeDouble Numbers) { public void setNumbers(InterfaceDataTypeDouble Numbers) {
this.m_Numbers = Numbers; this.m_Numbers = Numbers;
} }
public InterfaceDataTypeDouble getNumbers() { public InterfaceDataTypeDouble getNumbers() {
return this.m_Numbers; return this.m_Numbers;
} }
public String numbersTipText() { public String numbersTipText() {
return "Choose the type of inner binary representation to use."; return "Choose the type of inner binary representation to use.";
} }
/** This method will allow you to set the inner constants
/**
* This method will allow you to set the inner constants
*
* @param BitSet The new representation for the inner constants. * @param BitSet The new representation for the inner constants.
*/ */
public void setBitSet(InterfaceDataTypeBinary BitSet) { public void setBitSet(InterfaceDataTypeBinary BitSet) {
this.m_BitSet = BitSet; this.m_BitSet = BitSet;
} }
public InterfaceDataTypeBinary getBitSet() { public InterfaceDataTypeBinary getBitSet() {
return this.m_BitSet; return this.m_BitSet;
} }
public String bitSetTipText() { public String bitSetTipText() {
return "Choose the type of inner real-valued representation to use."; return "Choose the type of inner real-valued representation to use.";
} }

View File

@@ -7,9 +7,11 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGANBit; import eva2.optimization.operator.mutation.MutateGANBit;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.BitSet; import java.util.BitSet;
/** This individual uses a binary genotype to code for binary values. /**
* This individual uses a binary genotype to code for binary values.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 24.03.2003 * Date: 24.03.2003
@@ -67,7 +69,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return (Object) new GAIndividualBinaryData(this); return (Object) new GAIndividualBinaryData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -90,8 +94,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
} }
} }
/** This method evaluates the GAIndividual as simple minimize number /**
* This method evaluates the GAIndividual as simple minimize number
* of bits problem. * of bits problem.
*
* @return The number of true bits * @return The number of true bits
*/ */
public double defaultEvaulateAsMiniBits() { public double defaultEvaulateAsMiniBits() {
@@ -107,8 +113,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -125,9 +133,11 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method can be used to read the current fitness of the individual. /**
* This method can be used to read the current fitness of the individual.
* Please note that the fitness can be based on multiple criteria therefore * Please note that the fitness can be based on multiple criteria therefore
* double[] is used instead of a single double. * double[] is used instead of a single double.
*
* @return The complete fitness array * @return The complete fitness array
*/ */
@Override @Override
@@ -161,8 +171,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
} }
if (this.m_Genotype.get(i)) { if (this.m_Genotype.get(i)) {
result += "1"; result += "1";
} } else {
else {
result += "0"; result += "0";
} }
} }
@@ -171,7 +180,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return result; return result;
} }
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -190,9 +201,11 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
/** This method allows the user to read the length of the genotype. /**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.length only returns the index * This may be necessary since BitSet.length only returns the index
* of the last significant bit. * of the last significant bit.
*
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override @Override
@@ -205,14 +218,14 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.m_GenotypeLength; i++) { for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RNG.flipCoin(0.5)) { if (RNG.flipCoin(0.5)) {
this.m_Genotype.set(i); this.m_Genotype.set(i);
} } else {
else {
this.m_Genotype.clear(i); this.m_Genotype.clear(i);
} }
} }
} }
/** This method performs a simple one point mutation in the genotype /**
* This method performs a simple one point mutation in the genotype
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -220,8 +233,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
if (this.m_Genotype.get(mutationIndex)) { if (this.m_Genotype.get(mutationIndex)) {
this.m_Genotype.clear(mutationIndex); this.m_Genotype.clear(mutationIndex);
} } else {
else {
this.m_Genotype.set(mutationIndex); this.m_Genotype.set(mutationIndex);
} }
//if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor());
@@ -230,7 +242,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeBinary methods * InterfaceDataTypeBinary methods
*/ */
/** This method allows you to request a certain amount of binary data /**
* This method allows you to request a certain amount of binary data
*
* @param length The lenght of the BitSet that is to be optimized * @param length The lenght of the BitSet that is to be optimized
*/ */
@Override @Override
@@ -238,7 +252,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
this.m_GenotypeLength = length; this.m_GenotypeLength = length;
} }
/** This method returns the length of the binary data set /**
* This method returns the length of the binary data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -246,7 +262,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_GenotypeLength; return this.m_GenotypeLength;
} }
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -255,8 +273,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the binary data without /**
* This method allows you to read the binary data without
* an update from the genotype * an update from the genotype
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -264,7 +284,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the binary data. /**
* This method allows you to set the binary data.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -272,8 +294,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
this.m_Phenotype = binaryData; this.m_Phenotype = binaryData;
} }
/** This method allows you to set the binary data, this can be used for /**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -285,8 +309,10 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -294,7 +320,9 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
return "GA binary individual"; return "GA binary individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {

View File

@@ -9,9 +9,11 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGAUniform; import eva2.optimization.operator.mutation.MutateGAUniform;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.BitSet; import java.util.BitSet;
/** This individual uses a binary genotype to code for double values /**
* This individual uses a binary genotype to code for double values
* using two alternative encodings. * using two alternative encodings.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
@@ -77,7 +79,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return (Object) new GAIndividualDoubleData(this); return (Object) new GAIndividualDoubleData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -112,7 +116,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeDouble methods * InterfaceDataTypeDouble methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -143,7 +149,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
// } // }
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -151,9 +159,11 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Range.length; return this.m_Range.length;
} }
/** This method will set the range of the double attributes. If range.length /**
* This method will set the range of the double attributes. If range.length
* does not equal doubledata.length only range[i] will be used to set all * does not equal doubledata.length only range[i] will be used to set all
* ranges. * ranges.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -168,7 +178,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
} }
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -176,7 +188,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Range; return this.m_Range;
} }
/** This method allows you to read the double data /**
* This method allows you to read the double data
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -191,8 +205,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the double data without /**
* This method allows you to read the double data without
* an update from the genotype * an update from the genotype
*
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override @Override
@@ -200,8 +216,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the phenotype data. To change the genotype data, /**
* This method allows you to set the phenotype data. To change the genotype data,
* use SetDoubleDataLamarckian. * use SetDoubleDataLamarckian.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -209,8 +227,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
/** This method allows you to set the double data, this can be used for /**
* This method allows you to set the double data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -228,8 +248,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -249,8 +271,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -276,8 +300,7 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.m_GenotypeLength; i++) { for (int i = 0; i < this.m_GenotypeLength; i++) {
if (this.m_Genotype.get(i)) { if (this.m_Genotype.get(i)) {
result += "1"; result += "1";
} } else {
else {
result += "0"; result += "0";
} }
} }
@@ -289,7 +312,9 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
* InterfaceGAIndividual methods * InterfaceGAIndividual methods
*/ */
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -297,8 +322,10 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return this.m_Genotype; return this.m_Genotype;
} }
/** This method allows you to set the binary data, this can be used for /**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -306,9 +333,11 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
/** This method allows the user to read the length of the genotype. /**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index * This may be necessary since BitSet.lenght only returns the index
* of the last significat bit. * of the last significat bit.
*
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override @Override
@@ -321,30 +350,31 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
for (int i = 0; i < this.m_GenotypeLength; i++) { for (int i = 0; i < this.m_GenotypeLength; i++) {
if (RNG.flipCoin(0.5)) { if (RNG.flipCoin(0.5)) {
this.m_Genotype.set(i); this.m_Genotype.set(i);
} } else {
else {
this.m_Genotype.clear(i); this.m_Genotype.clear(i);
} }
} }
} }
/** This method performs a simple one point mutation in the genotype /**
* This method performs a simple one point mutation in the genotype
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength); int mutationIndex = RNG.randomInt(0, this.m_GenotypeLength);
if (this.m_Genotype.get(mutationIndex)) { if (this.m_Genotype.get(mutationIndex)) {
this.m_Genotype.clear(mutationIndex); this.m_Genotype.clear(mutationIndex);
} } else {
else {
this.m_Genotype.set(mutationIndex); this.m_Genotype.set(mutationIndex);
} }
} }
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -352,37 +382,47 @@ public class GAIndividualDoubleData extends AbstractEAIndividual implements Inte
return "GA individual"; return "GA individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a GA individual suited to optimize double values."; return "This is a GA individual suited to optimize double values.";
} }
/** This method allows you to set the Coding that is to be used, currently either standard binary /**
* This method allows you to set the Coding that is to be used, currently either standard binary
* coding or Gray coding. * coding or Gray coding.
*
* @param coding The used genotype coding method * @param coding The used genotype coding method
*/ */
public void setGACoding(InterfaceGADoubleCoding coding) { public void setGACoding(InterfaceGADoubleCoding coding) {
this.m_DoubleCoding = coding; this.m_DoubleCoding = coding;
} }
public InterfaceGADoubleCoding getGACoding() { public InterfaceGADoubleCoding getGACoding() {
return this.m_DoubleCoding; return this.m_DoubleCoding;
} }
public String gADoubleCodingTipText() { public String gADoubleCodingTipText() {
return "Choose the coding to use."; return "Choose the coding to use.";
} }
/** This method allows you to set the number of mulitruns that are to be performed, /**
* This method allows you to set the number of mulitruns that are to be performed,
* necessary for stochastic optimizers to ensure reliable results. * necessary for stochastic optimizers to ensure reliable results.
*
* @param precision The number of multiruns that are to be performed * @param precision The number of multiruns that are to be performed
*/ */
public void setPrecision(int precision) { public void setPrecision(int precision) {
this.m_Precision = precision; this.m_Precision = precision;
} }
public int getPrecision() { public int getPrecision() {
return this.m_Precision; return this.m_Precision;
} }
public String precisionTipText() { public String precisionTipText() {
return "Gives the number of bits to be used to code a double."; return "Gives the number of bits to be used to code a double.";
} }

View File

@@ -8,9 +8,11 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateGANBit; import eva2.optimization.operator.mutation.MutateGANBit;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.BitSet; import java.util.BitSet;
/** This individual uses a binary genotype to code for binary values using /**
* This individual uses a binary genotype to code for binary values using
* two alternative encodings. * two alternative encodings.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
@@ -77,7 +79,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -112,7 +116,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeInteger methods * InterfaceDataTypeInteger methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -138,7 +144,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
} }
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -146,9 +154,11 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Range.length; return this.m_Range.length;
} }
/** This method will set the range of the integer attributes. If range.length /**
* This method will set the range of the integer attributes. If range.length
* does not equal doubledata.length only range[i] will be used to set all * does not equal doubledata.length only range[i] will be used to set all
* ranges. * ranges.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -190,7 +200,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
m_CodingLenghts[index] = m_IntegerCoding.calculateNecessaryBits(m_Range[index]); m_CodingLenghts[index] = m_IntegerCoding.calculateNecessaryBits(m_Range[index]);
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -198,7 +210,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Range; return this.m_Range;
} }
/** This method allows you to read the double data /**
* This method allows you to read the double data
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -215,8 +229,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the int data without /**
* This method allows you to read the int data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -224,7 +240,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the double data. /**
* This method allows you to set the double data.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -232,8 +250,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
/** This method allows you to set the double data, this can be used for /**
* This method allows you to set the double data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -254,8 +274,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -275,8 +297,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -316,8 +340,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
for (int i = 0; i < overallLength; i++) { for (int i = 0; i < overallLength; i++) {
if (this.m_Genotype.get(i)) { if (this.m_Genotype.get(i)) {
result += "1"; result += "1";
} } else {
else {
result += "0"; result += "0";
} }
} }
@@ -329,7 +352,9 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
* InterfaceGAIndividual methods * InterfaceGAIndividual methods
*/ */
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -337,8 +362,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Genotype; return this.m_Genotype;
} }
/** This method allows you to set the binary data, this can be used for /**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -346,9 +373,11 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
/** This method allows the user to read the length of the genotype. /**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index * This may be necessary since BitSet.lenght only returns the index
* of the last significat bit. * of the last significat bit.
*
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override @Override
@@ -369,14 +398,14 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
for (int i = 0; i < overallLength; i++) { for (int i = 0; i < overallLength; i++) {
if (RNG.flipCoin(0.5)) { if (RNG.flipCoin(0.5)) {
this.m_Genotype.set(i); this.m_Genotype.set(i);
} } else {
else {
this.m_Genotype.clear(i); this.m_Genotype.clear(i);
} }
} }
} }
/** This method performs a simple one point mutation in the genotype /**
* This method performs a simple one point mutation in the genotype
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -387,8 +416,7 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
int mutationIndex = RNG.randomInt(0, overallLength); int mutationIndex = RNG.randomInt(0, overallLength);
if (this.m_Genotype.get(mutationIndex)) { if (this.m_Genotype.get(mutationIndex)) {
this.m_Genotype.clear(mutationIndex); this.m_Genotype.clear(mutationIndex);
} } else {
else {
this.m_Genotype.set(mutationIndex); this.m_Genotype.set(mutationIndex);
} }
} }
@@ -431,8 +459,10 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -440,23 +470,29 @@ public class GAIndividualIntegerData extends AbstractEAIndividual implements Int
return "GA individual"; return "GA individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a GA individual suited to optimize int values."; return "This is a GA individual suited to optimize int values.";
} }
/** This method allows you to set the Coding that is to be used, currently either standard binary /**
* This method allows you to set the Coding that is to be used, currently either standard binary
* coding or Gray coding. * coding or Gray coding.
*
* @param coding The used genotype coding method * @param coding The used genotype coding method
*/ */
public void setGACoding(InterfaceGAIntegerCoding coding) { public void setGACoding(InterfaceGAIntegerCoding coding) {
this.m_IntegerCoding = coding; this.m_IntegerCoding = coding;
} }
public InterfaceGAIntegerCoding getGACoding() { public InterfaceGAIntegerCoding getGACoding() {
return this.m_IntegerCoding; return this.m_IntegerCoding;
} }
public String gAIntegerCodingTipText() { public String gAIntegerCodingTipText() {
return "Choose the coding to use."; return "Choose the coding to use.";
} }

View File

@@ -7,7 +7,8 @@ import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual combines a real-valued phenotype with a tree-based phenotype. /**
* This individual combines a real-valued phenotype with a tree-based phenotype.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 08.04.2003 * Date: 08.04.2003
@@ -52,7 +53,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return (Object) new GAPIndividualProgramData(this); return (Object) new GAPIndividualProgramData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -72,7 +75,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
} }
} }
/** This method will allow a default initialisation of the individual /**
* This method will allow a default initialisation of the individual
*
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override @Override
@@ -87,8 +92,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
((AbstractEAIndividual) this.m_Program).defaultInit(prob); ((AbstractEAIndividual) this.m_Program).defaultInit(prob);
} }
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -109,7 +116,8 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
} }
} }
/** This method will mutate the individual randomly /**
* This method will mutate the individual randomly
*/ */
@Override @Override
public void mutate() { public void mutate() {
@@ -127,8 +135,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
((AbstractEAIndividual) this.m_Program).defaultMutate(); ((AbstractEAIndividual) this.m_Program).defaultMutate();
} }
/** This method will mate the Individual with given other individuals /**
* This method will mate the Individual with given other individuals
* of the same type. * of the same type.
*
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@@ -174,8 +184,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return result; return result;
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -186,10 +198,12 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return result; return result;
} }
/********************************************************************************************************************** /**
* *******************************************************************************************************************
* These are for InterfaceDataTypeDouble * These are for InterfaceDataTypeDouble
* <p/>
/** This method allows you to request a certain amount of double data * /** This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -197,7 +211,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Numbers.setDoubleDataLength(length); this.m_Numbers.setDoubleDataLength(length);
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -205,9 +221,11 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Numbers.size(); return this.m_Numbers.size();
} }
/** This method will set the range of the double attributes. /**
* This method will set the range of the double attributes.
* Note: range[d][0] gives the lower bound and range[d] gives the upper bound * Note: range[d][0] gives the lower bound and range[d] gives the upper bound
* for dimension d. * for dimension d.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -215,7 +233,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Numbers.SetDoubleRange(range); this.m_Numbers.SetDoubleRange(range);
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -223,7 +243,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Numbers.getDoubleRange(); return this.m_Numbers.getDoubleRange();
} }
/** This method allows you to read the double data /**
* This method allows you to read the double data
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -231,8 +253,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Numbers.getDoubleData(); return this.m_Numbers.getDoubleData();
} }
/** This method allows you to read the double data without /**
* This method allows you to read the double data without
* an update from the genotype * an update from the genotype
*
* @return double[] representing the double data. * @return double[] representing the double data.
*/ */
@Override @Override
@@ -240,8 +264,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Numbers.getDoubleDataWithoutUpdate(); return this.m_Numbers.getDoubleDataWithoutUpdate();
} }
/** This method allows you to set the phenotype data. To change the genotype, use /**
* This method allows you to set the phenotype data. To change the genotype, use
* SetDoubleDataLamarckian(). * SetDoubleDataLamarckian().
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -249,8 +275,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Numbers.SetDoublePhenotype(doubleData); this.m_Numbers.SetDoublePhenotype(doubleData);
} }
/** This method allows you to set the genotype data, this can be used for /**
* This method allows you to set the genotype data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -261,7 +289,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeProgram methods * InterfaceDataTypeProgram methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -269,7 +299,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Program.setProgramDataLength(length); this.m_Program.setProgramDataLength(length);
} }
/** This method allows you to read the program stored as Koza style node tree /**
* This method allows you to read the program stored as Koza style node tree
*
* @return AbstractGPNode representing the binary data. * @return AbstractGPNode representing the binary data.
*/ */
@Override @Override
@@ -277,8 +309,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Program.getProgramData(); return this.m_Program.getProgramData();
} }
/** This method allows you to read the Program data without /**
* This method allows you to read the Program data without
* an update from the genotype * an update from the genotype
*
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override @Override
@@ -286,7 +320,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return this.m_Program.getProgramDataWithoutUpdate(); return this.m_Program.getProgramDataWithoutUpdate();
} }
/** This method allows you to set the program. /**
* This method allows you to set the program.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -294,7 +330,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Program.SetProgramPhenotype(program); this.m_Program.SetProgramPhenotype(program);
} }
/** This method allows you to set the program. /**
* This method allows you to set the program.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -302,7 +340,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Program.SetProgramGenotype(program); this.m_Program.SetProgramGenotype(program);
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override @Override
@@ -310,7 +350,9 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
this.m_Program.SetFunctionArea(area); this.m_Program.SetFunctionArea(area);
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @return The function area * @return The function area
*/ */
@Override @Override
@@ -321,8 +363,10 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -330,27 +374,36 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
return "GAP individual"; return "GAP individual";
} }
/** This method will allow you to set the inner constants /**
* This method will allow you to set the inner constants
*
* @param Numbers The new representation for the inner constants. * @param Numbers The new representation for the inner constants.
*/ */
public void setNumbers(InterfaceDataTypeDouble Numbers) { public void setNumbers(InterfaceDataTypeDouble Numbers) {
this.m_Numbers = Numbers; this.m_Numbers = Numbers;
} }
public InterfaceDataTypeDouble getNumbers() { public InterfaceDataTypeDouble getNumbers() {
return this.m_Numbers; return this.m_Numbers;
} }
public String numbersTipText() { public String numbersTipText() {
return "Choose the type of inner constants to use."; return "Choose the type of inner constants to use.";
} }
/** This method will allow you to set the inner constants
/**
* This method will allow you to set the inner constants
*
* @param program The new representation for the program. * @param program The new representation for the program.
*/ */
public void setProgramRepresentation(InterfaceDataTypeProgram program) { public void setProgramRepresentation(InterfaceDataTypeProgram program) {
this.m_Program = program; this.m_Program = program;
} }
public InterfaceDataTypeProgram getProgramRepresentation() { public InterfaceDataTypeProgram getProgramRepresentation() {
return this.m_Program; return this.m_Program;
} }
public String programRepresentationTipText() { public String programRepresentationTipText() {
return "Choose the type of inner constants to use."; return "Choose the type of inner constants to use.";
} }

View File

@@ -9,10 +9,12 @@ import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateDefault; import eva2.optimization.operator.mutation.MutateDefault;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
/** This individual uses a binary genotype to code for a tree-based representation /**
* This individual uses a binary genotype to code for a tree-based representation
* using a BNF grammar, see also Grammatical Evolution. * using a BNF grammar, see also Grammatical Evolution.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
@@ -113,7 +115,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return (Object) new GEIndividualProgramData(this); return (Object) new GEIndividualProgramData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -142,7 +146,8 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method compiles the area /**
* This method compiles the area
*/ */
private void compileArea() { private void compileArea() {
if (this.m_Area == null) { if (this.m_Area == null) {
@@ -224,7 +229,8 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method will print the currently used rule set /**
* This method will print the currently used rule set
*/ */
private void printRuleSet() { private void printRuleSet() {
String result = ""; String result = "";
@@ -235,12 +241,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.m_Rules[t].length; i++) { for (int i = 0; i < this.m_Rules[t].length; i++) {
if (i == 0) { if (i == 0) {
result += "expr, "; result += "expr, ";
} } else {
else {
if (i == 1) { if (i == 1) {
result += "var, "; result += "var, ";
} } else {
else {
if (((AbstractGPNode[]) this.m_Rules[t][i]).length > 0) { if (((AbstractGPNode[]) this.m_Rules[t][i]).length > 0) {
result += "op" + (i - 1) + ", "; result += "op" + (i - 1) + ", ";
} }
@@ -301,7 +305,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
/** This method returns a string for the BitSet /**
* This method returns a string for the BitSet
*
* @return A String * @return A String
*/ */
private String getBitSetString() { private String getBitSetString() {
@@ -313,8 +319,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
if (this.m_Genotype.get(i)) { if (this.m_Genotype.get(i)) {
result += "1"; result += "1";
} } else {
else {
result += "0"; result += "0";
} }
} }
@@ -322,7 +327,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return result; return result;
} }
/** This method returns a String for a given rule /**
* This method returns a String for a given rule
*
* @param rule The rulz to transform into a string * @param rule The rulz to transform into a string
* @return String * @return String
*/ */
@@ -345,7 +352,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeProgram methods * InterfaceDataTypeProgram methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -408,11 +417,13 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method will fetch the next int value from the BitSet. If necessary the /**
* This method will fetch the next int value from the BitSet. If necessary the
* method will continue at the beginning of the BitSet if m_Genotype length is * method will continue at the beginning of the BitSet if m_Genotype length is
* exceeded. * exceeded.
* Note: You need to set the current ReadingIndx = 0 before starting to decode * Note: You need to set the current ReadingIndx = 0 before starting to decode
* the BitSet * the BitSet
*
* @param t The index of the program. * @param t The index of the program.
* @return The int value * @return The int value
*/ */
@@ -430,7 +441,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return result; return result;
} }
/** This method will decode a GPNode from the BitSet /**
* This method will decode a GPNode from the BitSet
*
* @param t The index of the program * @param t The index of the program
* @param mode The modex * @param mode The modex
* @return GPNode * @return GPNode
@@ -466,7 +479,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return result; return result;
} }
/** This method allows you to read the program stored as Koza style node tree /**
* This method allows you to read the program stored as Koza style node tree
*
* @return GPNode representing the binary data. * @return GPNode representing the binary data.
*/ */
@Override @Override
@@ -504,8 +519,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the Program data without /**
* This method allows you to read the Program data without
* an update from the genotype * an update from the genotype
*
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override @Override
@@ -513,7 +530,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the program phenotype. /**
* This method allows you to set the program phenotype.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -528,6 +547,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/** /**
* Warning - this is not implemented, it only sets the phenotype using SetProgramData. * Warning - this is not implemented, it only sets the phenotype using SetProgramData.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -538,7 +558,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override @Override
@@ -552,7 +574,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @return The function area * @return The function area
*/ */
@Override @Override
@@ -563,8 +587,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceEAIndividual methods * InterfaceEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -580,8 +606,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -592,8 +620,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.m_GenotypeLengthPerProgram * this.m_Area.length; i++) { for (int i = 0; i < this.m_GenotypeLengthPerProgram * this.m_Area.length; i++) {
if (this.m_Genotype.get(i)) { if (this.m_Genotype.get(i)) {
result += "1"; result += "1";
} } else {
else {
result += "0"; result += "0";
} }
} }
@@ -609,7 +636,9 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
* InterfaceGAIndividual methods * InterfaceGAIndividual methods
*/ */
/** This method allows you to read the binary data /**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data. * @return BitSet representing the binary data.
*/ */
@Override @Override
@@ -617,8 +646,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return this.m_Genotype; return this.m_Genotype;
} }
/** This method allows you to set the binary data, this can be used for /**
* This method allows you to set the binary data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param binaryData The new binary data. * @param binaryData The new binary data.
*/ */
@Override @Override
@@ -626,9 +657,11 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
this.m_Genotype = binaryData; this.m_Genotype = binaryData;
} }
/** This method allows the user to read the length of the genotype. /**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index * This may be necessary since BitSet.lenght only returns the index
* of the last significat bit. * of the last significat bit.
*
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override @Override
@@ -641,14 +674,14 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
for (int i = 0; i < this.m_GenotypeLengthPerProgram * this.m_Area.length; i++) { for (int i = 0; i < this.m_GenotypeLengthPerProgram * this.m_Area.length; i++) {
if (RNG.flipCoin(0.5)) { if (RNG.flipCoin(0.5)) {
this.m_Genotype.set(i); this.m_Genotype.set(i);
} } else {
else {
this.m_Genotype.clear(i); this.m_Genotype.clear(i);
} }
} }
} }
/** This method performs a simple one point mutation in the genotype /**
* This method performs a simple one point mutation in the genotype
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -656,8 +689,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
//if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println("Mutate: " + this.getSolutionRepresentationFor());
if (this.m_Genotype.get(mutationIndex)) { if (this.m_Genotype.get(mutationIndex)) {
this.m_Genotype.clear(mutationIndex); this.m_Genotype.clear(mutationIndex);
} } else {
else {
this.m_Genotype.set(mutationIndex); this.m_Genotype.set(mutationIndex);
} }
//if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor()); //if (mutationIndex > 28) System.out.println(this.getSolutionRepresentationFor());
@@ -666,8 +698,10 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -675,50 +709,64 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
return "GE individual"; return "GE individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a GE individual suited to optimize programs."; return "This is a GE individual suited to optimize programs.";
} }
/** This method allows you to set the length of the binary genotype /**
* This method allows you to set the length of the binary genotype
*
* @param size The length * @param size The length
*/ */
public void setGenotypeLengthPerProgram(int size) { public void setGenotypeLengthPerProgram(int size) {
this.m_GenotypeLengthPerProgram = size; this.m_GenotypeLengthPerProgram = size;
} }
public int getGenotypeLengthPerProgram() { public int getGenotypeLengthPerProgram() {
return this.m_GenotypeLengthPerProgram; return this.m_GenotypeLengthPerProgram;
} }
public String genotypeLengthPerProgramTipText() { public String genotypeLengthPerProgramTipText() {
return "Choose the length of the genotype."; return "Choose the length of the genotype.";
} }
/** This method allows you to set the maximum number of /**
* This method allows you to set the maximum number of
* nodes allowed for the program. * nodes allowed for the program.
*
* @param nodes The maximum number of nodes * @param nodes The maximum number of nodes
*/ */
public void setMaxNumberOfNodes(int nodes) { public void setMaxNumberOfNodes(int nodes) {
this.m_MaxNumberOfNodes = nodes; this.m_MaxNumberOfNodes = nodes;
} }
public int getMaxNumberOfNodes() { public int getMaxNumberOfNodes() {
return this.m_MaxNumberOfNodes; return this.m_MaxNumberOfNodes;
} }
public String maxNumberOfNodesTipText() { public String maxNumberOfNodesTipText() {
return "Set the maximum number of nodes for the program."; return "Set the maximum number of nodes for the program.";
} }
/** This method allows you to set the number of bits per int value /**
* This method allows you to set the number of bits per int value
* stored on the BitSet * stored on the BitSet
*
* @param length The number of bits per int. * @param length The number of bits per int.
*/ */
public void setNumberOfBitPerInt(int length) { public void setNumberOfBitPerInt(int length) {
this.m_NumberOfBitPerInt = length; this.m_NumberOfBitPerInt = length;
} }
public int getNumberOfBitPerInt() { public int getNumberOfBitPerInt() {
return this.m_NumberOfBitPerInt; return this.m_NumberOfBitPerInt;
} }
public String numberOfBitPerIntTipText() { public String numberOfBitPerIntTipText() {
return "Choose the number of bits ber int."; return "Choose the number of bits ber int.";
} }

View File

@@ -7,7 +7,8 @@ import eva2.optimization.problems.InterfaceHasInitRange;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual uses a integer genotype to code for integer values. /**
* This individual uses a integer genotype to code for integer values.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 18.05.2005 * Date: 18.05.2005
@@ -77,7 +78,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -111,7 +114,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeInteger methods * InterfaceDataTypeInteger methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -136,7 +141,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Range = newRange; this.m_Range = newRange;
} }
/** This method returns the length of the double data set /**
* This method returns the length of the double data set
*
* @return The number of bits stored * @return The number of bits stored
*/ */
@Override @Override
@@ -144,9 +151,11 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Range.length; return this.m_Range.length;
} }
/** This method will set the range of the double attributes. If range.length /**
* This method will set the range of the double attributes. If range.length
* does not equal doubledata.length only range[i] will be used to set all * does not equal doubledata.length only range[i] will be used to set all
* ranges. * ranges.
*
* @param range The new range for the double data. * @param range The new range for the double data.
*/ */
@Override @Override
@@ -160,7 +169,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
} }
} }
/** This method will return the range for all double attributes. /**
* This method will return the range for all double attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -168,7 +179,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Range; return this.m_Range;
} }
/** This method allows you to read the double data /**
* This method allows you to read the double data
*
* @return BitSet representing the double data. * @return BitSet representing the double data.
*/ */
@Override @Override
@@ -180,8 +193,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the int data without /**
* This method allows you to read the int data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -189,7 +204,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to set the double data. /**
* This method allows you to set the double data.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -197,8 +214,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Phenotype = doubleData; this.m_Phenotype = doubleData;
} }
/** This method allows you to set the double data, this can be used for /**
* This method allows you to set the double data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param doubleData The new double data. * @param doubleData The new double data.
*/ */
@Override @Override
@@ -213,8 +232,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* AbstractEAIndividual methods * AbstractEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -234,8 +255,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -269,7 +292,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
* InterfaceGIIndividual methods * InterfaceGIIndividual methods
*/ */
/** This method will allow the user to read the GI genotype /**
* This method will allow the user to read the GI genotype
*
* @return BitSet * @return BitSet
*/ */
@Override @Override
@@ -277,10 +302,12 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Genotype; return this.m_Genotype;
} }
/** This method will allow the user to set the current GI genotype. /**
* This method will allow the user to set the current GI genotype.
* Use this method with care, since the object is returned when using * Use this method with care, since the object is returned when using
* getIGenotype() you can directly alter the genotype without using * getIGenotype() you can directly alter the genotype without using
* this method. * this method.
*
* @param b The new genotype of the Individual * @param b The new genotype of the Individual
*/ */
@Override @Override
@@ -288,9 +315,11 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
this.m_Genotype = b; this.m_Genotype = b;
} }
/** This method allows the user to read the length of the genotype. /**
* This method allows the user to read the length of the genotype.
* This may be necessary since BitSet.lenght only returns the index * This may be necessary since BitSet.lenght only returns the index
* of the last significat bit. * of the last significat bit.
*
* @return The length of the genotype. * @return The length of the genotype.
*/ */
@Override @Override
@@ -298,7 +327,8 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return this.m_Genotype.length; return this.m_Genotype.length;
} }
/** This method performs a simple one point mutation in the genotype /**
* This method performs a simple one point mutation in the genotype
*/ */
@Override @Override
public void defaultMutate() { public void defaultMutate() {
@@ -335,8 +365,10 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -344,7 +376,9 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
return "GI individual"; return "GI individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {

View File

@@ -5,7 +5,8 @@ import eva2.optimization.population.Population;
import eva2.optimization.problems.InterfaceOptimizationProblem; import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual combines a binary and a real-valued phenotype. /**
* This individual combines a binary and a real-valued phenotype.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 13.05.2003 * Date: 13.05.2003
@@ -50,7 +51,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return (Object) new GIOBGAIndividualIntegerPermutationData(this); return (Object) new GIOBGAIndividualIntegerPermutationData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -70,7 +73,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
} }
} }
/** This method will allow a default initialisation of the individual /**
* This method will allow a default initialisation of the individual
*
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@Override @Override
@@ -85,8 +90,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
((AbstractEAIndividual) this.m_Permutation).defaultInit(prob); ((AbstractEAIndividual) this.m_Permutation).defaultInit(prob);
} }
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -107,7 +114,8 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
} }
} }
/** This method will mutate the individual randomly /**
* This method will mutate the individual randomly
*/ */
@Override @Override
public void mutate() { public void mutate() {
@@ -125,8 +133,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
((AbstractEAIndividual) this.m_Permutation).defaultMutate(); ((AbstractEAIndividual) this.m_Permutation).defaultMutate();
} }
/** This method will mate the Individual with given other individuals /**
* This method will mate the Individual with given other individuals
* of the same type. * of the same type.
*
* @param partners The possible partners * @param partners The possible partners
* @return offsprings * @return offsprings
*/ */
@@ -187,8 +197,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return result; return result;
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -199,10 +211,12 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return result; return result;
} }
/********************************************************************************************************************** /**
* *******************************************************************************************************************
* These are for InterfaceDataTypeInteger * These are for InterfaceDataTypeInteger
* <p/>
/** This method allows you to request a certain amount of int data * /** This method allows you to request a certain amount of int data
*
* @param length The lenght of the int[] that is to be optimized * @param length The lenght of the int[] that is to be optimized
*/ */
@Override @Override
@@ -210,7 +224,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.m_Integer.setIntegerDataLength(length); this.m_Integer.setIntegerDataLength(length);
} }
/** This method returns the length of the int data set /**
* This method returns the length of the int data set
*
* @return The number of integers stored * @return The number of integers stored
*/ */
@Override @Override
@@ -218,9 +234,11 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Integer.size(); return this.m_Integer.size();
} }
/** This method will set the range of the int attributes. /**
* This method will set the range of the int attributes.
* Note: range[d][0] gives the lower bound and range[d] gives the upper bound * Note: range[d][0] gives the lower bound and range[d] gives the upper bound
* for dimension d. * for dimension d.
*
* @param range The new range for the int data. * @param range The new range for the int data.
*/ */
@Override @Override
@@ -228,7 +246,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.m_Integer.SetIntRange(range); this.m_Integer.SetIntRange(range);
} }
/** This method will return the range for all int attributes. /**
* This method will return the range for all int attributes.
*
* @return The range array. * @return The range array.
*/ */
@Override @Override
@@ -236,7 +256,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Integer.getIntRange(); return this.m_Integer.getIntRange();
} }
/** This method allows you to read the int data /**
* This method allows you to read the int data
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -244,8 +266,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Integer.getIntegerData(); return this.m_Integer.getIntegerData();
} }
/** This method allows you to read the int data without /**
* This method allows you to read the int data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the int data. * @return int[] representing the int data.
*/ */
@Override @Override
@@ -253,7 +277,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Integer.getIntegerDataWithoutUpdate(); return this.m_Integer.getIntegerDataWithoutUpdate();
} }
/** This method allows you to set the int data. /**
* This method allows you to set the int data.
*
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override @Override
@@ -261,8 +287,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.m_Integer.SetIntPhenotype(intData); this.m_Integer.SetIntPhenotype(intData);
} }
/** This method allows you to set the int data, this can be used for /**
* This method allows you to set the int data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param intData The new int data. * @param intData The new int data.
*/ */
@Override @Override
@@ -273,7 +301,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for InterfaceDataTypePermutation * These are for InterfaceDataTypePermutation
*/ */
/** setLength sets the length of the permutation. /**
* setLength sets the length of the permutation.
*
* @param length int new length * @param length int new length
*/ */
@Override @Override
@@ -282,7 +312,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.m_Integer.setIntegerDataLength(length.length); this.m_Integer.setIntegerDataLength(length.length);
} }
/** size returns the size of the permutation. /**
* size returns the size of the permutation.
*
* @return int * @return int
*/ */
@Override @Override
@@ -290,7 +322,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Permutation.sizePermutation(); return this.m_Permutation.sizePermutation();
} }
/** This method allows you to read the permutation data /**
* This method allows you to read the permutation data
*
* @return int[] represent the permutation. * @return int[] represent the permutation.
*/ */
@Override @Override
@@ -298,8 +332,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Permutation.getPermutationData(); return this.m_Permutation.getPermutationData();
} }
/** This method allows you to read the permutation data without /**
* This method allows you to read the permutation data without
* an update from the genotype * an update from the genotype
*
* @return int[] representing the permutation. * @return int[] representing the permutation.
*/ */
@Override @Override
@@ -307,7 +343,9 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return this.m_Permutation.getPermutationDataWithoutUpdate(); return this.m_Permutation.getPermutationDataWithoutUpdate();
} }
/** This method allows you to set the permutation. /**
* This method allows you to set the permutation.
*
* @param perm The new permutation data. * @param perm The new permutation data.
*/ */
@Override @Override
@@ -315,8 +353,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
this.SetPermutationPhenotype(perm); this.SetPermutationPhenotype(perm);
} }
/** This method allows you to set the permutation data, this can be used for /**
* This method allows you to set the permutation data, this can be used for
* memetic algorithms. * memetic algorithms.
*
* @param perm The new permutation data. * @param perm The new permutation data.
*/ */
@Override @Override
@@ -332,8 +372,10 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -341,34 +383,45 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
return "GA/ES individual"; return "GA/ES individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a mixed data type combining an integer vector with a permutation vector."; return "This is a mixed data type combining an integer vector with a permutation vector.";
} }
/** This method will allow you to set the inner constants /**
* This method will allow you to set the inner constants
*
* @param Numbers The new representation for the inner constants. * @param Numbers The new representation for the inner constants.
*/ */
public void setIntegers(InterfaceDataTypeInteger Numbers) { public void setIntegers(InterfaceDataTypeInteger Numbers) {
this.m_Integer = Numbers; this.m_Integer = Numbers;
} }
public InterfaceDataTypeInteger getIntegers() { public InterfaceDataTypeInteger getIntegers() {
return this.m_Integer; return this.m_Integer;
} }
public String integersTipText() { public String integersTipText() {
return "Choose the type of inner integers to use."; return "Choose the type of inner integers to use.";
} }
/** This method will allow you to set the inner constants
/**
* This method will allow you to set the inner constants
*
* @param p The new representation for the inner constants. * @param p The new representation for the inner constants.
*/ */
public void setPermutations(InterfaceDataTypePermutation p) { public void setPermutations(InterfaceDataTypePermutation p) {
this.m_Permutation = p; this.m_Permutation = p;
} }
public InterfaceDataTypePermutation getPermutations() { public InterfaceDataTypePermutation getPermutations() {
return this.m_Permutation; return this.m_Permutation;
} }
public String permutationsTipText() { public String permutationsTipText() {
return "Choose the type of inner permutation to use."; return "Choose the type of inner permutation to use.";
} }

View File

@@ -1,7 +1,6 @@
package eva2.optimization.individuals; package eva2.optimization.individuals;
import eva2.optimization.individuals.codings.gp.AbstractGPNode; import eva2.optimization.individuals.codings.gp.AbstractGPNode;
import eva2.optimization.individuals.codings.gp.GPArea; import eva2.optimization.individuals.codings.gp.GPArea;
import eva2.optimization.individuals.codings.gp.InterfaceProgram; import eva2.optimization.individuals.codings.gp.InterfaceProgram;
@@ -12,7 +11,8 @@ import eva2.optimization.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR; import eva2.tools.EVAERROR;
import eva2.tools.math.RNG; import eva2.tools.math.RNG;
/** This individual uses a tree-based genotype to code for program trees. /**
* This individual uses a tree-based genotype to code for program trees.
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
* User: streiche * User: streiche
* Date: 04.04.2003 * Date: 04.04.2003
@@ -86,7 +86,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return (Object) new GPIndividualProgramData(this); return (Object) new GPIndividualProgramData(this);
} }
/** This method checks on equality regarding genotypic equality /**
* This method checks on equality regarding genotypic equality
*
* @param individual The individual to compare to. * @param individual The individual to compare to.
* @return boolean if equal true else false. * @return boolean if equal true else false.
*/ */
@@ -100,8 +102,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
if ((this.m_Genotype == null) || (indy.m_Genotype == null)) { if ((this.m_Genotype == null) || (indy.m_Genotype == null)) {
return false; return false;
} } else {
else {
for (int i = 0; i < this.m_Genotype.length; i++) { for (int i = 0; i < this.m_Genotype.length; i++) {
if ((this.m_Genotype[i] == null) || (indy.m_Genotype[i] == null) || (!this.m_Genotype[i].equals(indy.m_Genotype[i]))) { if ((this.m_Genotype[i] == null) || (indy.m_Genotype[i] == null) || (!this.m_Genotype[i].equals(indy.m_Genotype[i]))) {
return false; return false;
@@ -117,7 +118,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceDataTypeProgram methods * InterfaceDataTypeProgram methods
*/ */
/** This method allows you to request a certain amount of double data /**
* This method allows you to request a certain amount of double data
*
* @param length The lenght of the double[] that is to be optimized * @param length The lenght of the double[] that is to be optimized
*/ */
@Override @Override
@@ -136,7 +139,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to read the program stored as Koza style node tree /**
* This method allows you to read the program stored as Koza style node tree
*
* @return AbstractGPNode representing the binary data. * @return AbstractGPNode representing the binary data.
*/ */
@Override @Override
@@ -157,21 +162,24 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return this.m_Phenotype; return this.m_Phenotype;
} }
/** This method allows you to read the Program data without /**
* This method allows you to read the Program data without
* an update from the genotype * an update from the genotype
*
* @return InterfaceProgram[] representing the Program. * @return InterfaceProgram[] representing the Program.
*/ */
@Override @Override
public InterfaceProgram[] getProgramDataWithoutUpdate() { public InterfaceProgram[] getProgramDataWithoutUpdate() {
if (this.m_Phenotype == null) { if (this.m_Phenotype == null) {
return getProgramData(); return getProgramData();
} } else {
else {
return this.m_Phenotype; return this.m_Phenotype;
} }
} }
/** This method allows you to set the program phenotype. /**
* This method allows you to set the program phenotype.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -184,7 +192,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to set the program genotype. /**
* This method allows you to set the program genotype.
*
* @param program The new program. * @param program The new program.
*/ */
@Override @Override
@@ -198,7 +208,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @param area The area contains functions and terminals * @param area The area contains functions and terminals
*/ */
@Override @Override
@@ -208,7 +220,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
} }
/** This method allows you to set the function area /**
* This method allows you to set the function area
*
* @return The function area * @return The function area
*/ */
@Override @Override
@@ -219,8 +233,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/************************************************************************************ /************************************************************************************
* InterfaceEAIndividual methods * InterfaceEAIndividual methods
*/ */
/** This method will init the individual with a given value for the /**
* This method will init the individual with a given value for the
* phenotype. * phenotype.
*
* @param obj The initial value for the phenotype * @param obj The initial value for the phenotype
* @param opt The optimization problem that is to be solved. * @param opt The optimization problem that is to be solved.
*/ */
@@ -236,8 +252,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
this.crossoverOperator.init(this, opt); this.crossoverOperator.init(this, opt);
} }
/** This method will return a string description of the GAIndividal /**
* This method will return a string description of the GAIndividal
* noteably the Genotype. * noteably the Genotype.
*
* @return A descriptive string * @return A descriptive string
*/ */
@Override @Override
@@ -266,7 +284,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
* InterfaceGPIndividual methods * InterfaceGPIndividual methods
*/ */
/** This method will allow the user to read the program genotype /**
* This method will allow the user to read the program genotype
*
* @return AbstractGPNode * @return AbstractGPNode
*/ */
@Override @Override
@@ -274,7 +294,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return this.m_Genotype; return this.m_Genotype;
} }
/** This method will allow the user to set the current program 'genotype'. /**
* This method will allow the user to set the current program 'genotype'.
*
* @param b The new programgenotype of the Individual * @param b The new programgenotype of the Individual
*/ */
@Override @Override
@@ -283,7 +305,9 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
this.m_Phenotype = null; this.m_Phenotype = null;
} }
/** This method will allow the user to set the current program 'genotype'. /**
* This method will allow the user to set the current program 'genotype'.
*
* @param b The new program genotype of the Individual * @param b The new program genotype of the Individual
* @param i The index where to insert the new program * @param i The index where to insert the new program
*/ */
@@ -336,8 +360,7 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
int targetDepth = RNG.randomInt(1, this.m_InitDepth); int targetDepth = RNG.randomInt(1, this.m_InitDepth);
if (RNG.flipCoin(this.m_InitFullGrowRatio)) { if (RNG.flipCoin(this.m_InitFullGrowRatio)) {
this.m_Genotype[i].initFull(this.m_Area[i], targetDepth); this.m_Genotype[i].initFull(this.m_Area[i], targetDepth);
} } else {
else {
this.m_Genotype[i].initGrow(this.m_Area[i], targetDepth); this.m_Genotype[i].initGrow(this.m_Area[i], targetDepth);
} }
} }
@@ -347,8 +370,10 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
/********************************************************************************************************************** /**********************************************************************************************************************
* These are for GUI * These are for GUI
*/ */
/** This method allows the CommonJavaObjectEditorPanel to read the /**
* This method allows the CommonJavaObjectEditorPanel to read the
* name to the current object. * name to the current object.
*
* @return The name. * @return The name.
*/ */
@Override @Override
@@ -356,27 +381,35 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
return "GP individual"; return "GP individual";
} }
/** This method returns a global info string /**
* This method returns a global info string
*
* @return description * @return description
*/ */
public static String globalInfo() { public static String globalInfo() {
return "This is a GP individual suited to optimize Koza style program trees."; return "This is a GP individual suited to optimize Koza style program trees.";
} }
/** This method will toggle between checking for max depth or not. /**
* This method will toggle between checking for max depth or not.
*
* @param b the Switch. * @param b the Switch.
*/ */
public void setCheckMaxDepth(boolean b) { public void setCheckMaxDepth(boolean b) {
this.m_CheckMaxDepth = b; this.m_CheckMaxDepth = b;
} }
public boolean getCheckMaxDepth() { public boolean getCheckMaxDepth() {
return this.m_CheckMaxDepth; return this.m_CheckMaxDepth;
} }
public String checkMaxDepthTipText() { public String checkMaxDepthTipText() {
return "If activated the maximum depth of the program tree will be enforced."; return "If activated the maximum depth of the program tree will be enforced.";
} }
/** This method set/get the init Full Grow Ratio. /**
* This method set/get the init Full Grow Ratio.
*
* @param b The new init Full Grow Ratio of the GP Tree. * @param b The new init Full Grow Ratio of the GP Tree.
*/ */
public void setInitFullGrowRatio(double b) { public void setInitFullGrowRatio(double b) {
@@ -388,14 +421,18 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
this.m_InitFullGrowRatio = b; this.m_InitFullGrowRatio = b;
} }
public double getInitFullGrowRatio() { public double getInitFullGrowRatio() {
return this.m_InitFullGrowRatio; return this.m_InitFullGrowRatio;
} }
public String initFullGrowRatioTipText() { public String initFullGrowRatioTipText() {
return "The ratio between the full and the grow init methods (1 uses only full initializing)."; return "The ratio between the full and the grow init methods (1 uses only full initializing).";
} }
/** This method set/get the init depth. /**
* This method set/get the init depth.
*
* @param b The new init Depth of the GP Tree. * @param b The new init Depth of the GP Tree.
*/ */
public void setInitDepth(int b) { public void setInitDepth(int b) {
@@ -405,23 +442,29 @@ public class GPIndividualProgramData extends AbstractEAIndividual implements Int
} }
this.m_InitDepth = b; this.m_InitDepth = b;
} }
public int getInitDepth() { public int getInitDepth() {
return this.m_InitDepth; return this.m_InitDepth;
} }
public String initDepthTipText() { public String initDepthTipText() {
return "The initial depth of the GP Tree."; return "The initial depth of the GP Tree.";
} }
/** This method set/get the target depth. /**
* This method set/get the target depth.
*
* @param b The new target Depth of the GP Tree. * @param b The new target Depth of the GP Tree.
*/ */
public void setMaxAllowedDepth(int b) { public void setMaxAllowedDepth(int b) {
this.m_maxAllowedDepth = b; this.m_maxAllowedDepth = b;
} }
@Override @Override
public int getMaxAllowedDepth() { public int getMaxAllowedDepth() {
return this.m_maxAllowedDepth; return this.m_maxAllowedDepth;
} }
public String maxAllowedDepthTipText() { public String maxAllowedDepthTipText() {
return "The maximum depth allowed for the GP tree."; return "The maximum depth allowed for the GP tree.";
} }

Some files were not shown because too many files have changed in this diff Show More