diff --git a/pom.xml b/pom.xml
index 0c68cde5..173f37e9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -68,8 +68,8 @@
maven-compiler-plugin
2.3.2
- 1.7
- 1.7
+ 1.8
+ 1.8
diff --git a/src/eva2/EvAInfo.java b/src/eva2/EvAInfo.java
index d9e4cdfa..2fcf43dd 100644
--- a/src/eva2/EvAInfo.java
+++ b/src/eva2/EvAInfo.java
@@ -55,7 +55,7 @@ public class EvAInfo {
System.err.println(ex.getMessage());
System.exit(1);
}
- InputStream istr = BasicResourceLoader.instance().getStreamFromResourceLocation(EvAInfo.iconLocation);
+ InputStream istr = BasicResourceLoader.getInstance().getStreamFromResourceLocation(EvAInfo.iconLocation);
if (istr == null) {
throw new RuntimeException(resourceNotFoundErrorMessage(EvAInfo.iconLocation) + " (EvAInfo.static)");
}
diff --git a/src/eva2/OptimizerFactory.java b/src/eva2/OptimizerFactory.java
index e787b51c..82a1d116 100644
--- a/src/eva2/OptimizerFactory.java
+++ b/src/eva2/OptimizerFactory.java
@@ -1,11 +1,11 @@
package eva2;
+import eva2.optimization.OptimizationParameters;
import eva2.optimization.enums.DEType;
import eva2.optimization.enums.MutateESCrossoverType;
import eva2.optimization.enums.PSOTopology;
import eva2.optimization.enums.PostProcessMethod;
import eva2.optimization.individuals.*;
-import eva2.optimization.OptimizationParameters;
import eva2.optimization.operator.archiving.ArchivingNSGAII;
import eva2.optimization.operator.archiving.InformationRetrievalInserting;
import eva2.optimization.operator.archiving.InterfaceArchiving;
diff --git a/src/eva2/OptimizerRunnable.java b/src/eva2/OptimizerRunnable.java
index c87e5a7c..0a03738b 100644
--- a/src/eva2/OptimizerRunnable.java
+++ b/src/eva2/OptimizerRunnable.java
@@ -1,12 +1,12 @@
package eva2;
-import eva2.optimization.OptimizationStateListener;
import eva2.optimization.InterfaceOptimizationParameters;
+import eva2.optimization.OptimizationStateListener;
+import eva2.optimization.Processor;
import eva2.optimization.individuals.IndividualInterface;
import eva2.optimization.individuals.InterfaceDataTypeBinary;
import eva2.optimization.individuals.InterfaceDataTypeDouble;
import eva2.optimization.individuals.InterfaceDataTypeInteger;
-import eva2.optimization.Processor;
import eva2.optimization.operator.postprocess.InterfacePostProcessParams;
import eva2.optimization.operator.postprocess.PostProcessParams;
import eva2.optimization.operator.terminators.InterfaceTerminator;
@@ -222,7 +222,7 @@ public class OptimizerRunnable implements Runnable {
}
}
- public double[] getDoubleSolution() {
+ public double[] getDoubleSolution() {
IndividualInterface indy = getResult();
if (indy instanceof InterfaceDataTypeDouble) {
return ((InterfaceDataTypeDouble) indy).getDoubleData();
diff --git a/src/eva2/cli/Main.java b/src/eva2/cli/Main.java
index f2940d60..e17430aa 100644
--- a/src/eva2/cli/Main.java
+++ b/src/eva2/cli/Main.java
@@ -2,23 +2,27 @@ package eva2.cli;
import eva2.EvAInfo;
import eva2.optimization.InterfaceOptimizationParameters;
-import eva2.optimization.individuals.IndividualInterface;
import eva2.optimization.OptimizationParameters;
import eva2.optimization.Processor;
+import eva2.optimization.individuals.IndividualInterface;
import eva2.optimization.operator.terminators.InterfaceTerminator;
-import eva2.optimization.population.Population;
import eva2.optimization.population.PopulationInterface;
+import eva2.optimization.population.Population;
import eva2.optimization.statistics.*;
import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.problems.InterfaceAdditionalPopulationInformer;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.tools.ReflectPackage;
+import eva2.tools.StringTools;
import eva2.util.annotation.Description;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
/**
*
@@ -90,7 +94,7 @@ public class Main {
continue;
}
Description description = clazz.getAnnotation(Description.class);
- System.out.printf("\t\033[1m%s\033[0m\n", type.getName());
+ System.out.printf("\t\033[1m%s\033[0m (%s)\n", type.getName(), StringTools.cutClassName(type.getName()));
if (description != null) {
System.out.printf("\t\t%s", description.value());
} else {
@@ -247,7 +251,7 @@ final class CommandLineStatistics implements InterfaceStatistics {
}
@Override
- public void printToTextListener(String s) {
+ public void printToTextListener(String... s) {
System.out.println(s);
}
diff --git a/src/eva2/cli/OptimizationLogger.java b/src/eva2/cli/OptimizationLogger.java
index c917cfc1..6b7020f6 100644
--- a/src/eva2/cli/OptimizationLogger.java
+++ b/src/eva2/cli/OptimizationLogger.java
@@ -1,7 +1,7 @@
package eva2.cli;
-import eva2.optimization.OptimizationStateListener;
import eva2.optimization.InterfaceOptimizationParameters;
+import eva2.optimization.OptimizationStateListener;
import eva2.optimization.population.InterfacePopulationChangedEventListener;
import java.io.OutputStream;
diff --git a/src/eva2/examples/TerminatorExample.java b/src/eva2/examples/TerminatorExample.java
index 2f79d80a..4d552f99 100644
--- a/src/eva2/examples/TerminatorExample.java
+++ b/src/eva2/examples/TerminatorExample.java
@@ -17,21 +17,27 @@ public class TerminatorExample {
double[] sol;
// A combined terminator for fitness and phenotype convergence
CombinedTerminator convT = new CombinedTerminator(
- // fitness-based stagnation period, absolute threshold, consider stagnation
- // in both direction (per dim.) or w.r.t. minimization only
- new FitnessConvergenceTerminator(0.0001, 1000, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decrease),
- new PhenotypeConvergenceTerminator(0.0001, 1000, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.bidirectional),
- true);
+ // fitness-based stagnation period, absolute threshold, consider stagnation
+ // in both direction (per dim.) or w.r.t. minimization only
+ new FitnessConvergenceTerminator(0.0001, 1000, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.decrease),
+ new PhenotypeConvergenceTerminator(0.0001, 1000, StagnationTypeEnum.fitnessCallBased, ChangeTypeEnum.absoluteChange, DirectionTypeEnum.bidirectional),
+ true
+ );
+
// Adding an evaluation terminator with OR to the convergence criterion
OptimizerFactory.setTerminator(new CombinedTerminator(
- new EvaluationTerminator(20000),
- convT,
- false));
+ new EvaluationTerminator(20000),
+ convT,
+ false
+ ));
+
sol = OptimizerFactory.optimizeToDouble(OptimizerFactory.PSO, f1, null);
+
System.out.println(OptimizerFactory.lastEvalsPerformed()
+ " evals performed. "
+ OptimizerFactory.terminatedBecause()
+ " Found solution: ");
+
for (int i = 0; i < f1.getProblemDimension(); i++) {
System.out.print(sol[i] + " ");
}
diff --git a/src/eva2/examples/TestingCbnPostProc.java b/src/eva2/examples/TestingCbnPostProc.java
index 1e313ad5..0d6136e5 100644
--- a/src/eva2/examples/TestingCbnPostProc.java
+++ b/src/eva2/examples/TestingCbnPostProc.java
@@ -1,8 +1,8 @@
package eva2.examples;
import eva2.OptimizerFactory;
-import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.OptimizationParameters;
+import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.operator.postprocess.PostProcessParams;
import eva2.optimization.operator.terminators.EvaluationTerminator;
import eva2.problems.FM0Problem;
diff --git a/src/eva2/examples/TestingPlusCmaEs.java b/src/eva2/examples/TestingPlusCmaEs.java
index 5d45725e..cb7a95f1 100644
--- a/src/eva2/examples/TestingPlusCmaEs.java
+++ b/src/eva2/examples/TestingPlusCmaEs.java
@@ -1,8 +1,8 @@
package eva2.examples;
import eva2.OptimizerFactory;
-import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.OptimizationParameters;
+import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.operator.crossover.CrossoverESDefault;
import eva2.optimization.operator.mutation.MutateESCovarianceMatrixAdaption;
import eva2.optimization.operator.terminators.EvaluationTerminator;
diff --git a/src/eva2/gui/AboutDialog.java b/src/eva2/gui/AboutDialog.java
index ab1a6ba4..2d590938 100644
--- a/src/eva2/gui/AboutDialog.java
+++ b/src/eva2/gui/AboutDialog.java
@@ -35,7 +35,7 @@ class AboutDialog extends JDialog {
setResizable(false);
/* Load EvA2 Image */
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(eva2.EvAInfo.splashLocation, true);
ImageIcon imageIcon = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes));
diff --git a/src/eva2/gui/EvATabbedFrameMaker.java b/src/eva2/gui/EvATabbedFrameMaker.java
index 079dc09c..525c6270 100644
--- a/src/eva2/gui/EvATabbedFrameMaker.java
+++ b/src/eva2/gui/EvATabbedFrameMaker.java
@@ -123,12 +123,12 @@ public class EvATabbedFrameMaker implements Serializable, PanelMaker, InterfaceN
}
}
- public JParaPanel getGOPanel() {
+ public JParaPanel getOptimizationParametersPanel() {
try {
JParaPanel sP = (JParaPanel) pmContainer.get(1);
return sP;
} catch (Exception e) {
- System.err.println("Failed to get GO panel from " + this.getClass());
+ System.err.println("Failed to get OptimizationParameters panel from " + this.getClass());
}
return null;
}
diff --git a/src/eva2/gui/HtmlDemo.java b/src/eva2/gui/HtmlDemo.java
index 4fc565bf..b41f081a 100644
--- a/src/eva2/gui/HtmlDemo.java
+++ b/src/eva2/gui/HtmlDemo.java
@@ -77,7 +77,7 @@ public class HtmlDemo {
return;
}
JFrame frame = new JFrame(name);
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
frame.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
JScrollPane scroller = new JScrollPane();
diff --git a/src/eva2/gui/InterfaceSelectablePointIcon.java b/src/eva2/gui/InterfaceSelectablePointIcon.java
index e456e940..424da61a 100644
--- a/src/eva2/gui/InterfaceSelectablePointIcon.java
+++ b/src/eva2/gui/InterfaceSelectablePointIcon.java
@@ -14,19 +14,19 @@ public interface InterfaceSelectablePointIcon {
*
* @param a The selection listener
*/
- public void addSelectionListener(InterfaceRefSolutionListener a);
+ void addSelectionListener(InterfaceRefSolutionListener a);
/**
* This method allows to remove the selection listner to the PointIcon
*/
- public void removeSelectionListeners();
+ void removeSelectionListeners();
/**
* This method returns the selection listner to the PointIcon
*
* @return InterfacePointIconSelectionListener
*/
- public InterfaceRefSolutionListener getSelectionListener();
+ InterfaceRefSolutionListener getSelectionListener();
/**
* Of course the PointIcon needs a reference to the individual
@@ -34,12 +34,12 @@ public interface InterfaceSelectablePointIcon {
*
* @param indy
*/
- public void setEAIndividual(AbstractEAIndividual indy);
+ void setEAIndividual(AbstractEAIndividual indy);
/**
* This method allows you to get the EAIndividual the icon stands for
*
* @return AbstractEAIndividual
*/
- public AbstractEAIndividual getEAIndividual();
+ AbstractEAIndividual getEAIndividual();
}
diff --git a/src/eva2/gui/JParaPanel.java b/src/eva2/gui/JParaPanel.java
index cfc136db..b7ca82fe 100644
--- a/src/eva2/gui/JParaPanel.java
+++ b/src/eva2/gui/JParaPanel.java
@@ -19,9 +19,6 @@ public class JParaPanel implements Serializable, PanelMaker {
*/
private JPanel tempPanel = new JPanel();
- public JParaPanel() {
- }
-
/**
*/
public JParaPanel(Object Parameter, String name) {
diff --git a/src/eva2/gui/JTextoutputFrame.java b/src/eva2/gui/JTextoutputFrame.java
index 3b1973d5..33586681 100644
--- a/src/eva2/gui/JTextoutputFrame.java
+++ b/src/eva2/gui/JTextoutputFrame.java
@@ -80,6 +80,7 @@ public class JTextoutputFrame implements JTextoutputFrameInterface, ActionListen
textArea.setCaretPosition(0);
textArea.setTabSize(16);
textArea.setFont(new Font("Courier New", Font.PLAIN, 12));
+ // Limit text output to 2500 Lines
((AbstractDocument)textArea.getDocument()).setDocumentFilter(new LineBufferDocumentFilter(textArea, 2500));
diff --git a/src/eva2/gui/Main.java b/src/eva2/gui/Main.java
index e80209c1..24feaf0b 100644
--- a/src/eva2/gui/Main.java
+++ b/src/eva2/gui/Main.java
@@ -1,552 +1,17 @@
package eva2.gui;
import eva2.EvAInfo;
-import eva2.optimization.OptimizationParameters;
-import eva2.optimization.OptimizationStateListener;
-import eva2.optimization.InterfaceOptimizationParameters;
-import eva2.optimization.modules.*;
-import eva2.optimization.statistics.AbstractStatistics;
-import eva2.optimization.statistics.InterfaceStatisticsListener;
-import eva2.optimization.statistics.InterfaceStatisticsParameters;
-import eva2.tools.BasicResourceLoader;
-import eva2.tools.EVAERROR;
-import eva2.tools.ReflectPackage;
import eva2.tools.StringTools;
-import eva2.util.ClassPreloader;
-import eva2.util.EvAComAdapter;
-import javax.help.HelpSet;
-import javax.help.JHelpContentViewer;
-import javax.help.JHelpNavigator;
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
- *
+ * Main method, creates and sets up MainFrame
*/
-public class Main extends JFrame implements OptimizationStateListener {
-
- /**
- * Generated serial version identifier.
- */
- private static final long serialVersionUID = 8232856334379977970L;
- private final int splashScreenTime;
- private boolean clientInited = false;
- private JDesktopPane desktopPane;
- private JPanel configurationPane;
- private Runnable initRunnable = null;
-
- private transient JProgressBar progressBar;
-
- // Option
- private ExtAction actPreferences;
- private ExtAction actQuit;
-
+public class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
- // Configurable module:
- private ModuleAdapter currentModuleAdapter = null;
-
- // Help:
- private ExtAction actHelp;
- private ExtAction actAbout;
- private ExtAction actLicense;
-
- // if not null, the module is loaded automatically and no other can be selected
- private String useDefaultModule = null; //"Genetic_Optimization";
-
-
- // measuring optimization runtime
- private long startTime = 0;
- private boolean withGUI = true;
- private boolean withTreeView = false;
- private EvATabbedFrameMaker frameMaker = null;
- private Window parentWindow;
-
- private java.util.List superListenerList = null;
-
- private EvAComAdapter comAdapter;
-
-
- public void addOptimizationStateListener(OptimizationStateListener l) {
- if (superListenerList == null) {
- superListenerList = new ArrayList<>();
- }
- superListenerList.add(l);
- }
-
- public boolean removeOptimizationStateListener(OptimizationStateListener l) {
- return superListenerList != null && superListenerList.remove(l);
- }
-
- /**
- * Constructor of GUI of EvA2. Works as client for the EvA2 server. Note
- * that the Main initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} }
- * to await full initialization if necessary.
- */
- public Main() {
- this(null, false, false);
- }
-
- /**
- * A constructor. Splash screen is optional, Gui is activated, no parent
- * window. Note that the Main initialized multi-threaded for
- * efficiency. Use {@link #awaitClientInitialized()} to await full
- * initialization if necessary.
- *
- * @param paramsFile
- * @param autorun
- * @param nosplash
- */
- public Main(final String paramsFile, boolean autorun, boolean nosplash) {
- this(null, paramsFile, null, autorun, nosplash, false, false);
- }
-
- /**
- * A constructor with optional spash screen. Note that the Main is
- * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
- * to await full initialization if necessary.
- *
- * @param autorun
- * @param nosplash
- * @see #Main(String, boolean, boolean)
- */
- public Main(boolean autorun, boolean nosplash) {
- this(null, autorun, nosplash);
- }
-
- /**
- * A constructor with optional splash screen. Note that the Main
- * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
- * to await full initialization if necessary.
- *
- * @param paramsFile
- * @param autorun
- * @param noSplash
- * @param noGui
- * @see #Main(boolean, boolean)
- */
- public Main(String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) {
- this(null, paramsFile, null, autorun, noSplash, noGui, withTreeView);
- }
-
- /**
- * A constructor with optional splash screen. Note that the Main
- * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
- * to await full initialization if necessary.
- *
- * @param optimizationParameters
- * @param autorun
- * @param noSplash
- * @param noGui
- * @see #Main(String, boolean, boolean)
- */
- public Main(InterfaceOptimizationParameters optimizationParameters, boolean autorun, boolean noSplash, boolean noGui) {
- this(null, null, optimizationParameters, autorun, noSplash, noGui, false);
- }
-
- /**
- * Do not use the tree view by default.
- *
- * @param parent
- * @param paramsFile
- * @param goParams
- * @param autorun
- * @param noSplash
- * @param noGui
- */
- public Main(final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui) {
- this(parent, paramsFile, goParams, autorun, noSplash, noGui, false);
- }
-
- /**
- * Main constructor of the EvA2 client GUI. Works as standalone version
- * locally or as client for the EvA2 server. GO parameters may be loaded
- * from a file (paramsFile) or given directly as a java instance. Both may
- * be null to start with standard parameters. If both are non null, the java
- * instance has the higher priority. Note that the Main initialized
- * multi-threaded for efficiency. Use {@link #awaitClientInitialized()} to
- * await full initialization if necessary.
- *
- * @param parent
- * @param paramsFile
- * @param autorun
- * @param noSplash
- * @param noGui
- */
- public Main(final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui, final boolean showTreeView) {
- clientInited = false;
- final eva2.gui.SplashScreen splashScreen = new eva2.gui.SplashScreen(EvAInfo.splashLocation);
-
- // preload some classes (into system cache) in a parallel thread
- preloadClasses();
-
- withGUI = !noGui;
- withTreeView = showTreeView;
- // activate the splash screen (show later using SwingUtilities)
- if (!noSplash && withGUI) {
- try {
- splashScreen.splash();
- } catch (HeadlessException e) {
- LOGGER.severe("Error: no xserver present - deactivating GUI.");
- withGUI = false;
- }
- }
-
- this.comAdapter = EvAComAdapter.getInstance();
- splashScreenTime = 2500;
- initRunnable = new Runnable() {
-
- @Override
- public void run() {
- synchronized (this) {
- long startTime = System.currentTimeMillis();
- init(paramsFile, goParams, parent); // this takes a bit
-
- long wait = System.currentTimeMillis() - startTime;
- LOGGER.info("Loaded EvA2 in " + wait + "ms.");
- System.out.print(wait);
- if (!autorun) {
- if (!noSplash) {
- try {
- // if splashScreenTime has not passed, sleep some more
- if (wait < splashScreenTime) {
- Thread.sleep(splashScreenTime - wait);
- }
- } catch (Exception ignored) {
- }
- }
- } else {
- if (!withGUI && (currentModuleAdapter instanceof GenericModuleAdapter)) {
- // do not save new parameters for an autorun without GUI - they weren't changed manually anyways.
- ((GenericModuleAdapter) currentModuleAdapter).getStatistics().setSaveParams(false);
- LOGGER.info("Autorun without GUI - not saving statistics parameters...");
- }
- if (withGUI) {
- frameMaker.onUserStart();
- } else {
- currentModuleAdapter.startOptimization();
- }
- }
- // close splash screen
- if (!noSplash && withGUI) {
- splashScreen.dispose();
- }
- clientInited = true;
- notifyAll();
- }
- }
- };
- SwingUtilities.invokeLater(initRunnable);
- }
-
- private void initLookAndFeel() {
- // Properties for Mac OS X support.
- if ((System.getProperty("mrj.version") != null)
- || (System.getProperty("os.name").toLowerCase().contains("mac"))) {
- /*
- * Note: the xDock name property must be set before parsing
- * command-line arguments! See above!
- */
- System.setProperty("com.apple.mrj.application.apple.menu.about.name", EvAInfo.productName);
-
- System.setProperty("apple.awt.graphics.EnableQ2DX", "true");
- System.setProperty("apple.laf.useScreenMenuBar", "true");
- System.setProperty("com.apple.macos.smallTabs", "true");
- System.setProperty("com.apple.macos.useScreenMenuBar", "true");
-
- System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
- System.setProperty("com.apple.mrj.application.live-resize", "true");
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
- LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
- }
- } else {
- /* Set Look and Feel */
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
- } catch (Exception ex) {
- LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
- }
- }
- }
-
- /**
- * Since the constructor runs multi-threaded for efficiency, this method may
- * be called to await the full initialization of a client instance. As soon
- * as it returns, the Main GUI is fully initialized.
- */
- public void awaitClientInitialized() {
- if (initRunnable != null) {
- synchronized (initRunnable) {
- if (!clientInited) {
- try {
- initRunnable.wait();
- initRunnable = null;
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- private void preloadClasses() {
- ClassPreloader cp = new ClassPreloader("eva2.optimization.strategies.InterfaceOptimizer", "eva2.problems.InterfaceOptimizationProblem", "eva2.optimization.operator.terminators.InterfaceTerminator");
- new Thread(cp).start();
- }
-
- /**
- * Try to start the optimization with current parameters on the loaded
- * module. Return true on success, otherwise false.
- *
- * @return
- */
- public boolean startOptimization() {
- if (currentModuleAdapter != null) {
- currentModuleAdapter.startOptimization();
- return true;
- } else {
- return false;
- }
- }
-
-
- /**
- * Set UI Font for all controls.
- *
- * @param fontResource The FontUIResource for the controls
- */
- private static void setUIFont(javax.swing.plaf.FontUIResource fontResource) {
- Enumeration keys = UIManager.getDefaults().keys();
- while (keys.hasMoreElements()) {
- Object key = keys.nextElement();
- Object value = UIManager.get(key);
- if (value != null && value instanceof javax.swing.plaf.FontUIResource) {
- UIManager.put(key, fontResource);
- }
- }
- }
-
- /**
- * Tries to load OptimizationParameters from given file if not null.
- */
- private void init(String paramsFile, InterfaceOptimizationParameters optimizationParameters, final Window parent) {
- useDefaultModule = EvAInfo.propDefaultModule();
- this.parentWindow = parent;
-
- setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
-
- setUIFont(new javax.swing.plaf.FontUIResource(Font.SANS_SERIF, 0, 11));
-
- if (useDefaultModule != null) {
- useDefaultModule = useDefaultModule.trim();
- if (useDefaultModule.length() < 1) {
- useDefaultModule = null;
- }
- }
-
- if (withGUI) {
- // Initialize look and feel for EvA2
- initLookAndFeel();
-
- GridBagConstraints gbConstraints = new GridBagConstraints();
-
- /* Create main frame with GridBagLayout */
- setTitle(EvAInfo.productName);
- setLayout(new GridBagLayout());
- setMinimumSize(new Dimension(1024, 800));
-
- /* Creates the desktopPane for Plot/Text Output */
- desktopPane = new JExtDesktopPane();
- JEFrameRegister.getInstance().setDesktopPane(desktopPane);
- /* Creates desktopPane ToolBar to show tiling buttons */
- JExtDesktopPaneToolBar desktopToolBar = new JExtDesktopPaneToolBar((JExtDesktopPane) desktopPane);
-
- /* Pane to hold ToolBar + DesktopPane */
- JPanel desktopPanel = new JPanel(new GridBagLayout());
- GridBagConstraints desktopConst = new GridBagConstraints();
- desktopConst.gridx = 0;
- desktopConst.gridy = 0;
- desktopConst.fill = GridBagConstraints.HORIZONTAL;
- desktopConst.weightx = 1.0;
- desktopPanel.add(desktopToolBar, desktopConst);
- desktopConst.gridy = 1;
- desktopConst.fill = GridBagConstraints.BOTH;
- desktopConst.weighty = 1.0;
- desktopPanel.add(desktopPane, desktopConst);
-
- BasicResourceLoader loader = BasicResourceLoader.instance();
- byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
- // TODO: use setIconImages (for better support of multiple icons when changing programs etc.)
- setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
-
- LoggingPanel logPanel = new LoggingPanel();
- logPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-
- createActions();
-
- setSize(1024, 800);
- Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- setLocation((screenSize.width - this.getWidth()) / 2, (int) ((screenSize.height - this.getHeight()) / 2.5));
-
- /* Create a new ConfigurationPanel (left side) */
- configurationPane = new JPanel(new GridBagLayout());
- gbConstraints.ipadx = 5;
- gbConstraints.weightx = 0.0;
- gbConstraints.weighty = 1.0;
- /* Set configurationPane at 0,1 */
- gbConstraints.gridx = 0;
- gbConstraints.gridy = 1;
- gbConstraints.fill = GridBagConstraints.VERTICAL;
- gbConstraints.gridwidth = GridBagConstraints.RELATIVE;
- gbConstraints.gridheight = GridBagConstraints.RELATIVE;
- add(configurationPane, gbConstraints);
-
- /* SplitPane for desktopPanel and loggingPanel */
- JSplitPane horizontalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
- horizontalSplit.setTopComponent(desktopPanel);
- horizontalSplit.setBottomComponent(logPanel);
- horizontalSplit.setDividerSize(8);
- horizontalSplit.setOneTouchExpandable(true);
- horizontalSplit.setResizeWeight(1.0);
- horizontalSplit.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
- horizontalSplit.setContinuousLayout(true);
-
- horizontalSplit.setDividerLocation(0.25);
- /* Add horizontal split pane at 1,1 */
- gbConstraints.gridx = 1;
- gbConstraints.gridy = 1;
- gbConstraints.fill = GridBagConstraints.BOTH;
- gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
- gbConstraints.gridheight = GridBagConstraints.RELATIVE;
- add(horizontalSplit, gbConstraints);
-
- /* StatusBar of the main frame */
- JPanel statusBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- JPanel statusBarControls = new JPanel();
- statusBarControls.setLayout(new BoxLayout(statusBarControls, BoxLayout.LINE_AXIS));
-
- statusBarControls.add(Box.createHorizontalGlue());
-
- /* Set default logging level to INFO */
- Logger.getLogger("eva2").setLevel(Level.INFO);
- /* Logging settings drop down */
- LoggingLevelLabel loggingOption = new LoggingLevelLabel();
-
- statusBarControls.add(loggingOption);
-
- statusBarControls.add(Box.createHorizontalStrut(5));
- statusBarControls.add(new JSeparator(JSeparator.VERTICAL));
- statusBarControls.add(Box.createHorizontalStrut(5));
-
- /* Create ProgressBar and add it to the status bar */
- statusBarControls.add(new JLabel("Progress"));
- statusBarControls.add(Box.createHorizontalStrut(5));
-
- progressBar = new JProgressBar();
- progressBar.setValue(0);
- progressBar.setStringPainted(true);
- statusBarControls.add(progressBar);
-
- statusBarControls.add(Box.createHorizontalStrut(5));
- statusBarControls.add(new JSeparator(JSeparator.VERTICAL));
- statusBarControls.add(Box.createHorizontalStrut(5));
- /* Create ProgressBar and add it to the status bar */
- statusBarControls.add(new JLabel("CPU"));
- statusBarControls.add(Box.createHorizontalStrut(5));
- statusBarControls.add(new CPUPanel(100));
-
- statusBar.add(statusBarControls);
-
- gbConstraints.gridx = 0;
- gbConstraints.gridy = 2;
- gbConstraints.gridwidth = 2;
- gbConstraints.weighty = 0.0;
- gbConstraints.fill = GridBagConstraints.HORIZONTAL;
- gbConstraints.anchor = GridBagConstraints.PAGE_END;
- add(statusBar, gbConstraints);
- }
-
- if (useDefaultModule != null) {
- /*
- * if optimizationParameters are not defined and a params file is defined
- * try to load parameters from file
- */
- if (optimizationParameters == null && (paramsFile != null && (paramsFile.length() > 0))) {
- optimizationParameters = OptimizationParameters.getInstance(paramsFile, false);
- }
- loadSpecificModule(useDefaultModule, optimizationParameters);//loadSpecificModule
- }
-
- if (withGUI) {
- buildMenu();
- addWindowListener(new WindowAdapter() {
-
- @Override
- public void windowClosing(final WindowEvent event) {
- int result = JOptionPane.showConfirmDialog(
- Main.this,
- "Do you really want to exit EvA2?",
- "Exit Application",
- JOptionPane.YES_NO_OPTION);
- if (result == JOptionPane.YES_OPTION) {
- Main.this.close();
- }
- }
- });
-
- LOGGER.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
- LOGGER.log(Level.FINE, "Class path is: {0}", System.getProperty("java.class.path", "."));
-
- if (!(configurationPane.isVisible())) {
- configurationPane.setVisible(true);
- }
-
- setVisible(true);
-
- // if this message is omitted, the stupid scroll pane runs to
- // the end of the last line which is ugly for a long class path
- LOGGER.info("EvA2 ready");
- }
- }
-
- /**
- * Closes EvA2 workbench. Will not kill the JVM iff
- * the MATLAB environment variable has been set.
- */
- public void close() {
- LOGGER.info("Closing EvA2 Client. Bye!");
- Set keys = System.getenv().keySet();
- if (keys.contains("MATLAB")) {
- LOGGER.info("EvA2 workbench has been started from Matlab: not killing JVM");
- } else {
- if (parentWindow == null) {
- System.exit(1);
- } else {
- this.setVisible(false);
- this.dispose();
- }
- }
- }
-
- /**
- * Refresh the parameter panels (if settings have been changed outside of
- * the GUI which should be updated in the GUI.
- */
- public void refreshMainPanels() {
- frameMaker.refreshPanels();
- }
-
/**
* The one and only main of the client program. Possible arguments:
* --autorun: immediately starts the optimization (with parameters loaded
@@ -557,9 +22,27 @@ public class Main extends JFrame implements OptimizationStateListener {
* @param args command line parameters
*/
public static void main(String[] args) {
+ // Properties for Mac OS X support.
+ if ((System.getProperty("mrj.version") != null)
+ || (System.getProperty("os.name").toLowerCase().contains("mac"))) {
+ /*
+ * Note: the xDock name property must be set before parsing
+ * command-line arguments! See above!
+ */
+ System.setProperty("com.apple.mrj.application.apple.menu.about.name", EvAInfo.productName);
+ System.setProperty("apple.awt.application.name", EvAInfo.productName);
+ System.setProperty("apple.awt.graphics.EnableQ2DX", "true");
+ System.setProperty("apple.laf.useScreenMenuBar", "true");
+ System.setProperty("com.apple.macos.smallTabs", "true");
+ System.setProperty("com.apple.macos.useScreenMenuBar", "true");
+
+ System.setProperty("com.apple.mrj.application.growbox.intrudes", "false");
+ System.setProperty("com.apple.mrj.application.live-resize", "true");
+ }
+
/* Available command-line parameters */
String[] keys = new String[]{
- "--help", "--autorun", "--nosplash", "--nogui", "--params", "--treeView"
+ "--help", "--autorun", "--nosplash", "--nogui", "--params", "--treeView"
};
/* Number of arguments per parameter */
int[] arities = new int[]{0, 0, 0, 0, 1, 0};
@@ -591,42 +74,10 @@ public class Main extends JFrame implements OptimizationStateListener {
boolean treeView = (values[5] != null);
String paramsFile = StringTools.checkSingleStringArg(keys[4], values[4], arities[4] - 1);
- new Main(paramsFile, autorun, nosplash, nogui, treeView);
+ new MainFrame(paramsFile, autorun, nosplash, nogui, treeView);
}
}
- /**
- * Initialize the client GUI with given parameters and set listeners. This
- * will return as soon as the GUI is visible and ready.
- *
- * @param goParams optimization parameters
- * @param statisticsListener statistics listener receiving data during
- * optimization
- * @param windowListener additional window listener for client frame
- */
- public static Main initClientGUI(OptimizationParameters goParams,
- InterfaceStatisticsListener statisticsListener,
- WindowListener windowListener, final Window parent) {
- Main evaClient;
-
- evaClient = new Main(parent, null, goParams,
- false, true, false, false); // initializes GUI in the background
- // important: wait for GUI initialization before accessing any internal
- // settings:
- evaClient.awaitClientInitialized(); // this returns as soon as the
- // GUI is ready
- evaClient.addWindowListener(windowListener);
- // modify initial settings and activate output of all data:
- evaClient.getStatistics().getStatisticsParameters().setOutputAllFieldsAsText(true);
- // add a data listener instance:
- evaClient.getStatistics().addDataListener(statisticsListener);
-
- // GUI update due to the changes made through the API
- evaClient.refreshMainPanels();
-
- return evaClient;
- }
-
/**
* This method returns a readable usage string.
*
@@ -655,309 +106,4 @@ public class Main extends JFrame implements OptimizationStateListener {
return sbuf.toString();
}
-
- /**
- *
- */
- private void createActions() {
-
- actAbout = new ExtAction("&About", "Product Information") {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- LOGGER.info(event.getActionCommand());
- showAboutDialog();
- }
- };
- actLicense = new ExtAction("&License", "View License") {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- LOGGER.info(event.getActionCommand());
- showLicense();
- }
- };
-
- actQuit = new ExtAction("&Quit", "Quit EvA2 workbench",
- KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK)) {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- int result = JOptionPane.showConfirmDialog(
- Main.this,
- "Do you really want to exit EvA2?",
- "Exit Application",
- JOptionPane.YES_NO_OPTION);
- if (result == JOptionPane.YES_OPTION) {
- Main.this.close();
- }
- }
- };
-
- actPreferences = new ExtAction("&Preferences", "Show preferences dialog",
- KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK)) {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- // ToDo
- }
- };
-
- actHelp = new ExtAction("&Help", "Show help contents",
- KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)) {
-
- @Override
- public void actionPerformed(final ActionEvent event) {
- // ToDo
- String helpHS = "EvA2Help/EvA2Help.hs";
- ClassLoader cl = Main.class.getClassLoader();
- JHelpContentViewer helpPane;
- try {
- URL hsURL = HelpSet.findHelpSet(cl, helpHS);
- HelpSet helpSet = new HelpSet(null, hsURL);
- // Trigger the help viewer:
- helpPane = new JHelpContentViewer(helpSet);
- JHelpNavigator helpNavigator = (JHelpNavigator) helpSet.getNavigatorView("TOC").createNavigator(helpPane.getModel());
- JEFrame helpFrame = new JEFrame("Help contents");
- JSplitPane helpSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, helpNavigator, helpPane);
- helpFrame.add(helpSplit);
- helpFrame.setVisible(true);
- helpFrame.setMaximum(true);
- } catch (Exception ee) {
- // Say what the exception really is
- LOGGER.log(Level.WARNING, "Could not open application help", ee);
- }
- }
- };
- }
-
- /**
- * Create the main menu and add actions.
- */
- private void buildMenu() {
- JMenuBar menuBar = new JMenuBar();
- setJMenuBar(menuBar);
-
- JExtMenu menuHelp = new JExtMenu("&Help");
- menuHelp.add(actHelp);
- menuHelp.addSeparator();
- menuHelp.add(actAbout);
- menuHelp.add(actLicense);
-
- JExtMenu menuOptions = new JExtMenu("&Options");
- menuOptions.add(actPreferences);
- menuOptions.addSeparator();
- menuOptions.add(actQuit);
-
- menuBar.add(menuOptions);
- menuBar.add(((JExtDesktopPane) desktopPane).getWindowMenu());
- menuBar.add(menuHelp);
- }
-
- /**
- * Retrieve the optimization parameters of a loaded module. Return null if no module is
- * loaded.
- *
- * @return
- */
- public InterfaceOptimizationParameters getOptimizationParameters() {
- if (currentModuleAdapter != null) {
- if (currentModuleAdapter instanceof AbstractModuleAdapter) {
- return ((AbstractModuleAdapter) currentModuleAdapter).getOptimizationParameters();
- }
- }
- return null;
- }
-
- public AbstractStatistics getStatistics() {
- return ((GenericModuleAdapter) currentModuleAdapter).getStatistics();
- }
-
- public InterfaceStatisticsParameters getStatisticsParameter() {
- return ((GenericModuleAdapter) currentModuleAdapter).getStatistics().getStatisticsParameters();
- }
-
- private void loadSpecificModule(String selectedModule, InterfaceOptimizationParameters optimizationParameters) {
- ModuleAdapter newModuleAdapter = null;
- //
- try {
- InterfaceOptimizationParameters params = optimizationParameters;
- if (optimizationParameters == null) {
- params = OptimizationParameters.getInstance();
- }
- newModuleAdapter = new GOModuleAdapter(selectedModule, params, withGUI ? null : "EvA2");
- //newModuleAdapter = comAdapter.getModuleAdapter(selectedModule, optimizationParameters, withGUI ? null : "EvA2");
- } catch (Exception e) {
- LOGGER.log(Level.SEVERE, "Error loading module.", e);
- EVAERROR.EXIT("Error while comAdapter.GetModuleAdapter Host: " + e.getMessage());
- }
- if (newModuleAdapter == null) {
- // When launching a Java Web Start application, baseDir will always be null!
- URL baseDir = getClass().getClassLoader().getResource("");
- String cp = System.getProperty("java.class.path", ".");
- String dir = (baseDir == null) ? System.getProperty("user.dir") : baseDir.getPath();
-
- if (!cp.contains(dir)) {
- // this was added due to matlab not adding base dir to base path...
- System.err.println("classpath does not contain base directory!");
- System.err.println("adding base dir and trying again...");
- System.setProperty("java.class.path", cp + System.getProperty("path.separator") + dir);
- ReflectPackage.resetDynCP();
- comAdapter.updateLocalMainAdapter();
- loadSpecificModule(selectedModule, optimizationParameters); // end recursive call! handle with care!
- }
- } else {
- newModuleAdapter.addOptimizationStateListener(this);
- try {
- if (withGUI) {
- // this (or rather: EvAModuleButtonPanelMaker) is where the start button etc come from!
- frameMaker = newModuleAdapter.getModuleFrame();
-
- /* This is the left TabPane on the main frame */
- JPanel moduleContainer = frameMaker.makePanel();
-
- configurationPane.setVisible(false);
- configurationPane.removeAll();
-
- GridBagConstraints gbConstraints = new GridBagConstraints();
-
- /* ToDo: Find a way to properly add the TreeView to the GOPanel */
- if (withTreeView && (newModuleAdapter instanceof AbstractModuleAdapter)) {
- JComponent tree = null;
- tree = getEvATreeView(frameMaker.getGOPanel(), "OptimizationParameters", ((AbstractModuleAdapter) newModuleAdapter).getOptimizationParameters());
- gbConstraints.gridx = 0;
- gbConstraints.gridy = 0;
- gbConstraints.fill = GridBagConstraints.BOTH;
- gbConstraints.weightx = 1.0;
- gbConstraints.weighty = 1.0;
- configurationPane.add(tree, gbConstraints);
- }
-
-
- gbConstraints.weightx = 1.0;
- gbConstraints.weighty = 0.0;
- gbConstraints.gridx = 0;
- gbConstraints.gridy = 0;
- gbConstraints.gridwidth = 2;
- gbConstraints.fill = GridBagConstraints.HORIZONTAL;
- gbConstraints.anchor = GridBagConstraints.PAGE_START;
- add(frameMaker.getToolBar(), gbConstraints);
-
- GridBagConstraints gbConstraints2 = new GridBagConstraints();
- gbConstraints2.gridx = 0;
- gbConstraints2.gridy = 0;
- gbConstraints2.fill = GridBagConstraints.VERTICAL;
- gbConstraints2.weighty = 1.0;
- configurationPane.add(moduleContainer, gbConstraints2);
- configurationPane.validate();
- }
-
-
- } catch (Exception e) {
- LOGGER.log(Level.SEVERE, "Error while newModuleAdapter.getModuleFrame(): " + e.getMessage(), e);
- EVAERROR.EXIT("Error while newModuleAdapter.getModuleFrame(): " + e.getMessage());
- }
-
- currentModuleAdapter = newModuleAdapter;
- }
- }
-
- /**
- * Create a tree view of an object based on EvATreeNode. It is encapsulated
- * in a JScrollPane.
- *
- * @param goPanel
- * @param title
- * @param object
- * @return
- * @see eva2.gui.EvATreeNode
- */
- public JComponent getEvATreeView(JParaPanel goPanel, String title, Object object) {
- EvATreeNode root = new EvATreeNode(title, object); // the root of the tree
- JTree jtree = new JTree(root);
- JScrollPane treeView = new JScrollPane(jtree);
-
- EvATreeSelectionListener treeListener = new EvATreeSelectionListener(root, goPanel.getEditor(), jtree);
- // hooks itself up as the tree listener. It reacts both to changes in the selection
- // state of the tree (to update the parameter panel) and to changes in the
- // parameters to update the tree
- return treeView;
- }
-
- private void showAboutDialog() {
- AboutDialog aboutDialog = new AboutDialog(this);
- aboutDialog.setLocationRelativeTo(this);
- aboutDialog.setVisible(true);
- aboutDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
- }
-
- private void showLicense() {
- HtmlDemo lgpl = new HtmlDemo(EvAInfo.LGPLFile);
- HtmlDemo gpl = new HtmlDemo(EvAInfo.GPLFile);
- gpl.show();
- lgpl.show();
- }
-
- @Override
- public void performedRestart(String infoString) {
- if (superListenerList != null) {
- for (OptimizationStateListener l : superListenerList) {
- l.performedRestart(infoString);
- }
- }
- LOGGER.log(Level.INFO, "Restarted processing {0}", infoString);
- startTime = System.currentTimeMillis();
- }
-
- @Override
- public void performedStart(String infoString) {
- if (superListenerList != null) {
- for (OptimizationStateListener l : superListenerList) {
- l.performedStart(infoString);
- }
- }
- LOGGER.log(Level.INFO, "Started processing {0}", infoString);
- startTime = System.currentTimeMillis();
- }
-
- @Override
- public void performedStop() {
- if (superListenerList != null) {
- for (OptimizationStateListener l : superListenerList) {
- l.performedStop();
- }
- }
- long t = (System.currentTimeMillis() - startTime);
- LOGGER.info(String.format("Stopped after %1$d.%2$tL s", (t / 1000), (t % 1000)));
- if (!withGUI) {
- System.exit(0);
- }
- }
-
- /**
- * When the worker needs to update the GUI we do so by queuing a Runnable
- * for the event dispatching thread with SwingUtilities.invokeLater(). In
- * this case we're just changing the progress bars value.
- */
- @Override
- public void updateProgress(final int percent, String msg) {
- if (superListenerList != null) {
- for (OptimizationStateListener l : superListenerList) {
- l.updateProgress(percent, msg);
- }
- }
- if (msg != null) {
- LOGGER.info(msg);
- }
- if (this.progressBar != null) {
- Runnable doSetProgressBarValue = new Runnable() {
-
- @Override
- public void run() {
- progressBar.setValue(percent);
- }
- };
- SwingUtilities.invokeLater(doSetProgressBarValue);
- }
- }
}
diff --git a/src/eva2/gui/MainFrame.java b/src/eva2/gui/MainFrame.java
new file mode 100644
index 00000000..794e4067
--- /dev/null
+++ b/src/eva2/gui/MainFrame.java
@@ -0,0 +1,872 @@
+package eva2.gui;
+
+import eva2.EvAInfo;
+import eva2.optimization.InterfaceOptimizationParameters;
+import eva2.optimization.OptimizationParameters;
+import eva2.optimization.OptimizationStateListener;
+import eva2.optimization.modules.AbstractModuleAdapter;
+import eva2.optimization.modules.GenericModuleAdapter;
+import eva2.optimization.modules.ModuleAdapter;
+import eva2.optimization.modules.OptimizationModuleAdapter;
+import eva2.optimization.statistics.AbstractStatistics;
+import eva2.optimization.statistics.InterfaceStatisticsListener;
+import eva2.optimization.statistics.InterfaceStatisticsParameters;
+import eva2.tools.BasicResourceLoader;
+import eva2.tools.EVAERROR;
+import eva2.tools.ReflectPackage;
+import eva2.util.ClassPreloader;
+
+import javax.help.HelpSet;
+import javax.help.JHelpContentViewer;
+import javax.help.JHelpNavigator;
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ *
+ */
+public class MainFrame extends JFrame implements OptimizationStateListener {
+
+ /**
+ * Generated serial version identifier.
+ */
+ private static final long serialVersionUID = 8232856334379977970L;
+ private final int splashScreenTime;
+ private boolean clientInitialized = false;
+ private JDesktopPane desktopPane;
+ private JPanel configurationPane;
+ private Runnable initRunnable = null;
+
+ private transient JProgressBar progressBar;
+
+ // Option
+ private ExtAction actPreferences;
+ private ExtAction actQuit;
+
+ private static final Logger LOGGER = Logger.getLogger(MainFrame.class.getName());
+
+ // Configurable module:
+ private ModuleAdapter currentModuleAdapter = null;
+
+ // Help:
+ private ExtAction actHelp;
+ private ExtAction actAbout;
+ private ExtAction actLicense;
+
+ // if not null, the module is loaded automatically and no other can be selected
+ private String useDefaultModule = null; //"Genetic_Optimization";
+
+
+ // measuring optimization runtime
+ private long startTime = 0;
+ private boolean withGUI = true;
+ private boolean withTreeView = false;
+ private EvATabbedFrameMaker frameMaker = null;
+ private Window parentWindow;
+
+ private java.util.List superListenerList = null;
+
+
+ public void addOptimizationStateListener(OptimizationStateListener l) {
+ if (superListenerList == null) {
+ superListenerList = new ArrayList<>();
+ }
+ superListenerList.add(l);
+ }
+
+ public boolean removeOptimizationStateListener(OptimizationStateListener l) {
+ return superListenerList != null && superListenerList.remove(l);
+ }
+
+ /**
+ * Constructor of GUI of EvA2. Works as client for the EvA2 server. Note
+ * that the Main initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()} }
+ * to await full initialization if necessary.
+ */
+ public MainFrame() {
+ this(null, false, false);
+ }
+
+ /**
+ * A constructor. Splash screen is optional, Gui is activated, no parent
+ * window. Note that the Main initialized multi-threaded for
+ * efficiency. Use {@link #awaitClientInitialized()} to await full
+ * initialization if necessary.
+ *
+ * @param paramsFile
+ * @param autorun
+ * @param nosplash
+ */
+ public MainFrame(final String paramsFile, boolean autorun, boolean nosplash) {
+ this(null, paramsFile, null, autorun, nosplash, false, false);
+ }
+
+ /**
+ * A constructor with optional spash screen. Note that the Main is
+ * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
+ * to await full initialization if necessary.
+ *
+ * @param autorun
+ * @param nosplash
+ * @see #MainFrame(String, boolean, boolean)
+ */
+ public MainFrame(boolean autorun, boolean nosplash) {
+ this(null, autorun, nosplash);
+ }
+
+ /**
+ * A constructor with optional splash screen. Note that the Main
+ * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
+ * to await full initialization if necessary.
+ *
+ * @param paramsFile
+ * @param autorun
+ * @param noSplash
+ * @param noGui
+ * @see #MainFrame(boolean, boolean)
+ */
+ public MainFrame(String paramsFile, boolean autorun, boolean noSplash, boolean noGui, boolean withTreeView) {
+ this(null, paramsFile, null, autorun, noSplash, noGui, withTreeView);
+ }
+
+ /**
+ * A constructor with optional splash screen. Note that the Main
+ * initialized multi-threaded for efficiency. Use {@link #awaitClientInitialized()}
+ * to await full initialization if necessary.
+ *
+ * @param optimizationParameters
+ * @param autorun
+ * @param noSplash
+ * @param noGui
+ * @see #MainFrame(String, boolean, boolean)
+ */
+ public MainFrame(InterfaceOptimizationParameters optimizationParameters, boolean autorun, boolean noSplash, boolean noGui) {
+ this(null, null, optimizationParameters, autorun, noSplash, noGui, false);
+ }
+
+ /**
+ * Do not use the tree view by default.
+ *
+ * @param parent
+ * @param paramsFile
+ * @param goParams
+ * @param autorun
+ * @param noSplash
+ * @param noGui
+ */
+ public MainFrame(final Window parent, final String paramsFile, final InterfaceOptimizationParameters goParams, final boolean autorun, final boolean noSplash, final boolean noGui) {
+ this(parent, paramsFile, goParams, autorun, noSplash, noGui, false);
+ }
+
+ /**
+ * Main constructor of the EvA2 client GUI. Works as standalone version
+ * locally or as client for the EvA2 server. GO parameters may be loaded
+ * from a file (paramsFile) or given directly as a java instance. Both may
+ * be null to start with standard parameters. If both are non null, the java
+ * instance has the higher priority. Note that the Main initialized
+ * multi-threaded for efficiency. Use {@link #awaitClientInitialized()} to
+ * await full initialization if necessary.
+ *
+ * @param parent
+ * @param paramsFile
+ * @param autorun
+ * @param noSplash
+ * @param noGui
+ */
+ public MainFrame(final Window parent, final String paramsFile, final InterfaceOptimizationParameters optimizationParameters, final boolean autorun, final boolean noSplash, final boolean noGui, final boolean showTreeView) {
+ clientInitialized = false;
+ final eva2.gui.SplashScreen splashScreen = new eva2.gui.SplashScreen(EvAInfo.splashLocation);
+
+ // preload some classes (into system cache) in a parallel thread
+ preloadClasses();
+
+ withGUI = !noGui;
+ withTreeView = showTreeView;
+ // activate the splash screen (show later using SwingUtilities)
+ if (!noSplash && withGUI) {
+ try {
+ splashScreen.splash();
+ } catch (HeadlessException e) {
+ LOGGER.severe("Error: no xserver present - deactivating GUI.");
+ withGUI = false;
+ }
+ }
+
+ splashScreenTime = 2500;
+ initRunnable = new Runnable() {
+
+ @Override
+ public void run() {
+ synchronized (this) {
+ long startTime = System.currentTimeMillis();
+ init(paramsFile, optimizationParameters, parent); // this takes a bit
+
+ long wait = System.currentTimeMillis() - startTime;
+ LOGGER.info("Loaded EvA2 in " + wait + "ms.");
+ if (!autorun) {
+ if (!noSplash) {
+ try {
+ // if splashScreenTime has not passed, sleep some more
+ if (wait < splashScreenTime) {
+ Thread.sleep(splashScreenTime - wait);
+ }
+ } catch (Exception ignored) {
+ }
+ }
+ } else {
+ if (!withGUI && (currentModuleAdapter instanceof GenericModuleAdapter)) {
+ // do not save new parameters for an autorun without GUI - they weren't changed manually anyways.
+ ((GenericModuleAdapter) currentModuleAdapter).getStatistics().setSaveParams(false);
+ LOGGER.info("Autorun without GUI - not saving statistics parameters...");
+ }
+ if (withGUI) {
+ frameMaker.onUserStart();
+ } else {
+ currentModuleAdapter.startOptimization();
+ }
+ }
+ // close splash screen
+ if (!noSplash && withGUI) {
+ splashScreen.dispose();
+ }
+ clientInitialized = true;
+ notifyAll();
+ }
+ }
+ };
+ SwingUtilities.invokeLater(initRunnable);
+ }
+
+ private void initLookAndFeel() {
+ // The native L&F on Linux looks horrible - don't set it.
+ if (System.getProperty("os.name").equals("Linux")) {
+ return;
+ }
+
+ // Properties for Mac OS X support.
+ if ((System.getProperty("mrj.version") != null)
+ || (System.getProperty("os.name").toLowerCase().contains("mac"))) {
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
+ LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
+ }
+ } else {
+ /* Set Look and Feel */
+ try {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ } catch (Exception ex) {
+ LOGGER.log(Level.INFO, "Could not set Look&Feel", ex);
+ }
+ }
+ }
+
+ /**
+ * Since the constructor runs multi-threaded for efficiency, this method may
+ * be called to await the full initialization of a client instance. As soon
+ * as it returns, the Main GUI is fully initialized.
+ */
+ public void awaitClientInitialized() {
+ if (initRunnable != null) {
+ synchronized (initRunnable) {
+ if (!clientInitialized) {
+ try {
+ initRunnable.wait();
+ initRunnable = null;
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ private void preloadClasses() {
+ ClassPreloader cp = new ClassPreloader("eva2.optimization.strategies.InterfaceOptimizer", "eva2.problems.InterfaceOptimizationProblem", "eva2.optimization.operator.terminators.InterfaceTerminator");
+ new Thread(cp).start();
+ }
+
+ /**
+ * Try to start the optimization with current parameters on the loaded
+ * module. Return true on success, otherwise false.
+ *
+ * @return
+ */
+ public boolean startOptimization() {
+ if (currentModuleAdapter != null) {
+ currentModuleAdapter.startOptimization();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ /**
+ * Set UI Font for all controls.
+ *
+ * @param fontResource The FontUIResource for the controls
+ */
+ private static void setUIFont(javax.swing.plaf.FontUIResource fontResource) {
+ Enumeration keys = UIManager.getDefaults().keys();
+ while (keys.hasMoreElements()) {
+ Object key = keys.nextElement();
+ Object value = UIManager.get(key);
+ if (value != null && value instanceof javax.swing.plaf.FontUIResource) {
+ UIManager.put(key, fontResource);
+ }
+ }
+ }
+
+ /**
+ * Tries to load OptimizationParameters from given file if not null.
+ */
+ private void init(String paramsFile, InterfaceOptimizationParameters optimizationParameters, final Window parent) {
+ useDefaultModule = EvAInfo.propDefaultModule();
+ this.parentWindow = parent;
+
+ setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
+
+ setUIFont(new javax.swing.plaf.FontUIResource(Font.SANS_SERIF, 0, 11));
+
+ if (useDefaultModule != null) {
+ useDefaultModule = useDefaultModule.trim();
+ if (useDefaultModule.length() < 1) {
+ useDefaultModule = null;
+ }
+ }
+
+ if (withGUI) {
+ // Initialize look and feel for EvA2
+ initLookAndFeel();
+
+ GridBagConstraints gbConstraints = new GridBagConstraints();
+
+ /* Create main frame with GridBagLayout */
+ setTitle(EvAInfo.productName);
+ setLayout(new GridBagLayout());
+ setMinimumSize(new Dimension(1024, 800));
+
+ /* Creates the desktopPane for Plot/Text Output */
+ desktopPane = new JExtDesktopPane();
+ JEFrameRegister.getInstance().setDesktopPane(desktopPane);
+ /* Creates desktopPane ToolBar to show tiling buttons */
+ JExtDesktopPaneToolBar desktopToolBar = new JExtDesktopPaneToolBar((JExtDesktopPane) desktopPane);
+
+ /* Pane to hold ToolBar + DesktopPane */
+ JPanel desktopPanel = new JPanel(new GridBagLayout());
+ GridBagConstraints desktopConst = new GridBagConstraints();
+ desktopConst.gridx = 0;
+ desktopConst.gridy = 0;
+ desktopConst.fill = GridBagConstraints.HORIZONTAL;
+ desktopConst.weightx = 1.0;
+ desktopPanel.add(desktopToolBar, desktopConst);
+ desktopConst.gridy = 1;
+ desktopConst.fill = GridBagConstraints.BOTH;
+ desktopConst.weighty = 1.0;
+ desktopPanel.add(desktopPane, desktopConst);
+
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
+ byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
+ // TODO: use setIconImages (for better support of multiple icons when changing programs etc.)
+ setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
+
+ LoggingPanel logPanel = new LoggingPanel();
+ logPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ createActions();
+
+ setSize(1024, 800);
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ setLocation((screenSize.width - this.getWidth()) / 2, (int) ((screenSize.height - this.getHeight()) / 2.5));
+
+ /* Create a new ConfigurationPanel (left side) */
+ configurationPane = new JPanel(new GridBagLayout());
+ gbConstraints.ipadx = 5;
+ gbConstraints.weightx = 0.0;
+ gbConstraints.weighty = 1.0;
+ /* Set configurationPane at 0,1 */
+ gbConstraints.gridx = 0;
+ gbConstraints.gridy = 1;
+ gbConstraints.fill = GridBagConstraints.VERTICAL;
+ gbConstraints.gridwidth = GridBagConstraints.RELATIVE;
+ gbConstraints.gridheight = GridBagConstraints.RELATIVE;
+ add(configurationPane, gbConstraints);
+
+ /* SplitPane for desktopPanel and loggingPanel */
+ JSplitPane horizontalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true);
+ horizontalSplit.setTopComponent(desktopPanel);
+ horizontalSplit.setBottomComponent(logPanel);
+ horizontalSplit.setDividerSize(8);
+ horizontalSplit.setOneTouchExpandable(true);
+ horizontalSplit.setResizeWeight(1.0);
+ horizontalSplit.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1));
+ horizontalSplit.setContinuousLayout(true);
+
+ horizontalSplit.setDividerLocation(0.25);
+ /* Add horizontal split pane at 1,1 */
+ gbConstraints.gridx = 1;
+ gbConstraints.gridy = 1;
+ gbConstraints.fill = GridBagConstraints.BOTH;
+ gbConstraints.gridwidth = GridBagConstraints.REMAINDER;
+ gbConstraints.gridheight = GridBagConstraints.RELATIVE;
+ add(horizontalSplit, gbConstraints);
+
+ /* StatusBar of the main frame */
+ JPanel statusBar = new JPanel(new FlowLayout(FlowLayout.RIGHT));
+ JPanel statusBarControls = new JPanel();
+ statusBarControls.setLayout(new BoxLayout(statusBarControls, BoxLayout.LINE_AXIS));
+
+ statusBarControls.add(Box.createHorizontalGlue());
+
+ /* Set default logging level to INFO */
+ Logger.getLogger("eva2").setLevel(Level.INFO);
+ /* Logging settings drop down */
+ LoggingLevelLabel loggingOption = new LoggingLevelLabel();
+
+ statusBarControls.add(loggingOption);
+
+ statusBarControls.add(Box.createHorizontalStrut(5));
+ statusBarControls.add(new JSeparator(JSeparator.VERTICAL));
+ statusBarControls.add(Box.createHorizontalStrut(5));
+
+ /* Create ProgressBar and add it to the status bar */
+ statusBarControls.add(new JLabel("Progress"));
+ statusBarControls.add(Box.createHorizontalStrut(5));
+
+ progressBar = new JProgressBar();
+ progressBar.setValue(0);
+ progressBar.setStringPainted(true);
+ statusBarControls.add(progressBar);
+
+ statusBarControls.add(Box.createHorizontalStrut(5));
+ statusBarControls.add(new JSeparator(JSeparator.VERTICAL));
+ statusBarControls.add(Box.createHorizontalStrut(5));
+ /* Create ProgressBar and add it to the status bar */
+ statusBarControls.add(new JLabel("CPU"));
+ statusBarControls.add(Box.createHorizontalStrut(5));
+ statusBarControls.add(new CPUPanel(100));
+
+ statusBar.add(statusBarControls);
+
+ gbConstraints.gridx = 0;
+ gbConstraints.gridy = 2;
+ gbConstraints.gridwidth = 2;
+ gbConstraints.weighty = 0.0;
+ gbConstraints.fill = GridBagConstraints.HORIZONTAL;
+ gbConstraints.anchor = GridBagConstraints.PAGE_END;
+ add(statusBar, gbConstraints);
+ }
+
+ if (useDefaultModule != null) {
+ /*
+ * if optimizationParameters are not defined and a params file is defined
+ * try to load parameters from file
+ */
+ if (optimizationParameters == null && (paramsFile != null && (paramsFile.length() > 0))) {
+ optimizationParameters = OptimizationParameters.getInstance(paramsFile, false);
+ }
+ loadSpecificModule(useDefaultModule, optimizationParameters);//loadSpecificModule
+ }
+
+ if (withGUI) {
+ buildMenu();
+ addWindowListener(new WindowAdapter() {
+
+ @Override
+ public void windowClosing(final WindowEvent event) {
+ int result = JOptionPane.showConfirmDialog(
+ MainFrame.this,
+ "Do you really want to exit EvA2?",
+ "Exit Application",
+ JOptionPane.YES_NO_OPTION);
+ if (result == JOptionPane.YES_OPTION) {
+ MainFrame.this.close();
+ }
+ }
+ });
+
+ LOGGER.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
+ LOGGER.log(Level.FINE, "Class path is: {0}", System.getProperty("java.class.path", "."));
+
+ if (!(configurationPane.isVisible())) {
+ configurationPane.setVisible(true);
+ }
+
+ setVisible(true);
+
+ // if this message is omitted, the stupid scroll pane runs to
+ // the end of the last line which is ugly for a long class path
+ LOGGER.info("EvA2 ready");
+ }
+ }
+
+ /**
+ * Closes EvA2 workbench. Will not kill the JVM iff
+ * the MATLAB environment variable has been set.
+ */
+ public void close() {
+ LOGGER.info("Closing EvA2 Client. Bye!");
+ Set keys = System.getenv().keySet();
+ if (keys.contains("MATLAB")) {
+ LOGGER.info("EvA2 workbench has been started from Matlab: not killing JVM");
+ } else {
+ if (parentWindow == null) {
+ System.exit(1);
+ } else {
+ this.setVisible(false);
+ this.dispose();
+ }
+ }
+ }
+
+ /**
+ * Refresh the parameter panels (if settings have been changed outside of
+ * the GUI which should be updated in the GUI.
+ */
+ public void refreshMainPanels() {
+ frameMaker.refreshPanels();
+ }
+
+ /**
+ * Initialize the client GUI with given parameters and set listeners. This
+ * will return as soon as the GUI is visible and ready.
+ *
+ * @param goParams optimization parameters
+ * @param statisticsListener statistics listener receiving data during
+ * optimization
+ * @param windowListener additional window listener for client frame
+ */
+ public static MainFrame initClientGUI(OptimizationParameters goParams,
+ InterfaceStatisticsListener statisticsListener,
+ WindowListener windowListener, final Window parent) {
+ MainFrame evaClient;
+
+ evaClient = new MainFrame(parent, null, goParams,
+ false, true, false, false); // initializes GUI in the background
+ // important: wait for GUI initialization before accessing any internal
+ // settings:
+ evaClient.awaitClientInitialized(); // this returns as soon as the
+ // GUI is ready
+ evaClient.addWindowListener(windowListener);
+ // modify initial settings and activate output of all data:
+ evaClient.getStatistics().getStatisticsParameters().setOutputAllFieldsAsText(true);
+ // add a data listener instance:
+ evaClient.getStatistics().addDataListener(statisticsListener);
+
+ // GUI update due to the changes made through the API
+ evaClient.refreshMainPanels();
+
+ return evaClient;
+ }
+
+ /**
+ *
+ */
+ private void createActions() {
+
+ actAbout = new ExtAction("&About", "Product Information") {
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ LOGGER.info(event.getActionCommand());
+ showAboutDialog();
+ }
+ };
+ actLicense = new ExtAction("&License", "View License") {
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ LOGGER.info(event.getActionCommand());
+ showLicense();
+ }
+ };
+
+ actQuit = new ExtAction("&Quit", "Quit EvA2 workbench",
+ KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_MASK)) {
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ int result = JOptionPane.showConfirmDialog(
+ MainFrame.this,
+ "Do you really want to exit EvA2?",
+ "Exit Application",
+ JOptionPane.YES_NO_OPTION);
+ if (result == JOptionPane.YES_OPTION) {
+ MainFrame.this.close();
+ }
+ }
+ };
+
+ actPreferences = new ExtAction("&Preferences", "Show preferences dialog",
+ KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.CTRL_MASK)) {
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ // ToDo
+ }
+ };
+
+ actHelp = new ExtAction("&Help", "Show help contents",
+ KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)) {
+
+ @Override
+ public void actionPerformed(final ActionEvent event) {
+ // ToDo
+ String helpHS = "EvA2Help/EvA2Help.hs";
+ ClassLoader cl = MainFrame.class.getClassLoader();
+ JHelpContentViewer helpPane;
+ try {
+ URL hsURL = HelpSet.findHelpSet(cl, helpHS);
+ HelpSet helpSet = new HelpSet(null, hsURL);
+ // Trigger the help viewer:
+ helpPane = new JHelpContentViewer(helpSet);
+ JHelpNavigator helpNavigator = (JHelpNavigator) helpSet.getNavigatorView("TOC").createNavigator(helpPane.getModel());
+ JEFrame helpFrame = new JEFrame("Help contents");
+ JSplitPane helpSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, helpNavigator, helpPane);
+ helpFrame.add(helpSplit);
+ helpFrame.setVisible(true);
+ helpFrame.setMaximum(true);
+ } catch (Exception ee) {
+ // Say what the exception really is
+ LOGGER.log(Level.WARNING, "Could not open application help", ee);
+ }
+ }
+ };
+ }
+
+ /**
+ * Create the main menu and add actions.
+ */
+ private void buildMenu() {
+ JMenuBar menuBar = new JMenuBar();
+ setJMenuBar(menuBar);
+
+ JExtMenu menuHelp = new JExtMenu("&Help");
+ menuHelp.add(actHelp);
+ menuHelp.addSeparator();
+ menuHelp.add(actAbout);
+ menuHelp.add(actLicense);
+
+ JExtMenu menuOptions = new JExtMenu("&Options");
+ menuOptions.add(actPreferences);
+ menuOptions.addSeparator();
+ menuOptions.add(actQuit);
+
+ menuBar.add(menuOptions);
+ menuBar.add(((JExtDesktopPane) desktopPane).getWindowMenu());
+ menuBar.add(menuHelp);
+ }
+
+ /**
+ * Retrieve the optimization parameters of a loaded module. Return null if no module is
+ * loaded.
+ *
+ * @return
+ */
+ public InterfaceOptimizationParameters getOptimizationParameters() {
+ if (currentModuleAdapter != null) {
+ if (currentModuleAdapter instanceof AbstractModuleAdapter) {
+ return ((AbstractModuleAdapter) currentModuleAdapter).getOptimizationParameters();
+ }
+ }
+ return null;
+ }
+
+ public AbstractStatistics getStatistics() {
+ return ((GenericModuleAdapter) currentModuleAdapter).getStatistics();
+ }
+
+ public InterfaceStatisticsParameters getStatisticsParameter() {
+ return ((GenericModuleAdapter) currentModuleAdapter).getStatistics().getStatisticsParameters();
+ }
+
+ private void loadSpecificModule(String selectedModule, InterfaceOptimizationParameters optimizationParameters) {
+ ModuleAdapter newModuleAdapter = null;
+ //
+ try {
+ InterfaceOptimizationParameters params = optimizationParameters;
+ if (optimizationParameters == null) {
+ params = OptimizationParameters.getInstance();
+ }
+ newModuleAdapter = new OptimizationModuleAdapter(selectedModule, params, withGUI ? null : "EvA2");
+ } catch (Exception e) {
+ LOGGER.log(Level.SEVERE, "Error loading module.", e);
+ EVAERROR.EXIT("Error while comAdapter.GetModuleAdapter Host: " + e.getMessage());
+ }
+ if (newModuleAdapter == null) {
+ // When launching a Java Web Start application, baseDir will always be null!
+ URL baseDir = getClass().getClassLoader().getResource("");
+ String cp = System.getProperty("java.class.path", ".");
+ String dir = (baseDir == null) ? System.getProperty("user.dir") : baseDir.getPath();
+
+ if (!cp.contains(dir)) {
+ // this was added due to matlab not adding base dir to base path...
+ System.err.println("classpath does not contain base directory!");
+ System.err.println("adding base dir and trying again...");
+ System.setProperty("java.class.path", cp + System.getProperty("path.separator") + dir);
+ ReflectPackage.resetDynCP();
+ loadSpecificModule(selectedModule, optimizationParameters); // end recursive call! handle with care!
+ }
+ } else {
+ newModuleAdapter.addOptimizationStateListener(this);
+ try {
+ if (withGUI) {
+ // this (or rather: EvAModuleButtonPanelMaker) is where the start button etc come from!
+ frameMaker = newModuleAdapter.getModuleFrame();
+
+ /* This is the left TabPane on the main frame */
+ JPanel moduleContainer = frameMaker.makePanel();
+
+ configurationPane.setVisible(false);
+ configurationPane.removeAll();
+
+ GridBagConstraints gbConstraints = new GridBagConstraints();
+
+ /* ToDo: Find a way to properly add the TreeView to the GOPanel */
+ if (false && (newModuleAdapter instanceof AbstractModuleAdapter)) {
+ JComponent tree = null;
+ tree = getEvATreeView(frameMaker.getOptimizationParametersPanel(), "OptimizationParameters", ((AbstractModuleAdapter) newModuleAdapter).getOptimizationParameters());
+ gbConstraints.gridx = 0;
+ gbConstraints.gridy = 0;
+ gbConstraints.fill = GridBagConstraints.BOTH;
+ gbConstraints.weightx = 1.0;
+ gbConstraints.weighty = 1.0;
+ configurationPane.add(tree, gbConstraints);
+ }
+
+
+ gbConstraints.weightx = 1.0;
+ gbConstraints.weighty = 0.0;
+ gbConstraints.gridx = 0;
+ gbConstraints.gridy = 0;
+ gbConstraints.gridwidth = 2;
+ gbConstraints.fill = GridBagConstraints.HORIZONTAL;
+ gbConstraints.anchor = GridBagConstraints.PAGE_START;
+ add(frameMaker.getToolBar(), gbConstraints);
+
+ GridBagConstraints gbConstraints2 = new GridBagConstraints();
+ gbConstraints2.gridx = 0;
+ gbConstraints2.gridy = 0;
+ gbConstraints2.fill = GridBagConstraints.VERTICAL;
+ gbConstraints2.weighty = 1.0;
+ configurationPane.add(moduleContainer, gbConstraints2);
+ configurationPane.validate();
+ }
+
+
+ } catch (Exception e) {
+ LOGGER.log(Level.SEVERE, "Error while newModuleAdapter.getModuleFrame(): " + e.getMessage(), e);
+ EVAERROR.EXIT("Error while newModuleAdapter.getModuleFrame(): " + e.getMessage());
+ }
+
+ currentModuleAdapter = newModuleAdapter;
+ }
+ }
+
+ /**
+ * Create a tree view of an object based on EvATreeNode. It is encapsulated
+ * in a JScrollPane.
+ *
+ * @param goPanel
+ * @param title
+ * @param object
+ * @return
+ * @see eva2.gui.EvATreeNode
+ */
+ public JComponent getEvATreeView(JParaPanel goPanel, String title, Object object) {
+ EvATreeNode root = new EvATreeNode(title, object); // the root of the tree
+ JTree jtree = new JTree(root);
+ JScrollPane treeView = new JScrollPane(jtree);
+
+ EvATreeSelectionListener treeListener = new EvATreeSelectionListener(root, goPanel.getEditor(), jtree);
+ // hooks itself up as the tree listener. It reacts both to changes in the selection
+ // state of the tree (to update the parameter panel) and to changes in the
+ // parameters to update the tree
+ return treeView;
+ }
+
+ private void showAboutDialog() {
+ AboutDialog aboutDialog = new AboutDialog(this);
+ aboutDialog.setLocationRelativeTo(this);
+ aboutDialog.setVisible(true);
+ aboutDialog.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
+ }
+
+ private void showLicense() {
+ HtmlDemo lgpl = new HtmlDemo(EvAInfo.LGPLFile);
+ HtmlDemo gpl = new HtmlDemo(EvAInfo.GPLFile);
+ gpl.show();
+ lgpl.show();
+ }
+
+ @Override
+ public void performedRestart(String infoString) {
+ if (superListenerList != null) {
+ for (OptimizationStateListener l : superListenerList) {
+ l.performedRestart(infoString);
+ }
+ }
+ LOGGER.log(Level.INFO, "Restarted processing {0}", infoString);
+ startTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public void performedStart(String infoString) {
+ if (superListenerList != null) {
+ for (OptimizationStateListener l : superListenerList) {
+ l.performedStart(infoString);
+ }
+ }
+ LOGGER.log(Level.INFO, "Started processing {0}", infoString);
+ startTime = System.currentTimeMillis();
+ }
+
+ @Override
+ public void performedStop() {
+ if (superListenerList != null) {
+ for (OptimizationStateListener l : superListenerList) {
+ l.performedStop();
+ }
+ }
+ long t = (System.currentTimeMillis() - startTime);
+ LOGGER.info(String.format("Stopped after %1$d.%2$tL s", (t / 1000), (t % 1000)));
+ if (!withGUI) {
+ System.exit(0);
+ }
+ }
+
+ /**
+ * When the worker needs to update the GUI we do so by queuing a Runnable
+ * for the event dispatching thread with SwingUtilities.invokeLater(). In
+ * this case we're just changing the progress bars value.
+ */
+ @Override
+ public void updateProgress(final int percent, String msg) {
+ if (superListenerList != null) {
+ for (OptimizationStateListener l : superListenerList) {
+ l.updateProgress(percent, msg);
+ }
+ }
+ if (msg != null) {
+ LOGGER.info(msg);
+ }
+ if (this.progressBar != null) {
+ Runnable doSetProgressBarValue = new Runnable() {
+
+ @Override
+ public void run() {
+ progressBar.setValue(percent);
+ }
+ };
+ SwingUtilities.invokeLater(doSetProgressBarValue);
+ }
+ }
+}
diff --git a/src/eva2/gui/OptimizationEditorPanel.java b/src/eva2/gui/OptimizationEditorPanel.java
index 2d9e699e..b2e462cd 100644
--- a/src/eva2/gui/OptimizationEditorPanel.java
+++ b/src/eva2/gui/OptimizationEditorPanel.java
@@ -22,7 +22,6 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Vector;
import java.util.logging.Logger;
@@ -67,9 +66,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
* Creates the GUI editor component
*/
private GenericObjectEditor genericObjectEditor = null;
- private boolean withComboBoxToolTips = true; // should tool tips for the combo box be created?
private int tipMaxLen = 100; // maximum length of tool tip
- private HashMap classNameMap;
/**
*
@@ -82,21 +79,20 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
*
*/
public OptimizationEditorPanel(Object target, Object backup, PropertyChangeSupport support, GenericObjectEditor goe, boolean withCancel) {
- Object object = target;
backupObject = backup;
propChangeSupport = support;
genericObjectEditor = goe;
try {
- if (!(Proxy.isProxyClass(object.getClass()))) {
- backupObject = copyObject(object);
+ if (!(Proxy.isProxyClass(target.getClass()))) {
+ backupObject = copyObject(target);
}
} catch (OutOfMemoryError err) {
backupObject = null;
System.gc();
- System.err.println("Could not create backup object: not enough memory (OptimizationEditorPanel backup of " + object + ")");
+ System.err.println("Could not create backup object: not enough memory (OptimizationEditorPanel backup of " + target + ")");
}
- comboBoxModel = new DefaultComboBoxModel(new String[0]);
+ comboBoxModel = new DefaultComboBoxModel(new Vector- ());
objectChooser = new JComboBox(comboBoxModel);
objectChooser.setEditable(false);
propertySheetPanel = new PropertySheetPanel();
@@ -227,14 +223,14 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
* This method is duplicated from EvAModuleButtonPanelMaker. ToDo: Refactor
* this.
*
- * @param iconSrc
- * @param title
- * @return
+ * @param iconSrc Source path of icon
+ * @param title Title of button
+ * @return A JButton with the title and icon
*/
private JButton makeIconButton(final String iconSrc, final String title) {
JButton newButton;
byte[] bytes;
- bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
+ bytes = BasicResourceLoader.getInstance().getBytesFromResourceLocation(iconSrc, false);
if (bytes == null) {
newButton = new JButton(title);
} else {
@@ -260,7 +256,6 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
try {
SerializedObject so = new SerializedObject(source);
result = so.getObject();
- so = null;
} catch (Exception ex) {
System.err.println("GenericObjectEditor: Problem making backup object");
System.err.println(source.getClass().getName());
@@ -318,15 +313,17 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
LOGGER.finest("Selected type for OptimizationEditorPanel: " + genericObjectEditor.getClassType().getName());
if (classesLongNames.size() > 1) {
- classNameMap = new HashMap<>();
+ Vector
- classesList = new Vector<>();
+ String[] toolTips = collectComboToolTips(instances, tipMaxLen);
+ int i = 0;
for (String className : classesLongNames) {
- classNameMap.put(StringTools.cutClassName(className), className);
- }
- Vector classesList = new Vector<>(classesLongNames);
- objectChooser.setModel(new DefaultComboBoxModel(classesList));
- if (withComboBoxToolTips) {
- objectChooser.setRenderer(new ToolTipComboBoxRenderer(collectComboToolTips(instances, tipMaxLen)));
+ String displayName = StringTools.cutClassName(className);
+
+ classesList.add(new Item(className, displayName, toolTips[i++]));
}
+ comboBoxModel = new DefaultComboBoxModel(classesList);
+ objectChooser.setModel(comboBoxModel);
+ objectChooser.setRenderer(new ToolTipComboBoxRenderer());
GridBagConstraints gbConstraints = new GridBagConstraints();
gbConstraints.fill = GridBagConstraints.HORIZONTAL;
gbConstraints.gridx = 0;
@@ -342,7 +339,6 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
for (int i = 0; i < tips.length; i++) {
tips[i] = null;
- Class[] classParams = new Class[]{};
String tip = null;
@@ -363,20 +359,15 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
}
public void updateChooser() {
- String objectName = /*
- * EVAHELP.cutClassName
- */ (genericObjectEditor.getValue().getClass().getName());
- boolean found = false;
+ String objectName = genericObjectEditor.getValue().getClass().getName();
for (int i = 0; i < comboBoxModel.getSize(); i++) {
- if (objectName.equals(comboBoxModel.getElementAt(i))) {
- found = true;
+ Item element = (Item)comboBoxModel.getElementAt(i);
+
+ if (objectName.equals(element.getId())) {
+ objectChooser.getModel().setSelectedItem(element);
break;
}
}
- if (!found) {
- comboBoxModel.addElement(objectName);
- }
- objectChooser.getModel().setSelectedItem(objectName);
}
/**
@@ -398,7 +389,7 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
String className;
if ((e.getSource() == objectChooser) && (e.getStateChange() == ItemEvent.SELECTED)) {
- className = (String) objectChooser.getSelectedItem();
+ className = ((Item)objectChooser.getSelectedItem()).getId();
try {
Object n = Class.forName(className).newInstance();
genericObjectEditor.setValue(n);
@@ -423,30 +414,71 @@ public class OptimizationEditorPanel extends JPanel implements ItemListener {
class ToolTipComboBoxRenderer extends BasicComboBoxRenderer {
private static final long serialVersionUID = -5781643352198561208L;
- String[] toolTips = null;
- public ToolTipComboBoxRenderer(String[] tips) {
+ public ToolTipComboBoxRenderer() {
super();
- toolTips = tips;
}
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected, boolean cellHasFocus) {
- if (isSelected) {
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
- if ((toolTips != null) && (index >= 0)) {
- if (toolTips[index] != null) {
- list.setToolTipText(toolTips[index]);
- }
+
+ super.getListCellRendererComponent(list, value, index,
+ isSelected, cellHasFocus);
+
+ if (value != null) {
+ Item item = (Item)value;
+ setText(item.getDisplayName());
+
+ if (isSelected) {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ list.setToolTipText(item.getDescription());
+ } else {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
}
- } else {
- setBackground(list.getBackground());
- setForeground(list.getForeground());
}
+
+ if (index == -1) {
+ Item item = (Item)value;
+ setText(item.getDisplayName());
+ }
+
setFont(list.getFont());
- setText((value == null) ? "" : value.toString());
return this;
}
}
+
+class Item
+{
+ private String id;
+ private String displayName;
+ private String description;
+
+ public Item(String id, String displayName, String description)
+ {
+ this.id = id;
+ this.displayName = displayName;
+ this.description = description;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String toString()
+ {
+ return id;
+ }
+}
diff --git a/src/eva2/gui/PanelMaker.java b/src/eva2/gui/PanelMaker.java
index 51594512..8e897d33 100644
--- a/src/eva2/gui/PanelMaker.java
+++ b/src/eva2/gui/PanelMaker.java
@@ -8,5 +8,5 @@ import javax.swing.*;
* @author mkron
*/
public interface PanelMaker {
- public JComponent makePanel();
+ JComponent makePanel();
}
diff --git a/src/eva2/gui/PropertyDialog.java b/src/eva2/gui/PropertyDialog.java
index 3d0b9c7b..297bad72 100644
--- a/src/eva2/gui/PropertyDialog.java
+++ b/src/eva2/gui/PropertyDialog.java
@@ -23,7 +23,7 @@ public class PropertyDialog extends JDialog {
public PropertyDialog(Window parent, PropertyEditor editor, String title) {
super(parent, title, ModalityType.APPLICATION_MODAL);
setTitle(getFrameNameFromEditor(editor));
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLayout(new BorderLayout());
diff --git a/src/eva2/gui/PropertySheetPanel.java b/src/eva2/gui/PropertySheetPanel.java
index 9f64d562..02a29fcf 100644
--- a/src/eva2/gui/PropertySheetPanel.java
+++ b/src/eva2/gui/PropertySheetPanel.java
@@ -73,19 +73,11 @@ public final class PropertySheetPanel extends JPanel implements PropertyChangeLi
* A count of the number of properties we have an editor for.
*/
private int numEditableProperties = 0;
- /**
- * How long should a tip text line be (translated to HTML).
- */
- private int tipTextLineLen = 50;
/**
* A support object for handling property change listeners.
*/
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
- /**
- * set true to use the GOE by default if no other editor is registered.
- */
- // If true, tool tips are used up to the first point only.
- boolean stripToolTipToFirstPoint = false;
+
private ToolTipTable propertyTable;
private DefaultTableModel propertyTableModel;
diff --git a/src/eva2/gui/SplashScreen.java b/src/eva2/gui/SplashScreen.java
index a96b29a1..8638a9e2 100644
--- a/src/eva2/gui/SplashScreen.java
+++ b/src/eva2/gui/SplashScreen.java
@@ -14,7 +14,7 @@ class SplashScreen extends JWindow {
public SplashScreen(String imgLoc) {
imgLocation = imgLoc;
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(imgLocation, true);
ImageIcon ii = new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes));
JLabel splashLabel = new JLabel(ii);
diff --git a/src/eva2/gui/StandaloneOptimization.java b/src/eva2/gui/StandaloneOptimization.java
index af49a158..ef530987 100644
--- a/src/eva2/gui/StandaloneOptimization.java
+++ b/src/eva2/gui/StandaloneOptimization.java
@@ -1,11 +1,11 @@
package eva2.gui;
import eva2.gui.plot.Plot;
+import eva2.optimization.OptimizationParameters;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.individuals.ESIndividualDoubleData;
import eva2.optimization.individuals.GAIndividualDoubleData;
import eva2.optimization.individuals.InterfaceDataTypeDouble;
-import eva2.optimization.OptimizationParameters;
import eva2.optimization.operator.crossover.CrossoverGAGINPoint;
import eva2.optimization.operator.mutation.InterfaceMutation;
import eva2.optimization.operator.mutation.MutateESFixedStepSize;
@@ -149,6 +149,8 @@ public class StandaloneOptimization implements InterfaceStandaloneOptimization,
if ((object != null) && (editor != null)) {
paraPanel.registerEditor(object, editor);
}
+
+ // Tabs
this.parameterPanel1 = (paraPanel.makePanel());
this.optionsPanel = new JTabbedPane();
JParaPanel paraPanel2 = new JParaPanel(this.optimizationParameters, "MyGUI");
diff --git a/src/eva2/gui/editor/ArrayEditor.java b/src/eva2/gui/editor/ArrayEditor.java
index c58219ab..645b3c28 100644
--- a/src/eva2/gui/editor/ArrayEditor.java
+++ b/src/eva2/gui/editor/ArrayEditor.java
@@ -414,7 +414,7 @@ public class ArrayEditor extends JPanel implements PropertyEditor {
}
// Upper Button Panel
- JPanel combiUpperPanel = new JPanel(getButtonLayout(1, upperButtonList));
+ JPanel combiUpperPanel = new JPanel(getButtonLayout(0, upperButtonList));
// ToDo Figure out how to now show this on Job Pane
combiUpperPanel.add(view);
view.setVisible(withAddButton);
diff --git a/src/eva2/gui/editor/ComponentFilter.java b/src/eva2/gui/editor/ComponentFilter.java
index 382cac94..128b8189 100644
--- a/src/eva2/gui/editor/ComponentFilter.java
+++ b/src/eva2/gui/editor/ComponentFilter.java
@@ -4,5 +4,5 @@ package eva2.gui.editor;
*
*/
public interface ComponentFilter {
- public boolean accept(java.awt.Component component);
+ boolean accept(java.awt.Component component);
}
diff --git a/src/eva2/gui/editor/GenericObjectEditor.java b/src/eva2/gui/editor/GenericObjectEditor.java
index b1aeee84..b6634e08 100644
--- a/src/eva2/gui/editor/GenericObjectEditor.java
+++ b/src/eva2/gui/editor/GenericObjectEditor.java
@@ -267,8 +267,7 @@ public class GenericObjectEditor implements PropertyEditor {
return;
}
- Vector v = null;
- v = new Vector<>(getClassesFromProperties(classType.getName(), null));
+ Vector v = new Vector<>(getClassesFromProperties(classType.getName(), null));
try {
if (v.size() > 0) {
diff --git a/src/eva2/gui/editor/OptimizationObjectivesEditor.java b/src/eva2/gui/editor/OptimizationObjectivesEditor.java
index 15b8a6e9..931e6f99 100644
--- a/src/eva2/gui/editor/OptimizationObjectivesEditor.java
+++ b/src/eva2/gui/editor/OptimizationObjectivesEditor.java
@@ -130,7 +130,7 @@ public class OptimizationObjectivesEditor extends JPanel implements PropertyEdit
* This method updates the server list
*/
private void updateTargetList() {
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes;
InterfaceOptimizationObjective[] list = this.optimizationObjectives.getSelectedTargets();
diff --git a/src/eva2/gui/editor/OptimizationObjectivesWithParamEditor.java b/src/eva2/gui/editor/OptimizationObjectivesWithParamEditor.java
index f6bb5e44..b9b7c609 100644
--- a/src/eva2/gui/editor/OptimizationObjectivesWithParamEditor.java
+++ b/src/eva2/gui/editor/OptimizationObjectivesWithParamEditor.java
@@ -140,7 +140,7 @@ public class OptimizationObjectivesWithParamEditor extends JPanel implements Pro
* This method updates the server list
*/
private void updateTargetList() {
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes;
InterfaceOptimizationObjective[] list = this.optimizationObjectivesWithWeights.getSelectedTargets();
double[] weights = this.optimizationObjectivesWithWeights.getWeights();
diff --git a/src/eva2/gui/editor/TagEditor.java b/src/eva2/gui/editor/TagEditor.java
index f26dc31b..bab4caf0 100644
--- a/src/eva2/gui/editor/TagEditor.java
+++ b/src/eva2/gui/editor/TagEditor.java
@@ -114,7 +114,7 @@ public class TagEditor extends PropertyEditorSupport {
ce.setValue(initial);
PropertyValueSelector ps = new PropertyValueSelector(ce);
JFrame f = new JFrame();
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
f.setIconImage(Toolkit.getDefaultToolkit().createImage(bytes));
f.addWindowListener(new WindowAdapter() {
diff --git a/src/eva2/gui/plot/DataViewerInterface.java b/src/eva2/gui/plot/DataViewerInterface.java
index c7a5dcd2..1e80c814 100644
--- a/src/eva2/gui/plot/DataViewerInterface.java
+++ b/src/eva2/gui/plot/DataViewerInterface.java
@@ -14,7 +14,7 @@ package eva2.gui.plot;
* IMPORTS
*==========================================================================*/
public interface DataViewerInterface {
- public Graph getNewGraph(String InfoString);
+ Graph getNewGraph(String InfoString);
- public void init();
+ void init();
}
\ No newline at end of file
diff --git a/src/eva2/gui/plot/FunctionArea.java b/src/eva2/gui/plot/FunctionArea.java
index 91607a66..e05adf32 100644
--- a/src/eva2/gui/plot/FunctionArea.java
+++ b/src/eva2/gui/plot/FunctionArea.java
@@ -1092,7 +1092,7 @@ public class FunctionArea extends DArea implements Serializable {
public void toggleLog() {
boolean setMinPos = false;
if (!log && !checkLoggable()) {
- System.err.println("Warning: toggling logarithmics scale with values <= 0! Some points will not be displayed.");
+ LOGGER.warning("Warning: toggling logarithmic scale with values <= 0! Some points will not be displayed.");
setMinPos = true;
}
if (log == false) {
diff --git a/src/eva2/gui/plot/InterfaceDPointWithContent.java b/src/eva2/gui/plot/InterfaceDPointWithContent.java
index 2fb19fe1..2c3d9d39 100644
--- a/src/eva2/gui/plot/InterfaceDPointWithContent.java
+++ b/src/eva2/gui/plot/InterfaceDPointWithContent.java
@@ -7,21 +7,21 @@ import eva2.problems.InterfaceOptimizationProblem;
*
*/
public interface InterfaceDPointWithContent {
- public void setEAIndividual(AbstractEAIndividual indy);
+ void setEAIndividual(AbstractEAIndividual indy);
- public AbstractEAIndividual getEAIndividual();
+ AbstractEAIndividual getEAIndividual();
/**
* This method allows you to set the according optimization problem
*
* @param problem InterfaceOptimizationProblem
*/
- public void setProblem(InterfaceOptimizationProblem problem);
+ void setProblem(InterfaceOptimizationProblem problem);
- public InterfaceOptimizationProblem getProblem();
+ InterfaceOptimizationProblem getProblem();
/**
* This method allows you to draw additional data of the individual
*/
- public void showIndividual();
+ void showIndividual();
}
diff --git a/src/eva2/gui/plot/Plot.java b/src/eva2/gui/plot/Plot.java
index 08f9e8fd..49812c38 100644
--- a/src/eva2/gui/plot/Plot.java
+++ b/src/eva2/gui/plot/Plot.java
@@ -151,7 +151,7 @@ public class Plot implements PlotInterface, Serializable {
@Override
public void init() {
internalFrame = new JEFrame("Plot: " + plotName);
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes = loader.getBytesFromResourceLocation(EvAInfo.iconLocation, true);
buttonPanel = new JPanel();
diff --git a/src/eva2/gui/plot/PlotInterface.java b/src/eva2/gui/plot/PlotInterface.java
index e5af6029..3a845220 100644
--- a/src/eva2/gui/plot/PlotInterface.java
+++ b/src/eva2/gui/plot/PlotInterface.java
@@ -1,7 +1,7 @@
package eva2.gui.plot;
public interface PlotInterface {
- public void setConnectedPoint(double x, double y, int GraphLabel);
+ void setConnectedPoint(double x, double y, int GraphLabel);
/**
* Add two graphs to form an average graph
@@ -10,25 +10,25 @@ public interface PlotInterface {
* @param g2 graph object two
* @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);
+ void addGraph(int g1, int g2, boolean forceAdd);
- public void setUnconnectedPoint(double x, double y, int GraphLabel);
+ void setUnconnectedPoint(double x, double y, int GraphLabel);
- public void clearAll();
+ void clearAll();
- public void clearGraph(int GraphNumber);
+ void clearGraph(int GraphNumber);
- public void setInfoString(int GraphLabel, String Info, float stroke);
+ void setInfoString(int GraphLabel, String Info, float stroke);
- public void jump();
+ void jump();
- public String getName();
+ String getName();
- public int getPointCount(int graphLabel);
+ int getPointCount(int graphLabel);
// public FunctionArea getFunctionArea(); // this is bad for RMI
- public boolean isValid();
+ boolean isValid();
- public void init();
+ void init();
}
diff --git a/src/eva2/optimization/EvAMainAdapter.java b/src/eva2/optimization/EvAMainAdapter.java
deleted file mode 100644
index 8076a5af..00000000
--- a/src/eva2/optimization/EvAMainAdapter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package eva2.optimization;
-/**
- * Title: EvA2
- * Description: API for distributed and parallel computing.
- * Copyright: Copyright (c) 2004
- * Company: University of Tuebingen
- * @version: $Revision: 259 $
- * $Date: 2007-11-16 17:25:09 +0100 (Fri, 16 Nov 2007) $
- * $Author: mkron $
- */
-
-import eva2.optimization.modules.ModuleAdapter;
-
-/**
- *
- */
-public interface EvAMainAdapter {
-
- public String[] getModuleNameList();
- // returns the corresponding ModuleAdapter
-
- ModuleAdapter getModuleAdapter(String selectedModuleName);
-
- ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceOptimizationParameters goParams, String noGuiStatsFile);
-}
diff --git a/src/eva2/optimization/EvAMainAdapterImpl.java b/src/eva2/optimization/EvAMainAdapterImpl.java
deleted file mode 100644
index c7fb231e..00000000
--- a/src/eva2/optimization/EvAMainAdapterImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package eva2.optimization;
-
-/**
- * Title: The JProxy Framework
- * Description: API for distributed and parallel computing.
- * Copyright: Copyright (c) 2004
- * Company: University of Tuebingen
- * @version: $Revision: 315 $
- * $Date: 2007-12-04 15:23:57 +0100 (Tue, 04 Dec 2007) $
- * $Author: mkron $
- */
-
-import eva2.EvAInfo;
-import eva2.optimization.modules.ModuleAdapter;
-
-/**
- *
- */
-public class EvAMainAdapterImpl implements EvAMainAdapter {
-
- private ModuleServer moduleServer = null;
-
- public EvAMainAdapterImpl() {
- super();
- moduleServer = new ModuleServer(EvAInfo.getProperties());
- }
-
- @Override
- public String[] getModuleNameList() {
- return moduleServer.getModuleNameList();
- }
-
- @Override
- public ModuleAdapter getModuleAdapter(String selectedModule) {
- return getModuleAdapter(selectedModule);
- }
-
- @Override
- public ModuleAdapter getModuleAdapter(String selectedModule, InterfaceOptimizationParameters goParams, String noGuiStatsFile) {
- return moduleServer.createModuleAdapter(selectedModule, goParams, noGuiStatsFile);
- }
-}
-
diff --git a/src/eva2/optimization/InterfaceNotifyOnInformers.java b/src/eva2/optimization/InterfaceNotifyOnInformers.java
index e823b86f..c35cd388 100644
--- a/src/eva2/optimization/InterfaceNotifyOnInformers.java
+++ b/src/eva2/optimization/InterfaceNotifyOnInformers.java
@@ -8,5 +8,5 @@ public interface InterfaceNotifyOnInformers {
/**
* Notify the object about informer instances.
*/
- public void setInformers(List informers);
+ void setInformers(List informers);
}
diff --git a/src/eva2/optimization/InterfaceProcessor.java b/src/eva2/optimization/InterfaceProcessor.java
index c063d0a3..eaa7a196 100644
--- a/src/eva2/optimization/InterfaceProcessor.java
+++ b/src/eva2/optimization/InterfaceProcessor.java
@@ -1,8 +1,5 @@
package eva2.optimization;
-import eva2.optimization.OptimizationStateListener;
-
-
/**
* Interface for Optimization Processor.
*/
diff --git a/src/eva2/optimization/ModuleServer.java b/src/eva2/optimization/ModuleServer.java
deleted file mode 100644
index fdc6c597..00000000
--- a/src/eva2/optimization/ModuleServer.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package eva2.optimization;
-
-import eva2.optimization.modules.ModuleAdapter;
-import eva2.tools.EVAERROR;
-import eva2.tools.ReflectPackage;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Collect available ModuleAdapter implementations and load them on request.
- */
-public final class ModuleServer {
-
- private static final Logger LOGGER = Logger.getLogger(ModuleServer.class.getName());
- private static int instanceCounter = 0;
- private List> moduleClassList;
- private ModuleAdapter moduleAdapter;
- private int moduleAdapterCounter = 0;
-
- /**
- *
- * @param EvAProps
- */
- public ModuleServer(Properties EvAProps) {
- if (instanceCounter > 0) {
- EVAERROR.EXIT("ModuleServer created twice");
- }
- moduleClassList = new ArrayList<>();
-
- String modulePckg = null;
- Class> filterBy = null;
- try {
- /* Fetch the name of the package containing the modules */
- modulePckg = EvAProps.getProperty("ModulePackage");
- /* Fetch the the super class for all modules */
- filterBy = Class.forName(EvAProps.getProperty("ModuleFilterClass"));
- } catch (Exception ex) {
- System.err.println("Creating ModuleServer failed: couldn't load modules:" + ex.getMessage());
- System.err.println("module path was " + modulePckg + ", is it valid?");
- System.err.println("filter class path was " + ((filterBy == null) ? "null" : filterBy.getName()));
- }
-
- // this gets a list of all valid modules from the package
- Class>[] classes = ReflectPackage.getAssignableClassesInPackage(modulePckg, filterBy, true, true);
- for (Object cls : classes) {
- moduleClassList.add((Class>) cls);
- }
-
- instanceCounter++;
- }
-
- /**
- * Iterates over the list of available modules and fetches the name of the
- * module by calling the static getName() method.
- *
- * @return Array of available modules
- */
- public String[] getModuleNameList() {
- List moduleNameList = new ArrayList<>();
- for (Class> module : moduleClassList) {
- try {
- Method[] methods = module.getDeclaredMethods();
- for (Method method : methods) {
- if (method.getName().equals("getName")) {
- String name = (String) method.invoke(null, (Object[]) null);
- if (name != null) {
- moduleNameList.add(name);
- } else {
- LOGGER.log(Level.FINE, "Module {0} does not specify a diplayable name.", module.getCanonicalName());
- }
- break;
- }
- }
- } catch (Exception ex) {
- LOGGER.log(Level.WARNING, "Error while fetching name from module.", ex);
- }
-
- }
-
- String[] x = new String[moduleNameList.size()];
- moduleNameList.toArray(x);
- return x;
- }
-
- /**
- * Load the module indicated by the selectedModuleName from all available
- * module classes; if necessary through a remote proxy. Try to load a given
- * parameter file in case its a GOModuleAdapter.
- *
- * @param selectedModuleName
- * @param optimizationParameters
- * @param noGuiLogFile
- * @return the loaded module adapter instance
- */
- public ModuleAdapter createModuleAdapter(String selectedModuleName, InterfaceOptimizationParameters optimizationParameters, String noGuiLogFile) {
- moduleAdapterCounter++;
- String adapterName = "ERROR MODULADAPTER !!";
- String moduleName = null;
- Method[] methods;
- for (Class> module : moduleClassList) {
- try {
- methods = module.getDeclaredMethods();
-
- for (Method method : methods) {
- if (method.getName().equals("getName")) {
- moduleName = (String) method.invoke(null, (Object[]) null);
- }
- }
- } catch (Exception ex) {
- LOGGER.log(Level.WARNING, ex.getMessage(), ex);
- }
- if ((moduleName != null) && (selectedModuleName.equals(moduleName))) {
- try {
- adapterName = moduleAdapterCounter + "_Running_" + selectedModuleName;
-
- Constructor>[] constructorArr = module.getConstructors();
- /* create a module instance */
- int constrIndex = 0;
-
- if ((optimizationParameters == null && noGuiLogFile == null)) {
- if (optimizationParameters != null) {
- System.err.println("Cant set params - no matching constructor found for " + adapterName + " (ModuleServer)");
- }
- if (noGuiLogFile != null) {
- System.err.println("Cant deactivate GUI - no matching constructor found for " + adapterName + " (ModuleServer)");
- }
- Object[] Para = new Object[1];
- while ((constructorArr[constrIndex].getParameterTypes().length != 1) && (constrIndex < constructorArr.length)) {
- constrIndex++;
- }
- Class> paramTypes[] = (constructorArr[constrIndex]).getParameterTypes();
- Para[0] = paramTypes[0].cast(adapterName);
- moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(Para);
- } else {
- Object[] param = new Object[4];
- param[0] = adapterName;
- param[1] = optimizationParameters;
- param[2] = noGuiLogFile;
- while ((constructorArr[constrIndex].getParameterTypes().length != 4) && (constrIndex < constructorArr.length)) {
- constrIndex++;
- }
- moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(param);
- }
- } catch (Exception ex) {
- LOGGER.log(Level.SEVERE, "Error in RMI-Moduladapter initialization", ex);
- EVAERROR.EXIT("Error in RMI-Moduladapter initialization: " + ex.getMessage());
- return null;
- }
- return moduleAdapter;
- }
- }
-
- LOGGER.log(Level.SEVERE, "No valid module defined: {0}", selectedModuleName);
- return null;
- }
-}
\ No newline at end of file
diff --git a/src/eva2/optimization/OptimizationParameters.java b/src/eva2/optimization/OptimizationParameters.java
index 1becfa03..daf63d2e 100644
--- a/src/eva2/optimization/OptimizationParameters.java
+++ b/src/eva2/optimization/OptimizationParameters.java
@@ -7,6 +7,7 @@ import eva2.optimization.strategies.InterfaceOptimizer;
import eva2.problems.F1Problem;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
+import eva2.yaml.OptimizationConstructor;
import org.yaml.snakeyaml.Yaml;
import java.io.FileInputStream;
@@ -45,9 +46,10 @@ public class OptimizationParameters extends AbstractOptimizationParameters imple
OptimizationParameters instance = null;
try {
FileInputStream fileStream = new FileInputStream(yamlFile);
- instance = (OptimizationParameters) new Yaml().load(fileStream);
+ instance = (OptimizationParameters) new Yaml(new OptimizationConstructor()).load(fileStream);
} catch (Exception ex) {
- LOGGER.log(Level.WARNING, "Could not load OptimizationParameters.yml.", ex);
+ System.out.println(ex.getStackTrace() + "\n" + ex.getMessage());
+ LOGGER.log(Level.INFO, "Could not load OptimizationParameters.yml.", ex);
}
if (instance == null) {
@@ -56,6 +58,14 @@ public class OptimizationParameters extends AbstractOptimizationParameters imple
return instance;
}
+ /**
+ * Default instructor that sets up a default optimizer, problem and terminator.
+ *
+ * Currently defaults to:
+ * - Differential Evolution
+ * - F1Problem
+ * - EvaluationTerminator with 5000 evaluations
+ */
public OptimizationParameters() {
super(new DifferentialEvolution(), new F1Problem(), new EvaluationTerminator(5000));
}
diff --git a/src/eva2/optimization/individuals/AbstractEAIndividual.java b/src/eva2/optimization/individuals/AbstractEAIndividual.java
index 1caaba96..e1f3e3c1 100644
--- a/src/eva2/optimization/individuals/AbstractEAIndividual.java
+++ b/src/eva2/optimization/individuals/AbstractEAIndividual.java
@@ -200,10 +200,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
if (!this.mutationOperator.equals(indy.mutationOperator)) {
return false;
}
- if (!this.crossoverOperator.equals(indy.crossoverOperator)) {
- return false;
- }
- return true;
+ return this.crossoverOperator.equals(indy.crossoverOperator);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/GAESIndividualBinaryDoubleData.java b/src/eva2/optimization/individuals/GAESIndividualBinaryDoubleData.java
index cb96c613..5ac30542 100644
--- a/src/eva2/optimization/individuals/GAESIndividualBinaryDoubleData.java
+++ b/src/eva2/optimization/individuals/GAESIndividualBinaryDoubleData.java
@@ -61,10 +61,7 @@ public class GAESIndividualBinaryDoubleData extends AbstractEAIndividual impleme
if (!((AbstractEAIndividual) this.doubleIndividual).equalGenotypes((AbstractEAIndividual) indy.doubleIndividual)) {
return false;
}
- if (!((AbstractEAIndividual) this.binaryIndividual).equalGenotypes((AbstractEAIndividual) indy.binaryIndividual)) {
- return false;
- }
- return true;
+ return ((AbstractEAIndividual) this.binaryIndividual).equalGenotypes((AbstractEAIndividual) indy.binaryIndividual);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/GAIndividualBinaryData.java b/src/eva2/optimization/individuals/GAIndividualBinaryData.java
index aba42880..2e85c3cc 100644
--- a/src/eva2/optimization/individuals/GAIndividualBinaryData.java
+++ b/src/eva2/optimization/individuals/GAIndividualBinaryData.java
@@ -78,10 +78,7 @@ public class GAIndividualBinaryData extends AbstractEAIndividual implements Inte
if ((this.genotype == null) || (indy.genotype == null)) {
return false;
}
- if (!this.genotype.equals(indy.genotype)) {
- return false;
- }
- return true;
+ return this.genotype.equals(indy.genotype);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/GAPIndividualProgramData.java b/src/eva2/optimization/individuals/GAPIndividualProgramData.java
index 3a008557..807d9a42 100644
--- a/src/eva2/optimization/individuals/GAPIndividualProgramData.java
+++ b/src/eva2/optimization/individuals/GAPIndividualProgramData.java
@@ -57,10 +57,7 @@ public class GAPIndividualProgramData extends AbstractEAIndividual implements In
if (!((AbstractEAIndividual) this.numberData).equalGenotypes((AbstractEAIndividual) indy.numberData)) {
return false;
}
- if (!((AbstractEAIndividual) this.programData).equalGenotypes((AbstractEAIndividual) indy.programData)) {
- return false;
- }
- return true;
+ return ((AbstractEAIndividual) this.programData).equalGenotypes((AbstractEAIndividual) indy.programData);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/GEIndividualProgramData.java b/src/eva2/optimization/individuals/GEIndividualProgramData.java
index 106199c9..fd381bc4 100644
--- a/src/eva2/optimization/individuals/GEIndividualProgramData.java
+++ b/src/eva2/optimization/individuals/GEIndividualProgramData.java
@@ -130,10 +130,7 @@ public class GEIndividualProgramData extends AbstractEAIndividual implements Int
if ((this.genotype == null) || (indy.genotype == null)) {
return false;
}
- if (!this.genotype.equals(indy.genotype)) {
- return false;
- }
- return true;
+ return this.genotype.equals(indy.genotype);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/GIOBGAIndividualIntegerPermutationData.java b/src/eva2/optimization/individuals/GIOBGAIndividualIntegerPermutationData.java
index 96a8371c..42bacdee 100644
--- a/src/eva2/optimization/individuals/GIOBGAIndividualIntegerPermutationData.java
+++ b/src/eva2/optimization/individuals/GIOBGAIndividualIntegerPermutationData.java
@@ -57,10 +57,7 @@ public class GIOBGAIndividualIntegerPermutationData extends AbstractEAIndividual
if (!((AbstractEAIndividual) this.integerData).equalGenotypes((AbstractEAIndividual) indy.integerData)) {
return false;
}
- if (!((AbstractEAIndividual) this.permutationData).equalGenotypes((AbstractEAIndividual) indy.permutationData)) {
- return false;
- }
- return true;
+ return ((AbstractEAIndividual) this.permutationData).equalGenotypes((AbstractEAIndividual) indy.permutationData);
} else {
return false;
}
diff --git a/src/eva2/optimization/individuals/InterfaceDataTypeBinary.java b/src/eva2/optimization/individuals/InterfaceDataTypeBinary.java
index 1444d2dd..b074fade 100644
--- a/src/eva2/optimization/individuals/InterfaceDataTypeBinary.java
+++ b/src/eva2/optimization/individuals/InterfaceDataTypeBinary.java
@@ -14,21 +14,21 @@ public interface InterfaceDataTypeBinary {
*
* @param length The lenght of the BitSet that is to be optimized
*/
- public void setBinaryDataLength(int length);
+ void setBinaryDataLength(int length);
/**
* This method returns the length of the binary data set
*
* @return The number of bits stored
*/
- public int size();
+ int size();
/**
* This method allows you to read the binary data
*
* @return BitSet representing the binary data.
*/
- public BitSet getBinaryData();
+ BitSet getBinaryData();
/**
* This method allows you to read the binary data without
@@ -36,14 +36,14 @@ public interface InterfaceDataTypeBinary {
*
* @return BitSet representing the binary data.
*/
- public BitSet getBinaryDataWithoutUpdate();
+ BitSet getBinaryDataWithoutUpdate();
/**
* This method allows you to set the binary data.
*
* @param binaryData The new binary data.
*/
- public void setBinaryPhenotype(BitSet binaryData);
+ void setBinaryPhenotype(BitSet binaryData);
/**
* This method allows you to set the binary data, this can be used for
@@ -51,5 +51,5 @@ public interface InterfaceDataTypeBinary {
*
* @param binaryData The new binary data.
*/
- public void setBinaryGenotype(BitSet binaryData);
+ void setBinaryGenotype(BitSet binaryData);
}
diff --git a/src/eva2/optimization/individuals/InterfaceDataTypeDouble.java b/src/eva2/optimization/individuals/InterfaceDataTypeDouble.java
index 2eca7aee..5b5cd1a3 100644
--- a/src/eva2/optimization/individuals/InterfaceDataTypeDouble.java
+++ b/src/eva2/optimization/individuals/InterfaceDataTypeDouble.java
@@ -14,14 +14,14 @@ public interface InterfaceDataTypeDouble {
*
* @param length The lenght of the double[] that is to be optimized
*/
- public void setDoubleDataLength(int length);
+ void setDoubleDataLength(int length);
/**
* This method returns the length of the double data set
*
* @return The number of doubles stored
*/
- public int size();
+ int size();
/**
* This method will set the range of the double attributes.
@@ -31,21 +31,21 @@ public interface InterfaceDataTypeDouble {
* @param range The new range for the double data.
*/
@Parameter(name = "range", description = "The initialization range for the individual.")
- public void setDoubleRange(double[][] range);
+ void setDoubleRange(double[][] range);
/**
* This method will return the range for all double attributes.
*
* @return The range array.
*/
- public double[][] getDoubleRange();
+ double[][] getDoubleRange();
/**
* This method allows you to read the double data
*
* @return double[] representing the double data.
*/
- public double[] getDoubleData();
+ double[] getDoubleData();
/**
* This method allows you to read the double data without
@@ -53,7 +53,7 @@ public interface InterfaceDataTypeDouble {
*
* @return double[] representing the double data.
*/
- public double[] getDoubleDataWithoutUpdate();
+ double[] getDoubleDataWithoutUpdate();
/**
* This method allows you to set the double data, usually the phenotype data. Consider using
@@ -61,7 +61,7 @@ public interface InterfaceDataTypeDouble {
*
* @param doubleData The new double data.
*/
- public void setDoublePhenotype(double[] doubleData);
+ void setDoublePhenotype(double[] doubleData);
/**
* This method allows you to set the double data, this can be used for
@@ -69,5 +69,5 @@ public interface InterfaceDataTypeDouble {
*
* @param doubleData The new double data.
*/
- public void setDoubleGenotype(double[] doubleData);
+ void setDoubleGenotype(double[] doubleData);
}
diff --git a/src/eva2/optimization/individuals/InterfaceDataTypeInteger.java b/src/eva2/optimization/individuals/InterfaceDataTypeInteger.java
index 3247f286..fed087d7 100644
--- a/src/eva2/optimization/individuals/InterfaceDataTypeInteger.java
+++ b/src/eva2/optimization/individuals/InterfaceDataTypeInteger.java
@@ -2,7 +2,7 @@ package eva2.optimization.individuals;
/**
* This interface gives access to a integer phenotype and except
- * for problemspecific operators should only be used by the
+ * for problem specific operators should only be used by the
* optimization problem.
*/
public interface InterfaceDataTypeInteger {
@@ -10,16 +10,16 @@ public interface InterfaceDataTypeInteger {
/**
* 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 length of the int[] that is to be optimized
*/
- public void setIntegerDataLength(int length);
+ void setIntegerDataLength(int length);
/**
* This method returns the length of the int data set
*
* @return The number of integers stored
*/
- public int size();
+ int size();
/**
* This method will set the range of the int attributes.
@@ -28,21 +28,21 @@ public interface InterfaceDataTypeInteger {
*
* @param range The new range for the int data.
*/
- public void setIntRange(int[][] range);
+ void setIntRange(int[][] range);
/**
* This method will return the range for all int attributes.
*
* @return The range array.
*/
- public int[][] getIntRange();
+ int[][] getIntRange();
/**
* This method allows you to read the int data
*
* @return int[] representing the int data.
*/
- public int[] getIntegerData();
+ int[] getIntegerData();
/**
* This method allows you to read the int data without
@@ -50,14 +50,14 @@ public interface InterfaceDataTypeInteger {
*
* @return int[] representing the int data.
*/
- public int[] getIntegerDataWithoutUpdate();
+ int[] getIntegerDataWithoutUpdate();
/**
* This method allows you to set the int data.
*
* @param intData The new int data.
*/
- public void setIntPhenotype(int[] intData);
+ void setIntPhenotype(int[] intData);
/**
* This method allows you to set the int data, this can be used for
@@ -65,5 +65,5 @@ public interface InterfaceDataTypeInteger {
*
* @param intData The new int data.
*/
- public void setIntGenotype(int[] intData);
+ void setIntGenotype(int[] intData);
}
diff --git a/src/eva2/optimization/individuals/InterfaceDataTypePermutation.java b/src/eva2/optimization/individuals/InterfaceDataTypePermutation.java
index 3c1aa1d2..a7d507fe 100644
--- a/src/eva2/optimization/individuals/InterfaceDataTypePermutation.java
+++ b/src/eva2/optimization/individuals/InterfaceDataTypePermutation.java
@@ -13,7 +13,7 @@ public interface InterfaceDataTypePermutation {
*
* @param length int new length
*/
- public void setPermutationDataLength(int[] length);
+ void setPermutationDataLength(int[] length);
/**
@@ -21,7 +21,7 @@ public interface InterfaceDataTypePermutation {
*
* @return int
*/
- public int[] sizePermutation();
+ int[] sizePermutation();
/**
* This method allows you to read the permutation data
@@ -36,7 +36,7 @@ public interface InterfaceDataTypePermutation {
*
* @return int[] representing the permutation.
*/
- public int[][] getPermutationDataWithoutUpdate();
+ int[][] getPermutationDataWithoutUpdate();
/**
* This method allows you to set the permutation.
@@ -53,5 +53,5 @@ public interface InterfaceDataTypePermutation {
*/
void setPermutationGenotype(int[][] perm);
- public void setFirstindex(int[] firstindex);
+ void setFirstindex(int[] firstindex);
}
diff --git a/src/eva2/optimization/individuals/InterfaceDataTypeProgram.java b/src/eva2/optimization/individuals/InterfaceDataTypeProgram.java
index 4d3221ac..66cd3491 100644
--- a/src/eva2/optimization/individuals/InterfaceDataTypeProgram.java
+++ b/src/eva2/optimization/individuals/InterfaceDataTypeProgram.java
@@ -14,14 +14,14 @@ public interface InterfaceDataTypeProgram {
*
* @param length The lenght of the double[] that is to be optimized
*/
- public void setProgramDataLength(int length);
+ void setProgramDataLength(int length);
/**
* This method allows you to read the program stored as Koza style node tree
*
* @return AbstractGPNode representing the binary data.
*/
- public InterfaceProgram[] getProgramData();
+ InterfaceProgram[] getProgramData();
/**
* This method allows you to read the Program data without
@@ -29,33 +29,33 @@ public interface InterfaceDataTypeProgram {
*
* @return InterfaceProgram[] representing the Program.
*/
- public InterfaceProgram[] getProgramDataWithoutUpdate();
+ InterfaceProgram[] getProgramDataWithoutUpdate();
/**
* This method allows you to set the program.
*
* @param program The new program.
*/
- public void SetProgramPhenotype(InterfaceProgram[] program);
+ void SetProgramPhenotype(InterfaceProgram[] program);
/**
* This method allows you to set the program.
*
* @param program The new program.
*/
- public void SetProgramGenotype(InterfaceProgram[] program);
+ void SetProgramGenotype(InterfaceProgram[] program);
/**
* This method allows you to set the function area
*
* @param area The area contains functions and terminals
*/
- public void SetFunctionArea(Object[] area);
+ void SetFunctionArea(Object[] area);
/**
* This method allows you to get the function area
*
* @return The area contains functions and terminals
*/
- public Object[] getFunctionArea();
+ Object[] getFunctionArea();
}
diff --git a/src/eva2/optimization/individuals/InterfaceESIndividual.java b/src/eva2/optimization/individuals/InterfaceESIndividual.java
index 7c439180..3e814457 100644
--- a/src/eva2/optimization/individuals/InterfaceESIndividual.java
+++ b/src/eva2/optimization/individuals/InterfaceESIndividual.java
@@ -12,20 +12,20 @@ public interface InterfaceESIndividual {
*
* @return BitSet
*/
- public double[] getDGenotype();
+ double[] getDGenotype();
/**
* This method will allow the user to set the current ES 'genotype'.
*
* @param b The new genotype of the Individual
*/
- public void setDGenotype(double[] b);
+ void setDGenotype(double[] b);
/**
* This method will return the range for all double attributes.
*
* @return The range array.
*/
- public double[][] getDoubleRange();
+ double[][] getDoubleRange();
}
diff --git a/src/eva2/optimization/individuals/InterfaceGAIndividual.java b/src/eva2/optimization/individuals/InterfaceGAIndividual.java
index 1c3bf0aa..02f3b984 100644
--- a/src/eva2/optimization/individuals/InterfaceGAIndividual.java
+++ b/src/eva2/optimization/individuals/InterfaceGAIndividual.java
@@ -14,7 +14,7 @@ public interface InterfaceGAIndividual {
*
* @return BitSet
*/
- public BitSet getBGenotype();
+ BitSet getBGenotype();
/**
* This method will allow the user to set the current GA genotype.
@@ -24,7 +24,7 @@ public interface InterfaceGAIndividual {
*
* @param b The new genotype of the Individual
*/
- public void setBGenotype(BitSet b);
+ void setBGenotype(BitSet b);
/**
* This method allows the user to read the length of the genotype.
@@ -33,6 +33,6 @@ public interface InterfaceGAIndividual {
*
* @return The length of the genotype.
*/
- public int getGenotypeLength();
+ int getGenotypeLength();
}
diff --git a/src/eva2/optimization/individuals/InterfaceGIIndividual.java b/src/eva2/optimization/individuals/InterfaceGIIndividual.java
index 1e25c69c..9b58ff68 100644
--- a/src/eva2/optimization/individuals/InterfaceGIIndividual.java
+++ b/src/eva2/optimization/individuals/InterfaceGIIndividual.java
@@ -12,14 +12,14 @@ public interface InterfaceGIIndividual {
*
* @param length The lenght of the int[] that is to be optimized
*/
- public void setIntegerDataLength(int length);
+ void setIntegerDataLength(int length);
/**
* This method will return the range for all int attributes.
*
* @return The range array.
*/
- public int[][] getIntRange();
+ int[][] getIntRange();
/**
* This method will set the range of the int attributes.
@@ -28,14 +28,14 @@ public interface InterfaceGIIndividual {
*
* @param range The new range for the int data.
*/
- public void setIntRange(int[][] range);
+ void setIntRange(int[][] range);
/**
* This method will allow the user to read the GI genotype
*
* @return BitSet
*/
- public int[] getIGenotype();
+ int[] getIGenotype();
/**
* This method will allow the user to set the current GI genotype.
@@ -45,7 +45,7 @@ public interface InterfaceGIIndividual {
*
* @param b The new genotype of the Individual
*/
- public void setIGenotype(int[] b);
+ void setIGenotype(int[] b);
/**
* This method allows the user to read the length of the genotype.
@@ -54,5 +54,5 @@ public interface InterfaceGIIndividual {
*
* @return The length of the genotype.
*/
- public int getGenotypeLength();
+ int getGenotypeLength();
}
diff --git a/src/eva2/optimization/individuals/InterfaceGPIndividual.java b/src/eva2/optimization/individuals/InterfaceGPIndividual.java
index 42230845..325114b4 100644
--- a/src/eva2/optimization/individuals/InterfaceGPIndividual.java
+++ b/src/eva2/optimization/individuals/InterfaceGPIndividual.java
@@ -13,14 +13,14 @@ public interface InterfaceGPIndividual {
*
* @return AbstractGPNode
*/
- public AbstractGPNode[] getPGenotype();
+ AbstractGPNode[] getPGenotype();
/**
* This method will allow the user to set the current program 'genotype'.
*
* @param b The new program genotype of the Individual
*/
- public void setPGenotype(AbstractGPNode[] b);
+ void setPGenotype(AbstractGPNode[] b);
/**
* This method will allow the user to set the current program 'genotype'.
@@ -28,19 +28,19 @@ public interface InterfaceGPIndividual {
* @param b The new program genotype of the Individual
* @param i The index where to insert the new program
*/
- public void setPGenotype(AbstractGPNode b, int i);
+ void setPGenotype(AbstractGPNode b, int i);
/**
* This method allows you to get the function area
*
* @return area The area contains functions and terminals
*/
- public Object[] getFunctionArea();
+ Object[] getFunctionArea();
/**
* Return the maximal allowed depth of a GP tree (or -1 if it does not apply).
*
* @return
*/
- public int getMaxAllowedDepth();
+ int getMaxAllowedDepth();
}
diff --git a/src/eva2/optimization/individuals/InterfaceOBGAIndividual.java b/src/eva2/optimization/individuals/InterfaceOBGAIndividual.java
index 4d06ecca..f6834623 100644
--- a/src/eva2/optimization/individuals/InterfaceOBGAIndividual.java
+++ b/src/eva2/optimization/individuals/InterfaceOBGAIndividual.java
@@ -13,7 +13,7 @@ public interface InterfaceOBGAIndividual {
*
* @return int[] genotype
*/
- public int[][] getOBGenotype();
+ int[][] getOBGenotype();
/**
@@ -21,5 +21,5 @@ public interface InterfaceOBGAIndividual {
*
* @param b int[] new genotype
*/
- public void setOBGenotype(int[][] b);
+ void setOBGenotype(int[][] b);
}
diff --git a/src/eva2/optimization/individuals/codings/ga/InterfaceGADoubleCoding.java b/src/eva2/optimization/individuals/codings/ga/InterfaceGADoubleCoding.java
index cee6afae..237af487 100644
--- a/src/eva2/optimization/individuals/codings/ga/InterfaceGADoubleCoding.java
+++ b/src/eva2/optimization/individuals/codings/ga/InterfaceGADoubleCoding.java
@@ -17,7 +17,7 @@ public interface InterfaceGADoubleCoding {
* @param correction Enable automatic correction is enabled.
* @return The float value.
*/
- public double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction);
+ double decodeValue(BitSet refBitSet, double[] range, int[] locus, boolean correction);
/**
* This method codes a given double value directly into a BitSet at
@@ -29,5 +29,5 @@ public interface InterfaceGADoubleCoding {
* @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded.
*/
- public void codeValue(double value, double[] range, BitSet refBitSet, int[] locus);
+ void codeValue(double value, double[] range, BitSet refBitSet, int[] locus);
}
diff --git a/src/eva2/optimization/individuals/codings/ga/InterfaceGAIntegerCoding.java b/src/eva2/optimization/individuals/codings/ga/InterfaceGAIntegerCoding.java
index 70b4a4ad..dd8fc024 100644
--- a/src/eva2/optimization/individuals/codings/ga/InterfaceGAIntegerCoding.java
+++ b/src/eva2/optimization/individuals/codings/ga/InterfaceGAIntegerCoding.java
@@ -18,7 +18,7 @@ public interface InterfaceGAIntegerCoding {
* @param correction Enable automatic correction is enabled.
* @return The float value.
*/
- public int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction);
+ int decodeValue(BitSet refBitSet, int[] range, int[] locus, boolean correction);
/**
* This method codes a given int value directly into a BitSet at
@@ -30,12 +30,12 @@ public interface InterfaceGAIntegerCoding {
* @param refBitSet The BitSet where the questioned value is stored.
* @param locus The position and length on the BitSet that is to be coded.
*/
- public void codeValue(int value, int[] range, BitSet refBitSet, int[] locus);
+ void codeValue(int value, int[] range, BitSet refBitSet, int[] locus);
/**
* This method will calculate how many bits are to be used to code a given value
*
* @param range The range for the value.
*/
- public int calculateNecessaryBits(int[] range);
+ int calculateNecessaryBits(int[] range);
}
diff --git a/src/eva2/optimization/individuals/codings/gp/InterfaceProgram.java b/src/eva2/optimization/individuals/codings/gp/InterfaceProgram.java
index 39c828bf..4e99c7c7 100644
--- a/src/eva2/optimization/individuals/codings/gp/InterfaceProgram.java
+++ b/src/eva2/optimization/individuals/codings/gp/InterfaceProgram.java
@@ -11,12 +11,12 @@ public interface InterfaceProgram {
*
* @param environment
*/
- public Object evaluate(eva2.problems.InterfaceProgramProblem environment);
+ Object evaluate(eva2.problems.InterfaceProgramProblem environment);
/**
* This method returns a string representation of the current program.
*
* @return string
*/
- public String getStringRepresentation();
+ String getStringRepresentation();
}
diff --git a/src/eva2/optimization/mocco/InterfaceProcessElement.java b/src/eva2/optimization/mocco/InterfaceProcessElement.java
index 94cbc4da..bb9f321a 100644
--- a/src/eva2/optimization/mocco/InterfaceProcessElement.java
+++ b/src/eva2/optimization/mocco/InterfaceProcessElement.java
@@ -8,13 +8,13 @@ public interface InterfaceProcessElement {
/**
* This method will call the initialize method and will go to stall
*/
- public void initProcessElementParametrization();
+ void initProcessElementParametrization();
/**
* This method will wait for the parametrisation result
*
* @return int Result
*/
- public boolean isFinished();
+ boolean isFinished();
}
diff --git a/src/eva2/optimization/mocco/MOCCOChooseMOStrategy.java b/src/eva2/optimization/mocco/MOCCOChooseMOStrategy.java
index b14a9ce7..e4560413 100644
--- a/src/eva2/optimization/mocco/MOCCOChooseMOStrategy.java
+++ b/src/eva2/optimization/mocco/MOCCOChooseMOStrategy.java
@@ -45,7 +45,7 @@ public class MOCCOChooseMOStrategy extends MOCCOPhase implements InterfaceProces
JPanel tmpP = new JPanel();
tmpP.setLayout(new GridBagLayout());
JButton tmpB;
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes;
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = GridBagConstraints.WEST;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeGDF.java b/src/eva2/optimization/mocco/MOCCOParameterizeGDF.java
index ab450147..3b9dff50 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeGDF.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeGDF.java
@@ -1,10 +1,10 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyDoubleArray;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.operator.moso.MOSOWeightedFitness;
import eva2.optimization.operator.terminators.InterfaceTerminator;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeMO.java b/src/eva2/optimization/mocco/MOCCOParameterizeMO.java
index 9787e40d..3497cc2d 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeMO.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeMO.java
@@ -1,9 +1,9 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.operator.terminators.InterfaceTerminator;
import eva2.optimization.population.Population;
import eva2.optimization.strategies.GeneticAlgorithm;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeRefPoint.java b/src/eva2/optimization/mocco/MOCCOParameterizeRefPoint.java
index bba86a24..1e3860a5 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeRefPoint.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeRefPoint.java
@@ -1,9 +1,9 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.operator.migration.SOBestMigration;
import eva2.optimization.operator.moso.MOSOLpMetric;
import eva2.optimization.operator.terminators.InterfaceTerminator;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeSO.java b/src/eva2/optimization/mocco/MOCCOParameterizeSO.java
index e3ff420c..f39a2735 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeSO.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeSO.java
@@ -1,9 +1,9 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.operator.terminators.InterfaceTerminator;
import eva2.optimization.strategies.GeneticAlgorithm;
import eva2.optimization.strategies.InterfaceOptimizer;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeSTEP.java b/src/eva2/optimization/mocco/MOCCOParameterizeSTEP.java
index fc590793..cb386c9a 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeSTEP.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeSTEP.java
@@ -1,10 +1,10 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyDoubleArray;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.operator.moso.MOSOWeightedFitness;
import eva2.optimization.operator.terminators.InterfaceTerminator;
diff --git a/src/eva2/optimization/mocco/MOCCOParameterizeTchebycheff.java b/src/eva2/optimization/mocco/MOCCOParameterizeTchebycheff.java
index c1d51673..df170e25 100644
--- a/src/eva2/optimization/mocco/MOCCOParameterizeTchebycheff.java
+++ b/src/eva2/optimization/mocco/MOCCOParameterizeTchebycheff.java
@@ -1,9 +1,9 @@
package eva2.optimization.mocco;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.PropertyEditorProvider;
import eva2.gui.editor.GenericObjectEditor;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.operator.migration.SOBestMigration;
import eva2.optimization.operator.moso.MOSOWeightedLPTchebycheff;
import eva2.optimization.operator.terminators.InterfaceTerminator;
diff --git a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceParetoFrontView.java b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceParetoFrontView.java
index 4aebe944..de5e8cb9 100644
--- a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceParetoFrontView.java
+++ b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceParetoFrontView.java
@@ -10,5 +10,5 @@ public interface InterfaceParetoFrontView {
* the data has changed most likely due to changes in
* the problem definition
*/
- public void updateView();
+ void updateView();
}
diff --git a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefPointListener.java b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefPointListener.java
index afda2f2e..602479d6 100644
--- a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefPointListener.java
+++ b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefPointListener.java
@@ -10,5 +10,5 @@ public interface InterfaceRefPointListener {
*
* @param point The selected point, most likely 2d
*/
- public void refPointGiven(double[] point);
+ void refPointGiven(double[] point);
}
diff --git a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefSolutionListener.java b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefSolutionListener.java
index 4592120e..3cf87b25 100644
--- a/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefSolutionListener.java
+++ b/src/eva2/optimization/mocco/paretofrontviewer/InterfaceRefSolutionListener.java
@@ -13,5 +13,5 @@ public interface InterfaceRefSolutionListener {
*
* @param indy The selected individual
*/
- public void individualSelected(AbstractEAIndividual indy);
+ void individualSelected(AbstractEAIndividual indy);
}
diff --git a/src/eva2/optimization/mocco/paretofrontviewer/MOCCOViewer.java b/src/eva2/optimization/mocco/paretofrontviewer/MOCCOViewer.java
index 6708d3d0..21995d62 100644
--- a/src/eva2/optimization/mocco/paretofrontviewer/MOCCOViewer.java
+++ b/src/eva2/optimization/mocco/paretofrontviewer/MOCCOViewer.java
@@ -1,10 +1,10 @@
package eva2.optimization.mocco.paretofrontviewer;
+import eva2.gui.MOCCOStandalone;
import eva2.gui.plot.FunctionArea;
import eva2.gui.plot.GraphPointSet;
import eva2.gui.plot.InterfaceDPointWithContent;
-import eva2.gui.MOCCOStandalone;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.population.Population;
import eva2.problems.InterfaceMultiObjectiveDeNovoProblem;
diff --git a/src/eva2/optimization/modules/AbstractModuleAdapter.java b/src/eva2/optimization/modules/AbstractModuleAdapter.java
index f41d3459..6e676369 100644
--- a/src/eva2/optimization/modules/AbstractModuleAdapter.java
+++ b/src/eva2/optimization/modules/AbstractModuleAdapter.java
@@ -1,9 +1,9 @@
package eva2.optimization.modules;
+import eva2.optimization.InterfaceOptimizationParameters;
import eva2.optimization.InterfaceProcessor;
import eva2.optimization.OptimizationStateListener;
-import eva2.optimization.InterfaceOptimizationParameters;
import eva2.optimization.Processor;
import java.io.Serializable;
diff --git a/src/eva2/optimization/modules/GOModuleAdapter.java b/src/eva2/optimization/modules/OptimizationModuleAdapter.java
similarity index 60%
rename from src/eva2/optimization/modules/GOModuleAdapter.java
rename to src/eva2/optimization/modules/OptimizationModuleAdapter.java
index 36d92949..5b9a9c88 100644
--- a/src/eva2/optimization/modules/GOModuleAdapter.java
+++ b/src/eva2/optimization/modules/OptimizationModuleAdapter.java
@@ -7,10 +7,10 @@ import java.io.Serializable;
/**
- * Starts a statistics GUI and the GOProcessor thread.
+ * Starts a statistics GUI and the Processor thread.
*/
@SuppressWarnings("unused")
-public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapter, Serializable {
+public class OptimizationModuleAdapter extends GenericModuleAdapter implements ModuleAdapter, Serializable {
private static final String moduleName = "Genetic_Optimization";
@@ -22,22 +22,22 @@ public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
}
/**
- * Starts a statistics GUI and the GOProcessor thread.
+ * Starts a statistics GUI and the Processor thread.
*
* @param adapterName the title of the ModuleAdapter
*/
- public GOModuleAdapter(String adapterName) {
+ public OptimizationModuleAdapter(String adapterName) {
super(adapterName, "", OptimizationParameters.getInstance(), false);
}
/**
- * Starts a statistics GUI and the GOProcessor thread with a given OptimizationParameters file.
+ * Starts a statistics GUI and the Processor thread with a given OptimizationParameters file.
*
* @param adapterName the title of the ModuleAdapter
* @param optimizationParameters the client instance
* @param noGuiLogFile
*/
- public GOModuleAdapter(String adapterName, InterfaceOptimizationParameters optimizationParameters, String noGuiLogFile) {
+ public OptimizationModuleAdapter(String adapterName, InterfaceOptimizationParameters optimizationParameters, String noGuiLogFile) {
super(adapterName, "", optimizationParameters, false, noGuiLogFile);
}
}
\ No newline at end of file
diff --git a/src/eva2/optimization/operator/archiving/AbstractArchiving.java b/src/eva2/optimization/operator/archiving/AbstractArchiving.java
index 2f694da0..2ba03fce 100644
--- a/src/eva2/optimization/operator/archiving/AbstractArchiving.java
+++ b/src/eva2/optimization/operator/archiving/AbstractArchiving.java
@@ -158,23 +158,6 @@ public abstract class AbstractArchiving implements InterfaceArchiving, java.io.S
p++;
}
-/**********************************************************************************************************************
- * These are for GUI
- */
-
-// /** This method allows you to toggle the debug mode.
-// * @param b True in case of the debug mode.
-// */
-// public void setDebugFront(boolean b) {
-// this.debug = b;
-// }
-// public boolean getDebugFront() {
-// return this.debug;
-// }
-// public String debugFrontTipText() {
-// return "Toggles the debug mode.";
-// }
-
/**
* Toggle the use of obeying the constraint violation principle
* of Deb
diff --git a/src/eva2/optimization/operator/archiving/ArchivingNSGAIISMeasure.java b/src/eva2/optimization/operator/archiving/ArchivingNSGAIISMeasure.java
index ebbabb1c..59d0e1ad 100644
--- a/src/eva2/optimization/operator/archiving/ArchivingNSGAIISMeasure.java
+++ b/src/eva2/optimization/operator/archiving/ArchivingNSGAIISMeasure.java
@@ -9,7 +9,7 @@ import java.util.Arrays;
public class ArchivingNSGAIISMeasure extends ArchivingNSGAII {
/**
- * This method will cacluated the NSGAII crowding distance
+ * This method will calculated the NSGAII crowding distance
* for all individuals
*
* @param fronts The pareto fronts
@@ -18,14 +18,14 @@ public class ArchivingNSGAIISMeasure extends ArchivingNSGAII {
public void calculateCrowdingDistance(Population[] fronts) {
//TODO Dimension der Zielfunktion checken
- for (int rank = 0; rank < fronts.length; rank++) {
- calculateCrowdingDistance(fronts[rank]);
+ for (Population front : fronts) {
+ calculateCrowdingDistance(front);
}
}
/**
- * This mehtod will test if a given individual is dominant within
+ * This method will test if a given individual is dominant within
* a given population
*
* @param indy The individual that is to be tested.
@@ -68,7 +68,7 @@ public class ArchivingNSGAIISMeasure extends ArchivingNSGAII {
Arrays.sort(frontArray, new EAIndividualComparator(0));
- ((AbstractEAIndividual) frontArray[0]).putData("HyperCube", Double.MAX_VALUE); //die beiden aussen bekommen maximal wert als smeasure
+ ((AbstractEAIndividual) frontArray[0]).putData("HyperCube", Double.MAX_VALUE); //die beiden aussen bekommen maximal wert als measure
((AbstractEAIndividual) frontArray[frontArray.length - 1]).putData("HyperCube", Double.MAX_VALUE);
v[0] = Double.MAX_VALUE;
v[frontArray.length - 1] = Double.MAX_VALUE;
diff --git a/src/eva2/optimization/operator/archiving/ArchivingPESAII.java b/src/eva2/optimization/operator/archiving/ArchivingPESAII.java
index be3a1341..7c611802 100644
--- a/src/eva2/optimization/operator/archiving/ArchivingPESAII.java
+++ b/src/eva2/optimization/operator/archiving/ArchivingPESAII.java
@@ -8,7 +8,7 @@ import eva2.util.annotation.Description;
import java.util.ArrayList;
/**
- * The Pareto envelope sorting algorithm using a hybergrid and
+ * The Pareto envelope sorting algorithm using a hypergrid and
* the so called squeeze factor.
*/
@Description("Pareto Envelope-based Selection Algorithm revision 2.0.")
@@ -85,7 +85,6 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
double[][] bounds;
double[] tmpFit;
AbstractEAIndividual tmpIndy;
-// boolean debug = true;
// first calculate the bounds of the search space
bounds = new double[pop.get(0).getFitness().length][2];
@@ -93,10 +92,9 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
bounds[i][0] = Double.POSITIVE_INFINITY;
bounds[i][1] = Double.NEGATIVE_INFINITY;
}
-// if (debug) System.out.println("The individuals:");
+
for (int i = 0; i < pop.size(); i++) {
tmpFit = pop.get(i).getFitness();
-// if (debug) System.out.println("Individual "+i+": "+tmpFit[0] +"/"+tmpFit[1]);
result[i] = 0;
for (int j = 0; j < tmpFit.length; j++) {
if (tmpFit[j] < bounds[j][0]) {
@@ -107,15 +105,11 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
}
}
}
-// if (debug) {
-// System.out.println("The bounds are ("+bounds[0][0]+"/"+bounds[0][1]+")("+bounds[1][0]+"/"+bounds[1][1]+")");
-// System.out.println("Gridwidth is "+((bounds[0][1] - bounds[0][0])/this.gridSize)+"/"+((bounds[1][1] - bounds[1][0])/this.gridSize));
-// }
// now that i got the bounds i can calculate the squeeze grid
- int[] curGrid = new int[bounds.length], tmpGrid = new int[bounds.length];
+ int[] curGrid, tmpGrid = new int[bounds.length];
double[] grid = new double[bounds.length];
- ArrayList coll;
+ ArrayList coll;
boolean sameGrid;
for (int i = 0; i < pop.size(); i++) {
if (result[i] == 0) {
@@ -123,16 +117,11 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
// haven't calculated the squeeze factor for this guy yet
// first i'll calculate the grid position this guy is in
tmpFit = pop.get(i).getFitness();
- coll = new ArrayList();
+ coll = new ArrayList<>();
for (int j = 0; j < tmpFit.length; j++) {
grid[j] = (bounds[j][1] - bounds[j][0]) / this.gridSize;
curGrid[j] = (int) ((tmpFit[j] - bounds[j][0]) / grid[j]);
}
-// if (debug) {
-// System.out.println("Indy "+i+" ("+tmpFit[0] +"/"+tmpFit[1]+") unassigned is in grid ["+curGrid[0]+"/"+curGrid[1]+"]");
-// System.out.println("");
-// System.out.println("Checking for individuals in the same grid");
-// }
coll.add(i);
for (int j = i + 1; j < pop.size(); j++) {
if (result[j] == 0) {
@@ -142,25 +131,18 @@ public class ArchivingPESAII extends AbstractArchiving implements java.io.Serial
sameGrid = true;
for (int k = 0; k < tmpFit.length; k++) {
tmpGrid[k] = (int) ((tmpFit[k] - bounds[k][0]) / grid[k]);
- if (curGrid[k] == tmpGrid[k]) {
- sameGrid &= true;
- } else {
- sameGrid &= false;
- }
+ sameGrid &= curGrid[k] == tmpGrid[k];
}
if (sameGrid) {
coll.add(j);
}
-// if (debug) {
-// System.out.println("Checking indy "+j+" ("+tmpFit[0] +"/"+tmpFit[1]+") in grid ["+tmpGrid[0]+"/"+tmpGrid[1]+"]");
-// }
}
}
// now i got all the boogies of the same grid element
// lets assign them their squeeze factor
for (int j = 0; j < coll.size(); j++) {
- result[(int) coll.get(j)] = coll.size();
- tmpIndy = pop.get(((Integer) coll.get(j)).intValue());
+ result[coll.get(j)] = coll.size();
+ tmpIndy = pop.get(coll.get(j).intValue());
tmpIndy.putData("SqueezeFactor", coll.size());
tmpIndy.putData("GridBox", curGrid);
}
diff --git a/src/eva2/optimization/operator/archiving/InterfaceArchiving.java b/src/eva2/optimization/operator/archiving/InterfaceArchiving.java
index 0cf63554..c0b586ad 100644
--- a/src/eva2/optimization/operator/archiving/InterfaceArchiving.java
+++ b/src/eva2/optimization/operator/archiving/InterfaceArchiving.java
@@ -12,7 +12,7 @@ public interface InterfaceArchiving {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows you to merge populations into an archive.
@@ -21,5 +21,5 @@ public interface InterfaceArchiving {
*
* @param pop The population that may add Individuals to the archive.
*/
- public void addElementsToArchive(Population pop);
+ void addElementsToArchive(Population pop);
}
diff --git a/src/eva2/optimization/operator/archiving/InterfaceInformationRetrieval.java b/src/eva2/optimization/operator/archiving/InterfaceInformationRetrieval.java
index 4a29b60b..7c9b66b7 100644
--- a/src/eva2/optimization/operator/archiving/InterfaceInformationRetrieval.java
+++ b/src/eva2/optimization/operator/archiving/InterfaceInformationRetrieval.java
@@ -14,7 +14,7 @@ public interface InterfaceInformationRetrieval {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method will allow Information Retrieval from a archive onto
@@ -22,6 +22,6 @@ public interface InterfaceInformationRetrieval {
*
* @param pop The population.
*/
- public void retrieveInformationFrom(Population pop);
+ void retrieveInformationFrom(Population pop);
}
diff --git a/src/eva2/optimization/operator/archiving/InterfaceRemoveSurplusIndividuals.java b/src/eva2/optimization/operator/archiving/InterfaceRemoveSurplusIndividuals.java
index 67431fb0..4a9f19a2 100644
--- a/src/eva2/optimization/operator/archiving/InterfaceRemoveSurplusIndividuals.java
+++ b/src/eva2/optimization/operator/archiving/InterfaceRemoveSurplusIndividuals.java
@@ -14,7 +14,7 @@ public interface InterfaceRemoveSurplusIndividuals {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method will remove surplus individuals
@@ -22,5 +22,5 @@ public interface InterfaceRemoveSurplusIndividuals {
*
* @param archive
*/
- public void removeSurplusIndividuals(Population archive);
+ void removeSurplusIndividuals(Population archive);
}
diff --git a/src/eva2/optimization/operator/classification/InterfaceClassification.java b/src/eva2/optimization/operator/classification/InterfaceClassification.java
index 2634b316..75ed3fe2 100644
--- a/src/eva2/optimization/operator/classification/InterfaceClassification.java
+++ b/src/eva2/optimization/operator/classification/InterfaceClassification.java
@@ -10,7 +10,7 @@ public interface InterfaceClassification {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method will initialize the classificator
@@ -18,7 +18,7 @@ public interface InterfaceClassification {
* @param space The double[n][d] space*
* @param type The classes [0,1,..]
*/
- public void init(double[][] space, int[] type);
+ void init(double[][] space, int[] type);
/**
* This method allows you to train the classificator based on
@@ -28,7 +28,7 @@ public interface InterfaceClassification {
* @param space The double[n][d] space
* @param type The int[n] classes [0,1,..]
*/
- public void train(double[][] space, int[] type);
+ void train(double[][] space, int[] type);
/**
* This method will classify a given data point
@@ -36,5 +36,5 @@ public interface InterfaceClassification {
* @param point The double[d] data point.
* @return type The resulting class.
*/
- public int getClassFor(double[] point);
+ int getClassFor(double[] point);
}
diff --git a/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java b/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
index 94e22701..712d9a1c 100644
--- a/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
+++ b/src/eva2/optimization/operator/cluster/ClusteringDensityBased.java
@@ -180,11 +180,7 @@ public class ClusteringDensityBased implements InterfaceClusteringDistanceParam,
Population tmpPop = new Population(species1.size() + species2.size());
tmpPop.addPopulation(species1);
tmpPop.addPopulation(species2);
- if (this.cluster(tmpPop, referencePop).length <= 2) {
- return true;
- } else {
- return false;
- }
+ return this.cluster(tmpPop, referencePop).length <= 2;
}
}
diff --git a/src/eva2/optimization/operator/cluster/ClusteringKMeans.java b/src/eva2/optimization/operator/cluster/ClusteringKMeans.java
index ef9a684a..7a4cf3fa 100644
--- a/src/eva2/optimization/operator/cluster/ClusteringKMeans.java
+++ b/src/eva2/optimization/operator/cluster/ClusteringKMeans.java
@@ -354,11 +354,7 @@ public class ClusteringKMeans implements InterfaceClustering, java.io.Serializab
@Override
public boolean mergingSpecies(Population species1, Population species2, Population referencePop) {
// TODO i could use the BIC metric from X-means to calculate this
- if (metric.distance(species1.getBestEAIndividual(), species2.getBestEAIndividual()) < mergeDist) {
- return true;
- } else {
- return false;
- }
+ return metric.distance(species1.getBestEAIndividual(), species2.getBestEAIndividual()) < mergeDist;
}
// /** This method decides if a unclustered individual belongs to an already established species.
diff --git a/src/eva2/optimization/operator/cluster/ClusteringNearestBetter.java b/src/eva2/optimization/operator/cluster/ClusteringNearestBetter.java
index 323ed94f..5f5773bb 100644
--- a/src/eva2/optimization/operator/cluster/ClusteringNearestBetter.java
+++ b/src/eva2/optimization/operator/cluster/ClusteringNearestBetter.java
@@ -374,20 +374,12 @@ public class ClusteringNearestBetter implements InterfaceClustering, Serializabl
public boolean mergingSpecies(Population species1, Population species2, Population referenceSet) {
getRefData(referenceSet, species1);
if (testConvergingSpeciesOnBestOnly) {
- if (this.metric.distance(species1.getBestEAIndividual(), species2.getBestEAIndividual()) < this.currentDistThreshold()) {
- return true;
- } else {
- return false;
- }
+ return this.metric.distance(species1.getBestEAIndividual(), species2.getBestEAIndividual()) < this.currentDistThreshold();
} else {
Population tmpPop = new Population(species1.size() + species2.size());
tmpPop.addPopulation(species1);
tmpPop.addPopulation(species2);
- if (this.cluster(tmpPop, referenceSet).length <= 2) {
- return true;
- } else {
- return false;
- }
+ return this.cluster(tmpPop, referenceSet).length <= 2;
}
}
diff --git a/src/eva2/optimization/operator/cluster/InterfaceClustering.java b/src/eva2/optimization/operator/cluster/InterfaceClustering.java
index 8d07d1f5..3caf5e41 100644
--- a/src/eva2/optimization/operator/cluster/InterfaceClustering.java
+++ b/src/eva2/optimization/operator/cluster/InterfaceClustering.java
@@ -16,7 +16,7 @@ public interface InterfaceClustering {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows you to search for clusters in a given population. The method
@@ -37,7 +37,7 @@ public interface InterfaceClustering {
* @param referenceSet a reference population for dynamic measures
* @return Population[]
*/
- public Population[] cluster(Population pop, Population referenceSet);
+ Population[] cluster(Population pop, Population referenceSet);
/**
* This method allows you to decide if two species are to be merged regarding this clustering algorithm.
@@ -51,7 +51,7 @@ public interface InterfaceClustering {
* @param referenceSet a reference population for dynamic measures
* @return True if species converge, else False.
*/
- public boolean mergingSpecies(Population species1, Population species2, Population referenceSet);
+ boolean mergingSpecies(Population species1, Population species2, Population referenceSet);
/**
* Do some pre-calculations on a population for clustering. If additional population data
@@ -59,7 +59,7 @@ public interface InterfaceClustering {
*
* @param pop
*/
- public String initClustering(Population pop);
+ String initClustering(Population pop);
/**
* Try to associate a set of loners with a given set of species. Return a list
@@ -77,5 +77,5 @@ public interface InterfaceClustering {
* @param referenceSet a reference population for dynamic measures
* @return associative list matching loners to species.
*/
- public int[] associateLoners(Population loners, Population[] species, Population referenceSet);
+ int[] associateLoners(Population loners, Population[] species, Population referenceSet);
}
diff --git a/src/eva2/optimization/operator/cluster/InterfaceClusteringDistanceParam.java b/src/eva2/optimization/operator/cluster/InterfaceClusteringDistanceParam.java
index dd38816b..9bce4ff6 100644
--- a/src/eva2/optimization/operator/cluster/InterfaceClusteringDistanceParam.java
+++ b/src/eva2/optimization/operator/cluster/InterfaceClusteringDistanceParam.java
@@ -6,7 +6,7 @@ package eva2.optimization.operator.cluster;
* @author mkron
*/
public interface InterfaceClusteringDistanceParam extends InterfaceClustering {
- public double getClustDistParam();
+ double getClustDistParam();
- public void setClustDistParam(double param);
+ void setClustDistParam(double param);
}
diff --git a/src/eva2/optimization/operator/cluster/InterfaceClusteringMetricBased.java b/src/eva2/optimization/operator/cluster/InterfaceClusteringMetricBased.java
index dc5cfc55..cfbc97bc 100644
--- a/src/eva2/optimization/operator/cluster/InterfaceClusteringMetricBased.java
+++ b/src/eva2/optimization/operator/cluster/InterfaceClusteringMetricBased.java
@@ -8,7 +8,7 @@ import eva2.optimization.operator.distancemetric.InterfaceDistanceMetric;
* @author mkron
*/
public interface InterfaceClusteringMetricBased {
- public InterfaceDistanceMetric getMetric();
+ InterfaceDistanceMetric getMetric();
- public void setMetric(InterfaceDistanceMetric m);
+ void setMetric(InterfaceDistanceMetric m);
}
diff --git a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanLinear.java b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanLinear.java
index 5eb68285..c0c04db5 100644
--- a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanLinear.java
+++ b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanLinear.java
@@ -41,11 +41,7 @@ public class ConstObjectivesInEqualityBiggerThanLinear implements InterfaceConst
if (d.length != 2) {
return true;
}
- if ((this.m * d[0] + this.b) < d[1]) {
- return true;
- } else {
- return false;
- }
+ return (this.m * d[0] + this.b) < d[1];
}
}
diff --git a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanSurface.java b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanSurface.java
index c695b219..0664d2cd 100644
--- a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanSurface.java
+++ b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityBiggerThanSurface.java
@@ -38,11 +38,7 @@ public class ConstObjectivesInEqualityBiggerThanSurface implements InterfaceCons
@Override
public boolean isValid(AbstractEAIndividual indy) {
double[] d = indy.getFitness();
- if (this.getScalarProduct(norm, this.getSubstraction(d, base)) >= 0) {
- return true;
- } else {
- return false;
- }
+ return this.getScalarProduct(norm, this.getSubstraction(d, base)) >= 0;
}
private double[] getSubstraction(double[] a, double[] b) {
diff --git a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityLesserThanLinear.java b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityLesserThanLinear.java
index 38f4d9f7..29a29346 100644
--- a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityLesserThanLinear.java
+++ b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualityLesserThanLinear.java
@@ -41,10 +41,6 @@ public class ConstObjectivesInEqualityLesserThanLinear implements InterfaceConst
if (d.length != 2) {
return true;
}
- if ((this.m * d[0] + this.b) > d[1]) {
- return true;
- } else {
- return false;
- }
+ return (this.m * d[0] + this.b) > d[1];
}
}
\ No newline at end of file
diff --git a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualitySmallerThanSurface.java b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualitySmallerThanSurface.java
index 849a5388..bc25be10 100644
--- a/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualitySmallerThanSurface.java
+++ b/src/eva2/optimization/operator/constraint/ConstObjectivesInEqualitySmallerThanSurface.java
@@ -38,11 +38,7 @@ public class ConstObjectivesInEqualitySmallerThanSurface implements InterfaceCon
@Override
public boolean isValid(AbstractEAIndividual indy) {
double[] d = indy.getFitness();
- if (this.getScalarProduct(norm, this.getSubstraction(d, base)) < 0) {
- return true;
- } else {
- return false;
- }
+ return this.getScalarProduct(norm, this.getSubstraction(d, base)) < 0;
}
private double[] getSubstraction(double[] a, double[] b) {
diff --git a/src/eva2/optimization/operator/constraint/InterfaceConstraint.java b/src/eva2/optimization/operator/constraint/InterfaceConstraint.java
index 7cc6c121..79aec048 100644
--- a/src/eva2/optimization/operator/constraint/InterfaceConstraint.java
+++ b/src/eva2/optimization/operator/constraint/InterfaceConstraint.java
@@ -13,7 +13,7 @@ public interface InterfaceConstraint {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows you wether or not a given individual
@@ -22,5 +22,5 @@ public interface InterfaceConstraint {
* @param indy The individual to check.
* @return true if valid false else.
*/
- public boolean isValid(AbstractEAIndividual indy);
+ boolean isValid(AbstractEAIndividual indy);
}
diff --git a/src/eva2/optimization/operator/constraint/InterfaceDoubleConstraint.java b/src/eva2/optimization/operator/constraint/InterfaceDoubleConstraint.java
index f6ae1ddf..2b24b1aa 100644
--- a/src/eva2/optimization/operator/constraint/InterfaceDoubleConstraint.java
+++ b/src/eva2/optimization/operator/constraint/InterfaceDoubleConstraint.java
@@ -10,7 +10,7 @@ public interface InterfaceDoubleConstraint {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* Returns the boolean information whether the constraint is satisfied.
@@ -18,7 +18,7 @@ public interface InterfaceDoubleConstraint {
* @param indyX
* @return
*/
- public boolean isSatisfied(double[] indyX);
+ boolean isSatisfied(double[] indyX);
/**
* Return the absolute (positive) degree of violation or zero if the constraint
@@ -27,5 +27,5 @@ public interface InterfaceDoubleConstraint {
* @param indyX possibly the decoded individual position
* @return true if valid false else.
*/
- public double getViolation(double[] indyX);
+ double getViolation(double[] indyX);
}
diff --git a/src/eva2/optimization/operator/crossover/CrossoverOBGAPMX.java b/src/eva2/optimization/operator/crossover/CrossoverOBGAPMX.java
index 790edac5..5cafcf60 100644
--- a/src/eva2/optimization/operator/crossover/CrossoverOBGAPMX.java
+++ b/src/eva2/optimization/operator/crossover/CrossoverOBGAPMX.java
@@ -86,11 +86,7 @@ public class CrossoverOBGAPMX implements InterfaceCrossover, java.io.Serializabl
*/
@Override
public boolean equals(Object crossover) {
- if (crossover instanceof CrossoverOBGAPMX) {
- return true;
- } else {
- return false;
- }
+ return crossover instanceof CrossoverOBGAPMX;
}
@Override
diff --git a/src/eva2/optimization/operator/crossover/CrossoverOBGAPMXUniform.java b/src/eva2/optimization/operator/crossover/CrossoverOBGAPMXUniform.java
index fbc810e9..78a1079e 100644
--- a/src/eva2/optimization/operator/crossover/CrossoverOBGAPMXUniform.java
+++ b/src/eva2/optimization/operator/crossover/CrossoverOBGAPMXUniform.java
@@ -84,11 +84,7 @@ public class CrossoverOBGAPMXUniform implements InterfaceCrossover, java.io.Seri
*/
@Override
public boolean equals(Object crossover) {
- if (crossover instanceof CrossoverOBGAPMXUniform) {
- return true;
- } else {
- return false;
- }
+ return crossover instanceof CrossoverOBGAPMXUniform;
}
diff --git a/src/eva2/optimization/operator/crossover/InterfaceCrossover.java b/src/eva2/optimization/operator/crossover/InterfaceCrossover.java
index 95597859..3cc889a1 100644
--- a/src/eva2/optimization/operator/crossover/InterfaceCrossover.java
+++ b/src/eva2/optimization/operator/crossover/InterfaceCrossover.java
@@ -15,7 +15,7 @@ public interface InterfaceCrossover {
*
* @return The clone
*/
- public Object clone();
+ Object clone();
/**
* This method performs crossover on two individuals. Note: the genotype of the individuals
@@ -24,7 +24,7 @@ public interface InterfaceCrossover {
* @param indy1 The first individual
* @param partners The second individual
*/
- public AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners);
+ AbstractEAIndividual[] mate(AbstractEAIndividual indy1, Population partners);
/**
* This method will allow the crossover operator to be initialized depending on the
@@ -35,7 +35,7 @@ public interface InterfaceCrossover {
* @param individual The individual that will be mutated.
* @param opt The optimization problem.
*/
- public void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt);
+ void init(AbstractEAIndividual individual, InterfaceOptimizationProblem opt);
/**
* This method allows you to get a string representation of the mutation
@@ -43,7 +43,7 @@ public interface InterfaceCrossover {
*
* @return A descriptive string.
*/
- public String getStringRepresentation();
+ String getStringRepresentation();
/**
* This method allows you to evaluate wether two crossover operators
@@ -52,5 +52,5 @@ public interface InterfaceCrossover {
* @param crossover The other crossover operator
*/
@Override
- public boolean equals(Object crossover);
+ boolean equals(Object crossover);
}
diff --git a/src/eva2/optimization/operator/crossover/InterfaceEvaluatingCrossoverOperator.java b/src/eva2/optimization/operator/crossover/InterfaceEvaluatingCrossoverOperator.java
index a872281d..ff1d75a6 100644
--- a/src/eva2/optimization/operator/crossover/InterfaceEvaluatingCrossoverOperator.java
+++ b/src/eva2/optimization/operator/crossover/InterfaceEvaluatingCrossoverOperator.java
@@ -7,7 +7,7 @@ public interface InterfaceEvaluatingCrossoverOperator extends InterfaceCrossover
*
* @return
*/
- public int getEvaluations();
+ int getEvaluations();
- public void resetEvaluations();
+ void resetEvaluations();
}
diff --git a/src/eva2/optimization/operator/crossover/PropertyCrossoverMixerEditor.java b/src/eva2/optimization/operator/crossover/PropertyCrossoverMixerEditor.java
index 194aa250..348f5e08 100644
--- a/src/eva2/optimization/operator/crossover/PropertyCrossoverMixerEditor.java
+++ b/src/eva2/optimization/operator/crossover/PropertyCrossoverMixerEditor.java
@@ -137,7 +137,7 @@ public class PropertyCrossoverMixerEditor extends JPanel implements PropertyEdit
* This method updates the server list
*/
private void updateTargetList() {
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes;
InterfaceCrossover[] list = this.crossoverMixer.getSelectedCrossers();
double[] weights = this.crossoverMixer.getWeights();
diff --git a/src/eva2/optimization/operator/distancemetric/InterfaceDistanceMetric.java b/src/eva2/optimization/operator/distancemetric/InterfaceDistanceMetric.java
index 4f9e306f..e7428df0 100644
--- a/src/eva2/optimization/operator/distancemetric/InterfaceDistanceMetric.java
+++ b/src/eva2/optimization/operator/distancemetric/InterfaceDistanceMetric.java
@@ -16,7 +16,7 @@ public interface InterfaceDistanceMetric {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows you to compute the distance between two individuals.
@@ -27,5 +27,5 @@ public interface InterfaceDistanceMetric {
* @param indy2 The second individual.
* @return double
*/
- public double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2);
+ double distance(AbstractEAIndividual indy1, AbstractEAIndividual indy2);
}
diff --git a/src/eva2/optimization/operator/fitnessmodifier/InterfaceFitnessModifier.java b/src/eva2/optimization/operator/fitnessmodifier/InterfaceFitnessModifier.java
index 14f2f020..38dac5f5 100644
--- a/src/eva2/optimization/operator/fitnessmodifier/InterfaceFitnessModifier.java
+++ b/src/eva2/optimization/operator/fitnessmodifier/InterfaceFitnessModifier.java
@@ -14,6 +14,6 @@ public interface InterfaceFitnessModifier {
* your problem to store the unaltered fitness somewhere else so that
* you may still fetch it!
*/
- public void modifyFitness(Population population);
+ void modifyFitness(Population population);
}
diff --git a/src/eva2/optimization/operator/initialization/InterfaceInitialization.java b/src/eva2/optimization/operator/initialization/InterfaceInitialization.java
index 09e2dd7f..ecaf78d1 100644
--- a/src/eva2/optimization/operator/initialization/InterfaceInitialization.java
+++ b/src/eva2/optimization/operator/initialization/InterfaceInitialization.java
@@ -20,12 +20,12 @@ public interface InterfaceInitialization {
* @param indy the target individual to initialize
* @param problem the problem instance under consideration
*/
- public void initialize(AbstractEAIndividual indy, InterfaceOptimizationProblem problem);
+ void initialize(AbstractEAIndividual indy, InterfaceOptimizationProblem problem);
/**
* A specific cloning method.
*
* @return
*/
- public InterfaceInitialization clone();
+ InterfaceInitialization clone();
}
diff --git a/src/eva2/optimization/operator/migration/InterfaceMigration.java b/src/eva2/optimization/operator/migration/InterfaceMigration.java
index 8316fcc5..90c9cf94 100644
--- a/src/eva2/optimization/operator/migration/InterfaceMigration.java
+++ b/src/eva2/optimization/operator/migration/InterfaceMigration.java
@@ -16,13 +16,13 @@ public interface InterfaceMigration {
/**
* The ever present clone method
*/
- public Object clone();
+ Object clone();
/**
* Typically i'll need some initialization method for
* every bit of code i write....
*/
- public void initializeMigration(InterfaceOptimizer[] islands);
+ void initializeMigration(InterfaceOptimizer[] islands);
/**
* The migrate method can be called asychnronously or
@@ -35,5 +35,5 @@ public interface InterfaceMigration {
* you call getPopulation() on an island it is not a reference
* to the population but a serialized copy of the population!!
*/
- public void migrate(InterfaceOptimizer[] islands);
+ void migrate(InterfaceOptimizer[] islands);
}
diff --git a/src/eva2/optimization/operator/moso/InterfaceMOSOConverter.java b/src/eva2/optimization/operator/moso/InterfaceMOSOConverter.java
index b5ca63a1..5ad3b537 100644
--- a/src/eva2/optimization/operator/moso/InterfaceMOSOConverter.java
+++ b/src/eva2/optimization/operator/moso/InterfaceMOSOConverter.java
@@ -16,7 +16,7 @@ public interface InterfaceMOSOConverter {
*
* @return the clone
*/
- public Object clone();
+ Object clone();
/**
* This method takes a population of individuals with an array of
@@ -27,7 +27,7 @@ public interface InterfaceMOSOConverter {
*
* @param pop The population to process.
*/
- public void convertMultiObjective2SingleObjective(Population pop);
+ void convertMultiObjective2SingleObjective(Population pop);
/**
* This method allows the problem to set the current output size of
@@ -36,14 +36,14 @@ public interface InterfaceMOSOConverter {
*
* @param dim output dimension
*/
- public void setOutputDimension(int dim);
+ void setOutputDimension(int dim);
/**
* This method processes a single individual
*
* @param indy The individual to process.
*/
- public void convertSingleIndividual(AbstractEAIndividual indy);
+ void convertSingleIndividual(AbstractEAIndividual indy);
/**
* This method allows the CommonJavaObjectEditorPanel to read the
@@ -51,12 +51,12 @@ public interface InterfaceMOSOConverter {
*
* @return The name.
*/
- public String getName();
+ String getName();
/**
* This method returns a description of the objective
*
* @return A String
*/
- public String getStringRepresentation();
+ String getStringRepresentation();
}
diff --git a/src/eva2/optimization/operator/mutation/InterfaceAdaptOperatorGenerational.java b/src/eva2/optimization/operator/mutation/InterfaceAdaptOperatorGenerational.java
index 54e9f59f..ece5b609 100644
--- a/src/eva2/optimization/operator/mutation/InterfaceAdaptOperatorGenerational.java
+++ b/src/eva2/optimization/operator/mutation/InterfaceAdaptOperatorGenerational.java
@@ -17,7 +17,7 @@ public interface InterfaceAdaptOperatorGenerational {
* @param oldPop the initial population for the developmental step
* @param selectedPop the sup-population selected as parents for the new generation
*/
- public void adaptAfterSelection(Population oldPop, Population selectedPop);
+ void adaptAfterSelection(Population oldPop, Population selectedPop);
/**
* Perform adaption of the operator based on the developmental step performed by an EA.
@@ -32,5 +32,5 @@ public interface InterfaceAdaptOperatorGenerational {
* @param newPop the new population created by the EA, should already be evaluated
* @param updateSelected if true, the selected population should be adapted as well
*/
- public void adaptGenerational(Population oldPop, Population selectedPop, Population newPop, boolean updateSelected);
+ void adaptGenerational(Population oldPop, Population selectedPop, Population newPop, boolean updateSelected);
}
diff --git a/src/eva2/optimization/operator/mutation/InterfaceMutation.java b/src/eva2/optimization/operator/mutation/InterfaceMutation.java
index deb01c56..0e12183c 100644
--- a/src/eva2/optimization/operator/mutation/InterfaceMutation.java
+++ b/src/eva2/optimization/operator/mutation/InterfaceMutation.java
@@ -15,7 +15,7 @@ public interface InterfaceMutation {
*
* @return The clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows you to initialize the mutation operator
@@ -23,7 +23,7 @@ public interface InterfaceMutation {
* @param individual The individual that will be mutated.
* @param opt The optimization problem.
*/
- public void initialize(AbstractEAIndividual individual, InterfaceOptimizationProblem opt);
+ void initialize(AbstractEAIndividual individual, InterfaceOptimizationProblem opt);
/**
* This method will mutate a given AbstractEAIndividual. If the individual
@@ -31,7 +31,7 @@ public interface InterfaceMutation {
*
* @param individual The individual that is to be mutated
*/
- public void mutate(AbstractEAIndividual individual);
+ void mutate(AbstractEAIndividual individual);
/**
* This method allows you to perform either crossover on the strategy parameters
@@ -40,7 +40,7 @@ public interface InterfaceMutation {
* @param indy1 The original mother
* @param partners The original partners
*/
- public void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners);
+ void crossoverOnStrategyParameters(AbstractEAIndividual indy1, Population partners);
/**
* This method allows you to get a string representation of the mutation
@@ -48,7 +48,7 @@ public interface InterfaceMutation {
*
* @return A descriptive string.
*/
- public String getStringRepresentation();
+ String getStringRepresentation();
/**
* This method allows you to evaluate wether two mutation operators
@@ -57,5 +57,5 @@ public interface InterfaceMutation {
* @param mutator The other mutation operator
*/
@Override
- public boolean equals(Object mutator);
+ boolean equals(Object mutator);
}
diff --git a/src/eva2/optimization/operator/mutation/MutateESGlobal.java b/src/eva2/optimization/operator/mutation/MutateESGlobal.java
index f91f340f..9bb4cb30 100644
--- a/src/eva2/optimization/operator/mutation/MutateESGlobal.java
+++ b/src/eva2/optimization/operator/mutation/MutateESGlobal.java
@@ -3,8 +3,8 @@ package eva2.optimization.operator.mutation;
import eva2.optimization.enums.MutateESCrossoverType;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.individuals.InterfaceESIndividual;
-import eva2.optimization.population.Population;
import eva2.optimization.population.PopulationInterface;
+import eva2.optimization.population.Population;
import eva2.problems.InterfaceAdditionalPopulationInformer;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.tools.math.RNG;
diff --git a/src/eva2/optimization/operator/mutation/PropertyMutationMixerEditor.java b/src/eva2/optimization/operator/mutation/PropertyMutationMixerEditor.java
index 8d3495bd..9a5d4094 100644
--- a/src/eva2/optimization/operator/mutation/PropertyMutationMixerEditor.java
+++ b/src/eva2/optimization/operator/mutation/PropertyMutationMixerEditor.java
@@ -139,7 +139,7 @@ public class PropertyMutationMixerEditor extends JPanel implements PropertyEdito
* This method updates the server list
*/
private void updateTargetList() {
- BasicResourceLoader loader = BasicResourceLoader.instance();
+ BasicResourceLoader loader = BasicResourceLoader.getInstance();
byte[] bytes;
InterfaceMutation[] list = this.mutatorsWithWeights.getSelectedMutators();
double[] weights = this.mutatorsWithWeights.getWeights();
diff --git a/src/eva2/optimization/operator/nichepso/absorption/InterfaceAbsorptionStrategy.java b/src/eva2/optimization/operator/nichepso/absorption/InterfaceAbsorptionStrategy.java
index 6a967591..eee45ac9 100644
--- a/src/eva2/optimization/operator/nichepso/absorption/InterfaceAbsorptionStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/absorption/InterfaceAbsorptionStrategy.java
@@ -16,7 +16,7 @@ public interface InterfaceAbsorptionStrategy {
* @return
* @tested decides whether indy should be absorbed into the subswarm according to the absorption strategie
*/
- public abstract boolean shouldAbsorbParticleIntoSubswarm(
+ boolean shouldAbsorbParticleIntoSubswarm(
AbstractEAIndividual indy,
ParticleSubSwarmOptimization subswarm,
ParticleSubSwarmOptimization mainswarm);
@@ -27,10 +27,10 @@ public interface InterfaceAbsorptionStrategy {
* @param mainswarm the swarm indy currently belongs to
* @tested absorbs indy according to the absorbtion strategy
*/
- public abstract void absorbParticle(
+ void absorbParticle(
AbstractEAIndividual indy,
ParticleSubSwarmOptimization subswarm,
ParticleSubSwarmOptimization mainswarm);
- public abstract Object clone();
+ Object clone();
}
diff --git a/src/eva2/optimization/operator/nichepso/absorption/StandardAbsorptionStrategy.java b/src/eva2/optimization/operator/nichepso/absorption/StandardAbsorptionStrategy.java
index 9d8dcc83..b969d1a0 100644
--- a/src/eva2/optimization/operator/nichepso/absorption/StandardAbsorptionStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/absorption/StandardAbsorptionStrategy.java
@@ -32,10 +32,7 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
if (!subswarm.isActive()) {
return false; // no interaction between active mainswarmparticle and inactive subswarm
}
- if (!particleLiesInSubswarmRadius(indy, subswarm)) {
- return false;
- }
- return true;
+ return particleLiesInSubswarmRadius(indy, subswarm);
}
private boolean particleLiesInSubswarmRadius(AbstractEAIndividual indy, ParticleSubSwarmOptimization subswarm) {
@@ -43,11 +40,7 @@ public class StandardAbsorptionStrategy implements InterfaceAbsorptionStrategy,
double R = subswarm.getBoundSwarmRadius(); // uses euclidean distance
AbstractEAIndividual gbest = subswarm.getGBestIndividual();
double dist = subswarm.distance(indy, gbest); // euclidean distance
- if (dist <= R) {
- return true;
- } else {
- return false;
- }
+ return dist <= R;
}
diff --git a/src/eva2/optimization/operator/nichepso/deactivation/InterfaceDeactivationStrategy.java b/src/eva2/optimization/operator/nichepso/deactivation/InterfaceDeactivationStrategy.java
index 25480ebe..1abb2059 100644
--- a/src/eva2/optimization/operator/nichepso/deactivation/InterfaceDeactivationStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/deactivation/InterfaceDeactivationStrategy.java
@@ -12,7 +12,7 @@ public interface InterfaceDeactivationStrategy {
* @return
* @tested decides whether a subswarm should be deacitvated according to the deactivation strategy
*/
- public abstract boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm);
+ boolean shouldDeactivateSubswarm(ParticleSubSwarmOptimization subswarm);
/**
* @param subswarm
@@ -21,8 +21,8 @@ public interface InterfaceDeactivationStrategy {
* What happens to the particles in this subswarm depends on the concrete strategy.
* Return the list of indices to be reinitialized or null.
*/
- public abstract int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm);
+ int[] deactivateSubswarm(ParticleSubSwarmOptimization subswarm, ParticleSubSwarmOptimization mainswarm);
- public abstract Object clone();
+ Object clone();
}
diff --git a/src/eva2/optimization/operator/nichepso/merging/InterfaceMergingStrategy.java b/src/eva2/optimization/operator/nichepso/merging/InterfaceMergingStrategy.java
index 6c3f78d7..345c2309 100644
--- a/src/eva2/optimization/operator/nichepso/merging/InterfaceMergingStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/merging/InterfaceMergingStrategy.java
@@ -17,7 +17,7 @@ public interface InterfaceMergingStrategy {
* @param subswarm2
* @return
*/
- public abstract boolean shouldMergeSubswarms(
+ boolean shouldMergeSubswarms(
ParticleSubSwarmOptimization subswarm1,
ParticleSubSwarmOptimization subswarm2);
@@ -32,11 +32,11 @@ public interface InterfaceMergingStrategy {
* @param subSwarms
* @param mainSwarm
*/
- public abstract void mergeSubswarms(
+ void mergeSubswarms(
int i,
int j,
Vector subSwarms,
ParticleSubSwarmOptimization mainSwarm);
- public abstract Object clone();
+ Object clone();
}
diff --git a/src/eva2/optimization/operator/nichepso/merging/StandardMergingStrategy.java b/src/eva2/optimization/operator/nichepso/merging/StandardMergingStrategy.java
index 1cd4587b..07790211 100644
--- a/src/eva2/optimization/operator/nichepso/merging/StandardMergingStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/merging/StandardMergingStrategy.java
@@ -54,12 +54,9 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i
return false;
}
- if (!subswarmsOverlapOrAreVeryClose(subswarm1, subswarm2)) {
- return false;
- }
+ return subswarmsOverlapOrAreVeryClose(subswarm1, subswarm2);
- return true;
}
private boolean subswarmsOverlapOrAreVeryClose(ParticleSubSwarmOptimization subswarm1, ParticleSubSwarmOptimization subswarm2) {
@@ -101,10 +98,7 @@ public class StandardMergingStrategy implements InterfaceMergingStrategy, java.i
} // normalised distance
//if (Ri == 0 && Rj == 0 && dist_norm < getEpsilon()){ // see "Enhancing the NichePSO" paper
- if (dist_norm < getMu()) { // Ri und Rj auf null testen sinvoll ?
- return true;
- }
- return false;
+ return dist_norm < getMu();
}
/**********************************************************************************************************************
diff --git a/src/eva2/optimization/operator/nichepso/subswarmcreation/InterfaceSubswarmCreationStrategy.java b/src/eva2/optimization/operator/nichepso/subswarmcreation/InterfaceSubswarmCreationStrategy.java
index f82ad131..ba86ef6d 100644
--- a/src/eva2/optimization/operator/nichepso/subswarmcreation/InterfaceSubswarmCreationStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/subswarmcreation/InterfaceSubswarmCreationStrategy.java
@@ -14,7 +14,7 @@ public interface InterfaceSubswarmCreationStrategy {
* @return
* @tested decides whether a subswarm should be created for the given indy and mainswarm according to the creation strategie
*/
- public abstract boolean shouldCreateSubswarm(
+ boolean shouldCreateSubswarm(
AbstractEAIndividual indy,
ParticleSubSwarmOptimization mainswarm);
@@ -26,10 +26,10 @@ public interface InterfaceSubswarmCreationStrategy {
* @param mainSwarm the main swarm which contains indy
* @tested creates a subswarm from indy, the details depend on the concrete strategy.
*/
- public abstract void createSubswarm(
+ void createSubswarm(
ParticleSubSwarmOptimization preparedSubswarm,
AbstractEAIndividual indy,
ParticleSubSwarmOptimization mainSwarm);
- public abstract Object clone();
+ Object clone();
}
diff --git a/src/eva2/optimization/operator/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java b/src/eva2/optimization/operator/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java
index 39554948..8c2408b8 100644
--- a/src/eva2/optimization/operator/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java
+++ b/src/eva2/optimization/operator/nichepso/subswarmcreation/StandardSubswarmCreationStrategy.java
@@ -48,11 +48,8 @@ public class StandardSubswarmCreationStrategy implements InterfaceSubswarmCreati
// check for stddev < delta condition
double stddev = (Double) indy.getData(NichePSO.stdDevKey);
- if (stddev >= getDelta()) {
- return false;
- }
+ return stddev < getDelta();
- return true;
}
/**
diff --git a/src/eva2/optimization/operator/paramcontrol/GenericParamAdaption.java b/src/eva2/optimization/operator/paramcontrol/GenericParamAdaption.java
index 28e399c1..617b1f7b 100644
--- a/src/eva2/optimization/operator/paramcontrol/GenericParamAdaption.java
+++ b/src/eva2/optimization/operator/paramcontrol/GenericParamAdaption.java
@@ -12,5 +12,5 @@ public interface GenericParamAdaption extends ParamAdaption {
*
* @param prm
*/
- public void setControlledParam(String prm);
+ void setControlledParam(String prm);
}
diff --git a/src/eva2/optimization/operator/paramcontrol/InterfaceHasUpperDoubleBound.java b/src/eva2/optimization/operator/paramcontrol/InterfaceHasUpperDoubleBound.java
index fbcfd05f..a618db5e 100644
--- a/src/eva2/optimization/operator/paramcontrol/InterfaceHasUpperDoubleBound.java
+++ b/src/eva2/optimization/operator/paramcontrol/InterfaceHasUpperDoubleBound.java
@@ -7,7 +7,7 @@ package eva2.optimization.operator.paramcontrol;
* @author mkron
*/
public interface InterfaceHasUpperDoubleBound {
- public double getUpperBnd();
+ double getUpperBnd();
- public void SetUpperBnd(double u);
+ void SetUpperBnd(double u);
}
diff --git a/src/eva2/optimization/operator/paramcontrol/InterfaceParamControllable.java b/src/eva2/optimization/operator/paramcontrol/InterfaceParamControllable.java
index ef42df5c..6a312a26 100644
--- a/src/eva2/optimization/operator/paramcontrol/InterfaceParamControllable.java
+++ b/src/eva2/optimization/operator/paramcontrol/InterfaceParamControllable.java
@@ -6,11 +6,11 @@ package eva2.optimization.operator.paramcontrol;
* @author mkron
*/
public interface InterfaceParamControllable {
- public void notifyParamChanged(String member, Object oldVal, Object newVal);
+ void notifyParamChanged(String member, Object oldVal, Object newVal);
- public Object[] getParamControl();
+ Object[] getParamControl();
- public void addChangeListener(ParamChangeListener l);
+ void addChangeListener(ParamChangeListener l);
- public void removeChangeListener(ParamChangeListener l);
+ void removeChangeListener(ParamChangeListener l);
}
diff --git a/src/eva2/optimization/operator/paramcontrol/InterfaceParameterControl.java b/src/eva2/optimization/operator/paramcontrol/InterfaceParameterControl.java
index 4dbbac8b..00b6bc33 100644
--- a/src/eva2/optimization/operator/paramcontrol/InterfaceParameterControl.java
+++ b/src/eva2/optimization/operator/paramcontrol/InterfaceParameterControl.java
@@ -24,21 +24,21 @@ public interface InterfaceParameterControl {
*
* @return Deep copy
*/
- public Object clone();
+ Object clone();
/**
* Initialize the parameter control instance before a run.
*
* @param obj The controlled object.
*/
- public void init(Object obj, Population initialPop);
+ void init(Object obj, Population initialPop);
/**
* After an optimization run, finalizing stuff may be done.
*
* @param obj The controlled object.
*/
- public void finish(Object obj, Population finalPop);
+ void finish(Object obj, Population finalPop);
/**
* For a given runtime (maxIteration) and current iteration, update the parameters of the object.
@@ -48,7 +48,7 @@ public interface InterfaceParameterControl {
* @param iteration Iteration
* @param maxIteration Maximum Iteration
*/
- public void updateParameters(Object obj, Population pop, int iteration, int maxIteration);
+ void updateParameters(Object obj, Population pop, int iteration, int maxIteration);
/**
* If no runtime in terms of iterations can be specified, the parameter control may try to infer
@@ -56,5 +56,5 @@ public interface InterfaceParameterControl {
*
* @param obj Object
*/
- public void updateParameters(Object obj);
+ void updateParameters(Object obj);
}
diff --git a/src/eva2/optimization/operator/paramcontrol/ParamAdaption.java b/src/eva2/optimization/operator/paramcontrol/ParamAdaption.java
index f34d9646..8dbe5eb4 100644
--- a/src/eva2/optimization/operator/paramcontrol/ParamAdaption.java
+++ b/src/eva2/optimization/operator/paramcontrol/ParamAdaption.java
@@ -9,9 +9,9 @@ import eva2.optimization.population.Population;
*/
public interface ParamAdaption {
- public Object clone();
+ Object clone();
- public String getControlledParam();
+ String getControlledParam();
/**
* Perform the adaption.
@@ -20,10 +20,10 @@ public interface ParamAdaption {
* @param maxIteration
* @return
*/
- public Object calcValue(Object obj, Population pop, int iteration, int maxIteration);
+ Object calcValue(Object obj, Population pop, int iteration, int maxIteration);
- public void init(Object obj, Population pop, Object[] initialValues);
+ void init(Object obj, Population pop, Object[] initialValues);
- public void finish(Object obj, Population pop);
+ void finish(Object obj, Population pop);
}
diff --git a/src/eva2/optimization/operator/paramcontrol/ParamChangeListener.java b/src/eva2/optimization/operator/paramcontrol/ParamChangeListener.java
index 357e5b49..7edd279f 100644
--- a/src/eva2/optimization/operator/paramcontrol/ParamChangeListener.java
+++ b/src/eva2/optimization/operator/paramcontrol/ParamChangeListener.java
@@ -1,5 +1,5 @@
package eva2.optimization.operator.paramcontrol;
public interface ParamChangeListener {
- public void notifyChange(InterfaceParamControllable controllable, Object oldVal, Object newVal, String msg);
+ void notifyChange(InterfaceParamControllable controllable, Object oldVal, Object newVal, String msg);
}
diff --git a/src/eva2/optimization/operator/paretofrontmetrics/InterfaceParetoFrontMetric.java b/src/eva2/optimization/operator/paretofrontmetrics/InterfaceParetoFrontMetric.java
index 6ca873be..c1816211 100644
--- a/src/eva2/optimization/operator/paretofrontmetrics/InterfaceParetoFrontMetric.java
+++ b/src/eva2/optimization/operator/paretofrontmetrics/InterfaceParetoFrontMetric.java
@@ -13,11 +13,11 @@ public interface InterfaceParetoFrontMetric {
*
* @return the clone
*/
- public Object clone();
+ Object clone();
/**
* This method gives a metirc how to evaluate
* an achieved Pareto-Front
*/
- public double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem);
+ double calculateMetricOn(Population pop, AbstractMultiObjectiveOptimizationProblem problem);
}
diff --git a/src/eva2/optimization/operator/postprocess/InterfacePostProcessParams.java b/src/eva2/optimization/operator/postprocess/InterfacePostProcessParams.java
index 7abe05f5..b767204e 100644
--- a/src/eva2/optimization/operator/postprocess/InterfacePostProcessParams.java
+++ b/src/eva2/optimization/operator/postprocess/InterfacePostProcessParams.java
@@ -11,37 +11,37 @@ import eva2.optimization.enums.PostProcessMethod;
* @author mkron
*/
public interface InterfacePostProcessParams {
- public int getPostProcessSteps();
+ int getPostProcessSteps();
- public void setPostProcessSteps(int ppSteps);
+ void setPostProcessSteps(int ppSteps);
- public String postProcessStepsTipText();
+ String postProcessStepsTipText();
- public boolean isDoPostProcessing();
+ boolean isDoPostProcessing();
- public void setDoPostProcessing(boolean postProcess);
+ void setDoPostProcessing(boolean postProcess);
- public String doPostProcessingTipText();
+ String doPostProcessingTipText();
- public double getPostProcessClusterSigma();
+ double getPostProcessClusterSigma();
- public void setPostProcessClusterSigma(double postProcessClusterSigma);
+ void setPostProcessClusterSigma(double postProcessClusterSigma);
- public String postProcessClusterSigmaTipText();
+ String postProcessClusterSigmaTipText();
- public int getPrintNBest();
+ int getPrintNBest();
- public void setPrintNBest(int nBest);
+ void setPrintNBest(int nBest);
- public String printNBestTipText();
+ String printNBestTipText();
- public void setPPMethod(PostProcessMethod meth);
+ void setPPMethod(PostProcessMethod meth);
- public PostProcessMethod getPPMethod();
+ PostProcessMethod getPPMethod();
- public String PPMethodTipText();
+ String PPMethodTipText();
- public boolean isWithPlot();
+ boolean isWithPlot();
- public void setWithPlot(boolean withPlot);
+ void setWithPlot(boolean withPlot);
}
diff --git a/src/eva2/optimization/operator/postprocess/PostProcess.java b/src/eva2/optimization/operator/postprocess/PostProcess.java
index f2df2b18..525d04eb 100644
--- a/src/eva2/optimization/operator/postprocess/PostProcess.java
+++ b/src/eva2/optimization/operator/postprocess/PostProcess.java
@@ -5,10 +5,10 @@ import eva2.OptimizerRunnable;
import eva2.gui.BeanInspector;
import eva2.gui.plot.Plot;
import eva2.gui.plot.TopoPlot;
+import eva2.optimization.OptimizationParameters;
import eva2.optimization.enums.ESMutationInitialSigma;
import eva2.optimization.enums.PostProcessMethod;
import eva2.optimization.individuals.*;
-import eva2.optimization.OptimizationParameters;
import eva2.optimization.operator.cluster.ClusteringDensityBased;
import eva2.optimization.operator.cluster.InterfaceClustering;
import eva2.optimization.operator.crossover.CrossoverESDefault;
diff --git a/src/eva2/optimization/operator/postprocess/SolutionHistogram.java b/src/eva2/optimization/operator/postprocess/SolutionHistogram.java
index 14b3aa8d..0ebc7ada 100644
--- a/src/eva2/optimization/operator/postprocess/SolutionHistogram.java
+++ b/src/eva2/optimization/operator/postprocess/SolutionHistogram.java
@@ -152,7 +152,7 @@ public class SolutionHistogram {
* This resets the arity.
*
* @param pop
- * @param hist
+ * @param crit
*/
public void updateFrom(Population pop, int crit) {
SolutionHistogram.createFitNormHistogram(pop, this, crit);
@@ -176,10 +176,6 @@ public class SolutionHistogram {
return res;
}
-// public void updateFrom(Population pop, double accuracy) {
-//
-// }
-
public double getScore() {
double sc = 0;
if (sum() > 0) {
diff --git a/src/eva2/optimization/operator/selection/InterfaceSelection.java b/src/eva2/optimization/operator/selection/InterfaceSelection.java
index 36d17081..a5a01db9 100644
--- a/src/eva2/optimization/operator/selection/InterfaceSelection.java
+++ b/src/eva2/optimization/operator/selection/InterfaceSelection.java
@@ -21,7 +21,7 @@ public interface InterfaceSelection {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method allows an selection method to do some preliminary
@@ -31,7 +31,7 @@ public interface InterfaceSelection {
*
* @param population The population that is to be processed.
*/
- public void prepareSelection(Population population);
+ void prepareSelection(Population population);
/**
* This method will select >size< individuals from the given
@@ -41,7 +41,7 @@ public interface InterfaceSelection {
* @param size The number of Individuals to select
* @return The selected population.
*/
- public Population selectFrom(Population population, int size);
+ Population selectFrom(Population population, int size);
/**
* This method allows you to select >size< partners for a given Individual
@@ -51,7 +51,7 @@ public interface InterfaceSelection {
* @param size The number of partners needed.
* @return The selected partners.
*/
- public Population findPartnerFor(AbstractEAIndividual dad, Population availablePartners, int size);
+ Population findPartnerFor(AbstractEAIndividual dad, Population availablePartners, int size);
/**
* Toggle the use of obeying the constraint violation principle
@@ -59,5 +59,5 @@ public interface InterfaceSelection {
*
* @param b The new state
*/
- public void setObeyDebsConstViolationPrinciple(boolean b);
+ void setObeyDebsConstViolationPrinciple(boolean b);
}
diff --git a/src/eva2/optimization/operator/selection/probability/InterfaceSelectionProbability.java b/src/eva2/optimization/operator/selection/probability/InterfaceSelectionProbability.java
index 439976e6..d9a98649 100644
--- a/src/eva2/optimization/operator/selection/probability/InterfaceSelectionProbability.java
+++ b/src/eva2/optimization/operator/selection/probability/InterfaceSelectionProbability.java
@@ -16,7 +16,7 @@ public interface InterfaceSelectionProbability {
*
* @return the deep clone
*/
- public Object clone();
+ Object clone();
/**
* This method computes the selection probability for each individual
@@ -26,7 +26,7 @@ public interface InterfaceSelectionProbability {
* @param population The population to compute.
* @param input The name of the input.
*/
- public void computeSelectionProbability(Population population, String[] input, boolean obeyConst);
+ void computeSelectionProbability(Population population, String[] input, boolean obeyConst);
/**
* This method computes the selection probability for each individual
@@ -36,7 +36,7 @@ public interface InterfaceSelectionProbability {
* @param population The population to compute.
* @param input The name of the input.
*/
- public void computeSelectionProbability(Population population, String input, boolean obeyConst);
+ void computeSelectionProbability(Population population, String input, boolean obeyConst);
/**
* This method computes the selection probability for each individual
@@ -46,5 +46,5 @@ public interface InterfaceSelectionProbability {
* @param population The population to compute.
* @param data The input data as double[][].
*/
- public void computeSelectionProbability(Population population, double[][] data, boolean obeyConst);
+ void computeSelectionProbability(Population population, double[][] data, boolean obeyConst);
}
diff --git a/src/eva2/optimization/operator/selection/replacement/InterfaceReplacement.java b/src/eva2/optimization/operator/selection/replacement/InterfaceReplacement.java
index e6af90c5..895c8683 100644
--- a/src/eva2/optimization/operator/selection/replacement/InterfaceReplacement.java
+++ b/src/eva2/optimization/operator/selection/replacement/InterfaceReplacement.java
@@ -11,7 +11,7 @@ public interface InterfaceReplacement {
/**
* The ever present clone method
*/
- public Object clone();
+ Object clone();
/**
* This method will insert the given individual into the population
@@ -22,5 +22,5 @@ public interface InterfaceReplacement {
* @param pop The population
* @param sub The subset
*/
- public void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub);
+ void insertIndividual(AbstractEAIndividual indy, Population pop, Population sub);
}
diff --git a/src/eva2/optimization/operator/terminators/CombinedTerminator.java b/src/eva2/optimization/operator/terminators/CombinedTerminator.java
index 1d6a8f83..de33da1f 100644
--- a/src/eva2/optimization/operator/terminators/CombinedTerminator.java
+++ b/src/eva2/optimization/operator/terminators/CombinedTerminator.java
@@ -1,7 +1,7 @@
package eva2.optimization.operator.terminators;
-import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.PopulationInterface;
+import eva2.optimization.population.InterfaceSolutionSet;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
import eva2.util.annotation.Parameter;
diff --git a/src/eva2/optimization/operator/terminators/HistoryConvergenceTerminator.java b/src/eva2/optimization/operator/terminators/HistoryConvergenceTerminator.java
index 564114e8..84a7b4a5 100644
--- a/src/eva2/optimization/operator/terminators/HistoryConvergenceTerminator.java
+++ b/src/eva2/optimization/operator/terminators/HistoryConvergenceTerminator.java
@@ -3,9 +3,9 @@ package eva2.optimization.operator.terminators;
import eva2.optimization.individuals.AbstractEAIndividual;
import eva2.optimization.individuals.EAIndividualComparator;
import eva2.optimization.operator.distancemetric.ObjectiveSpaceMetric;
+import eva2.optimization.population.PopulationInterface;
import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.Population;
-import eva2.optimization.population.PopulationInterface;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
diff --git a/src/eva2/optimization/operator/terminators/InterfaceTerminator.java b/src/eva2/optimization/operator/terminators/InterfaceTerminator.java
index 431b91fc..22db31d5 100644
--- a/src/eva2/optimization/operator/terminators/InterfaceTerminator.java
+++ b/src/eva2/optimization/operator/terminators/InterfaceTerminator.java
@@ -14,14 +14,14 @@ public interface InterfaceTerminator {
* @param pop the population to test
* @return true if the population fulfills the termination criterion, else false
*/
- public boolean isTerminated(PopulationInterface pop);
+ boolean isTerminated(PopulationInterface pop);
- public boolean isTerminated(InterfaceSolutionSet pop);
+ boolean isTerminated(InterfaceSolutionSet pop);
@Override
- public String toString();
+ String toString();
- public String lastTerminationMessage();
+ String lastTerminationMessage();
- public void initialize(InterfaceOptimizationProblem prob);
+ void initialize(InterfaceOptimizationProblem prob);
}
\ No newline at end of file
diff --git a/src/eva2/optimization/operator/terminators/ParetoMetricTerminator.java b/src/eva2/optimization/operator/terminators/ParetoMetricTerminator.java
index 29cb5d7e..0e7da230 100644
--- a/src/eva2/optimization/operator/terminators/ParetoMetricTerminator.java
+++ b/src/eva2/optimization/operator/terminators/ParetoMetricTerminator.java
@@ -3,8 +3,8 @@ package eva2.optimization.operator.terminators;
import eva2.gui.BeanInspector;
import eva2.optimization.operator.paretofrontmetrics.InterfaceParetoFrontMetric;
import eva2.optimization.operator.paretofrontmetrics.MetricS;
-import eva2.optimization.population.Population;
import eva2.optimization.population.PopulationInterface;
+import eva2.optimization.population.Population;
import eva2.problems.AbstractMultiObjectiveOptimizationProblem;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.tools.EVAERROR;
diff --git a/src/eva2/optimization/operator/terminators/PopulationMeasureTerminator.java b/src/eva2/optimization/operator/terminators/PopulationMeasureTerminator.java
index d6590a42..e734170c 100644
--- a/src/eva2/optimization/operator/terminators/PopulationMeasureTerminator.java
+++ b/src/eva2/optimization/operator/terminators/PopulationMeasureTerminator.java
@@ -1,7 +1,7 @@
package eva2.optimization.operator.terminators;
-import eva2.optimization.population.InterfaceSolutionSet;
import eva2.optimization.population.PopulationInterface;
+import eva2.optimization.population.InterfaceSolutionSet;
import eva2.problems.InterfaceOptimizationProblem;
import eva2.util.annotation.Description;
diff --git a/src/eva2/optimization/population/InterfaceSolutionSet.java b/src/eva2/optimization/population/InterfaceSolutionSet.java
index 5edffd89..bc6bb83f 100644
--- a/src/eva2/optimization/population/InterfaceSolutionSet.java
+++ b/src/eva2/optimization/population/InterfaceSolutionSet.java
@@ -9,9 +9,9 @@ package eva2.optimization.population;
* @author mkron
*/
public interface InterfaceSolutionSet {
- public Population getSolutions();
+ Population getSolutions();
- public Population getCurrentPopulation();
+ Population getCurrentPopulation();
- public SolutionSet clone();
+ SolutionSet clone();
}
diff --git a/src/eva2/optimization/statistics/AbstractStatistics.java b/src/eva2/optimization/statistics/AbstractStatistics.java
index e4ab84a1..1ddcc272 100644
--- a/src/eva2/optimization/statistics/AbstractStatistics.java
+++ b/src/eva2/optimization/statistics/AbstractStatistics.java
@@ -99,7 +99,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
private List lastInformerList = null;
private PopulationInterface lastSols = null;
- private String textFieldDelimiter = "\t";
+ private String textFieldDelimiter = " | ";
private int defaultFitCriterion = 0; // ToDo this might be a user chosen int - or even more elegantly, a MOSOConverter
protected StringSelection lastFieldSelection = null; // store the graph selection at the beginning of a multi-run
@@ -238,8 +238,11 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
@Override
public void startOptimizationPerformed(String infoString, int runNumber, InterfaceOptimizationParameters params, List informerList) {
-
if (runNumber == 0) {
+ if (printRunIntroVerbosity()) {
+ printToTextListener("# Optimization");
+ }
+
// store the initial graph selection state, so that modifications during runtime cannot cause inconsistencies
lastFieldSelection = (StringSelection) statisticsParameter.getFieldSelection().clone();
lastIsShowFull = statisticsParameter.isOutputAllFieldsAsText();
@@ -275,7 +278,27 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
feasibleFoundAfterSum = -1;
numOfRunsFeasibleFound = 0;
+ if (params != null) {
+ if (printRunIntroVerbosity()) {
+ printToTextListener("\n### Optimization parameters \n```\n");
+ printToTextListener(BeanSerializer.serializeObject(params));
+ printToTextListener("\n```\n\n");
+ }
+ }
+ /*
+ ToDo: Figure out if we need this. Right now it is just spamming the text output
+ if (printRunIntroVerbosity()) {
+ printToTextListener("\nStatistics parameters: ");
+ printToTextListener(BeanInspector.niceToString(getStatisticsParameters()) + '\n');
+ }
+ */
+
}
+
+ if (printRunIntroVerbosity()) {
+ printToTextListener("## Multirun " + (runNumber + 1) + "\n");
+ }
+
feasibleFoundAfter = -1;
bestCurrentIndy = null;
bestOfRunIndy = null;
@@ -284,22 +307,6 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
lastInformerList = null;
lastSols = null;
iterationCounter = 0;
- if (printRunIntroVerbosity()) {
- printToTextListener("\n****** Multirun " + runNumber);
- }
- if (params != null) {
- if (printRunIntroVerbosity()) {
- printToTextListener("\nOptimization parameters: \n");
- printToTextListener(BeanSerializer.serializeObject(params));
- }
- }
- /*
- ToDo: Figure out if we need this. Right now it is just spamming the text output
- if (printRunIntroVerbosity()) {
- printToTextListener("\nStatistics parameters: ");
- printToTextListener(BeanInspector.niceToString(getStatisticsParameters()) + '\n');
- }
- */
functionCalls = 0;
fireDataListenersStartStop(runNumber, true, true);
}
@@ -387,9 +394,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
}
if (printRunStoppedVerbosity()) {
if (resultPop != null && (resultPop.size() > 0)) {
- printToTextListener("Resulting population: \n");
+ printToTextListener("### Resulting population \n");
for (int i = 0; i < resultPop.size(); i++) {
- printToTextListener(AbstractEAIndividual.getDefaultStringRepresentation(resultPop.getEAIndividual(i)));
+ printToTextListener(AbstractEAIndividual.getDefaultStringRepresentation(resultPop.getEAIndividual(i)) + " ");
printToTextListener("\n");
}
}
@@ -506,7 +513,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
}
if (refineMultiRuns && (sumDataCollection != null)) {
if (printFinalVerbosity()) {
- printToTextListener(" Averaged performance:\n");
+ printToTextListener("#### Averaged performance:\n\n");
}
// the summed-up values of the mean collection is divided by the number of runs
for (int i = 0; i < sumDataCollection.size(); i++) {
@@ -581,11 +588,14 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
}
public String refineToText(ArrayList data, int iterationsToShow) {
- String hd = getOutputHeaderFieldNamesAsString(lastInformerList);
+ List additionalFields = getOutputHeaderFieldNames(lastInformerList);
StringBuffer sbuf = new StringBuffer("Iteration");
sbuf.append(textFieldDelimiter);
- sbuf.append(hd);
+ sbuf.append(StringTools.concatFields(additionalFields, " | "));
sbuf.append("\n");
+ String[] tableSeparator = new String[additionalFields.size()+1];
+ Arrays.fill(tableSeparator, "---");
+ sbuf.append(StringTools.concatFields(tableSeparator, " | ") + "\n");
refineToText(data, iterationsToShow, sbuf, textFieldDelimiter);
return sbuf.toString();
}
@@ -612,13 +622,14 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
@Override
- public void printToTextListener(String s) {
+ public void printToTextListener(String... s) {
+ String text = StringTools.concatFields(s, "");
if ((resultOut != null)) {
- resultOut.print(s);
+ resultOut.print(text);
}
for (InterfaceTextListener l : textListeners) {
if (statisticsParameter.getOutputTo() != InterfaceStatisticsParameters.OutputTo.FILE) {
- l.print(s);
+ l.print(text);
}
}
}
@@ -1068,7 +1079,10 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
if (iterationCounter == 0) {
String headerLine = StringTools.concatFields(currentStatHeader, textFieldDelimiter);
if (printHeaderByVerbosity()) {
- printToTextListener(headerLine + '\n');
+ printToTextListener("| " + headerLine + " | \n");
+ String[] tableSeparator = new String[currentStatHeader.length];
+ Arrays.fill(tableSeparator, "---");
+ printToTextListener("| " + StringTools.concatFields(tableSeparator, textFieldDelimiter) + " | \n");
}
}
@@ -1076,7 +1090,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
Pair addData = getOutputData(informerList, lastSols);
if (doTextOutput()) { // this is where the text output is actually written
if (printLineByVerbosity(iterationCounter)) {
- printToTextListener(addData.head() + '\n');
+ printToTextListener("| " + addData.head() + " | \n");
}
}
currentStatObjectData = addData.tail();
diff --git a/src/eva2/optimization/statistics/InterfaceStatistics.java b/src/eva2/optimization/statistics/InterfaceStatistics.java
index 0562610f..6d9bcc05 100644
--- a/src/eva2/optimization/statistics/InterfaceStatistics.java
+++ b/src/eva2/optimization/statistics/InterfaceStatistics.java
@@ -31,7 +31,7 @@ public interface InterfaceStatistics {
boolean removeTextListener(InterfaceTextListener listener);
- void printToTextListener(String s);
+ void printToTextListener(String... s);
void createNextGenerationPerformed(PopulationInterface Pop, InterfaceOptimizer opt, List informerList);
diff --git a/src/eva2/optimization/statistics/InterfaceStatisticsListener.java b/src/eva2/optimization/statistics/InterfaceStatisticsListener.java
index c15cf140..4bbcec09 100644
--- a/src/eva2/optimization/statistics/InterfaceStatisticsListener.java
+++ b/src/eva2/optimization/statistics/InterfaceStatisticsListener.java
@@ -18,7 +18,7 @@ public interface InterfaceStatisticsListener {
* @param statObjects
* @param statDoubles
*/
- public void notifyGenerationPerformed(String[] header, Object[] statObjects, Double[] statDoubles);
+ void notifyGenerationPerformed(String[] header, Object[] statObjects, Double[] statDoubles);
/**
* Method called at the start of a single run.
@@ -28,7 +28,7 @@ public interface InterfaceStatisticsListener {
* @param header field names of the data
* @param metaInfo additional meta information on the data fields
*/
- public void notifyRunStarted(int runNumber, int plannedMultiRuns, String[] header, String[] metaInfo);
+ void notifyRunStarted(int runNumber, int plannedMultiRuns, String[] header, String[] metaInfo);
/**
* Method called at the end of a single run.
@@ -36,7 +36,7 @@ public interface InterfaceStatisticsListener {
* @param runsPerformed the number of runs performed
* @param completedLastRun true, if the last run was stopped normally, otherwise false, e.g. indicating a user break
*/
- public void notifyRunStopped(int runsPerformed, boolean completedLastRun);
+ void notifyRunStopped(int runsPerformed, boolean completedLastRun);
/**
* Receive the list of last data lines for a set of multiruns. The data list may be null if no runs were
@@ -47,7 +47,7 @@ public interface InterfaceStatisticsListener {
* @see InterfaceStatisticsParameters
* @see AbstractStatistics
*/
- public void finalMultiRunResults(String[] header, List