All RMI has been removed. GUI not working properly right now, but at least the code compiles.
This commit is contained in:
parent
a4fe1498f2
commit
b0ab7aba0c
@ -1,5 +1,6 @@
|
|||||||
package eva2;
|
package eva2;
|
||||||
|
|
||||||
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.server.go.IndividualInterface;
|
import eva2.server.go.IndividualInterface;
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.go.InterfaceTerminator;
|
import eva2.server.go.InterfaceTerminator;
|
||||||
@ -13,7 +14,6 @@ import eva2.server.go.populations.SolutionSet;
|
|||||||
import eva2.server.modules.GOParameters;
|
import eva2.server.modules.GOParameters;
|
||||||
import eva2.server.modules.Processor;
|
import eva2.server.modules.Processor;
|
||||||
import eva2.server.stat.*;
|
import eva2.server.stat.*;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.util.BitSet;
|
import java.util.BitSet;
|
||||||
@ -132,7 +132,7 @@ public class OptimizerRunnable implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addRemoteStateListener(RemoteStateListener rsl) {
|
public void addOptimizationStateListener(OptimizationStateListener rsl) {
|
||||||
if (proc != null) {
|
if (proc != null) {
|
||||||
proc.addListener(rsl);
|
proc.addListener(rsl);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ package eva2.client;
|
|||||||
*/
|
*/
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.gui.*;
|
import eva2.gui.*;
|
||||||
import eva2.server.EvAServer;
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.modules.AbstractModuleAdapter;
|
import eva2.server.modules.AbstractModuleAdapter;
|
||||||
import eva2.server.modules.GOParameters;
|
import eva2.server.modules.GOParameters;
|
||||||
@ -26,7 +26,6 @@ import eva2.tools.BasicResourceLoader;
|
|||||||
import eva2.tools.EVAERROR;
|
import eva2.tools.EVAERROR;
|
||||||
import eva2.tools.ReflectPackage;
|
import eva2.tools.ReflectPackage;
|
||||||
import eva2.tools.StringTools;
|
import eva2.tools.StringTools;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
import java.awt.event.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@ -42,7 +41,7 @@ import javax.swing.*;
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EvAClient extends JFrame implements RemoteStateListener {
|
public class EvAClient extends JFrame implements OptimizationStateListener {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generated serial version identifier.
|
* Generated serial version identifier.
|
||||||
@ -52,12 +51,11 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
private boolean clientInited = false;
|
private boolean clientInited = false;
|
||||||
private JExtDesktopPaneToolBar desktopToolBar;
|
private JExtDesktopPaneToolBar desktopToolBar;
|
||||||
private JDesktopPane desktopPane;
|
private JDesktopPane desktopPane;
|
||||||
//private JFrame mainFrame;
|
|
||||||
private JPanel configurationPane;
|
private JPanel configurationPane;
|
||||||
private JSplitPane horizontalSplit;
|
private JSplitPane horizontalSplit;
|
||||||
private Runnable initRnbl = null;
|
private Runnable initRnbl = null;
|
||||||
|
|
||||||
private EvAComAdapter comAdapter;
|
//private EvAComAdapter comAdapter;
|
||||||
private transient JMenuBar menuBar;
|
private transient JMenuBar menuBar;
|
||||||
private transient JExtMenu menuHelp;
|
private transient JExtMenu menuHelp;
|
||||||
private transient JExtMenu menuSelHosts;
|
private transient JExtMenu menuSelHosts;
|
||||||
@ -94,27 +92,28 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
private boolean showLoadModules = false;
|
private boolean showLoadModules = false;
|
||||||
private boolean localMode = false;
|
private boolean localMode = false;
|
||||||
|
|
||||||
// This variable says whether, if running locally, a local server should be addressed by RMI.
|
|
||||||
// False should be preferred here to avoid overhead
|
|
||||||
private boolean useLocalRMI = false;
|
|
||||||
// measuring optimization runtime
|
// measuring optimization runtime
|
||||||
private long startTime = 0;
|
private long startTime = 0;
|
||||||
// remember the module in use
|
// remember the module in use
|
||||||
private transient String currentModule = null;
|
private transient String currentModule = null;
|
||||||
private List<RemoteStateListener> superListenerList = null;
|
|
||||||
private boolean withGUI = true;
|
private boolean withGUI = true;
|
||||||
private boolean withTreeView = false;
|
private boolean withTreeView = false;
|
||||||
private EvATabbedFrameMaker frameMaker = null;
|
private EvATabbedFrameMaker frameMaker = null;
|
||||||
private Window parentWindow;
|
private Window parentWindow;
|
||||||
|
|
||||||
public void addRemoteStateListener(RemoteStateListener l) {
|
private List<OptimizationStateListener> superListenerList = null;
|
||||||
|
|
||||||
|
private EvAComAdapter comAdapter;
|
||||||
|
|
||||||
|
|
||||||
|
public void addOptimizationStateListener(OptimizationStateListener l) {
|
||||||
if (superListenerList == null) {
|
if (superListenerList == null) {
|
||||||
superListenerList = new ArrayList<RemoteStateListener>();
|
superListenerList = new ArrayList<OptimizationStateListener>();
|
||||||
}
|
}
|
||||||
superListenerList.add(l);
|
superListenerList.add(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removeRemoteStateListener(RemoteStateListener l) {
|
public boolean removeOptimizationStateListener(OptimizationStateListener l) {
|
||||||
if (superListenerList != null) {
|
if (superListenerList != null) {
|
||||||
return superListenerList.remove(l);
|
return superListenerList.remove(l);
|
||||||
} else {
|
} else {
|
||||||
@ -212,7 +211,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main constructor of the EvA2 client GUI. Works as standalone verson
|
* Main constructor of the EvA2 client GUI. Works as standalone version
|
||||||
* locally or as client for the EvA2 server. GO parameters may be loaded
|
* 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
|
* 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
|
* be null to start with standard parameters. If both are non null, the java
|
||||||
@ -500,7 +499,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
if (goParams == null && (paramsFile != null && (paramsFile.length() > 0))) {
|
if (goParams == null && (paramsFile != null && (paramsFile.length() > 0))) {
|
||||||
goParams = GOParameters.getInstance(paramsFile, false);
|
goParams = GOParameters.getInstance(paramsFile, false);
|
||||||
}
|
}
|
||||||
loadModuleFromServer(useDefaultModule, goParams);//loadSpecificModule
|
loadSpecificModule(useDefaultModule, goParams);//loadSpecificModule
|
||||||
}
|
}
|
||||||
|
|
||||||
if (withGUI) {
|
if (withGUI) {
|
||||||
@ -521,14 +520,6 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comAdapter != null) {
|
|
||||||
if (hostName != null) {
|
|
||||||
selectHost(hostName);
|
|
||||||
}
|
|
||||||
comAdapter.setLogPanel(logPanel);
|
|
||||||
LOGGER.log(Level.INFO, "Selected Host: {0}", comAdapter.getHostName());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (withGUI) {
|
if (withGUI) {
|
||||||
LOGGER.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
|
LOGGER.log(Level.INFO, "Working directory is: {0}", System.getProperty("user.dir"));
|
||||||
LOGGER.log(Level.INFO, "Class path is: {0}", System.getProperty("java.class.path", "."));
|
LOGGER.log(Level.INFO, "Class path is: {0}", System.getProperty("java.class.path", "."));
|
||||||
@ -710,14 +701,6 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
actModuleLoad = new ExtAction("&Load", "Load Module",
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_L, Event.CTRL_MASK)) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
loadModuleFromServer(null, null);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
actAbout = new ExtAction("&About", "Product Information") {
|
actAbout = new ExtAction("&About", "Product Information") {
|
||||||
|
|
||||||
@ -735,60 +718,6 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
showLicense();
|
showLicense();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
actHost = new ExtAction("&List of all servers", "All servers in list",
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_A, Event.CTRL_MASK)) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
LOGGER.info(event.getActionCommand());
|
|
||||||
selectAvailableHost(comAdapter.getHostNameList());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
actAvailableHost = new ExtAction("Available &Server", "Available server",
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_H, Event.CTRL_MASK)) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
LOGGER.info(event.getActionCommand());
|
|
||||||
showPleaseWaitDialog();
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
selectAvailableHost(comAdapter.getAvailableHostNameList());
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
actKillHost = new ExtAction("&Kill server", "Kill server process on selected host",
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_K, Event.CTRL_MASK)) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
LOGGER.info(event.getActionCommand());
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
selectAvailableHostToKill(comAdapter.getAvailableHostNameList());
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
showPleaseWaitDialog();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
actKillAllHosts = new ExtAction("Kill &all servers", "Kill all servers",
|
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_K, Event.CTRL_MASK)) {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(final ActionEvent event) {
|
|
||||||
LOGGER.info(event.getActionCommand());
|
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
selectAllAvailableHostToKill(comAdapter.getAvailableHostNameList());
|
|
||||||
}
|
|
||||||
}.start();
|
|
||||||
showPleaseWaitDialog();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
actQuit = new ExtAction("&Quit", "Quit EvA2 workbench",
|
actQuit = new ExtAction("&Quit", "Quit EvA2 workbench",
|
||||||
KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)) {
|
KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK)) {
|
||||||
@ -874,80 +803,6 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
menuBar.add(menuHelp);
|
menuBar.add(menuHelp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void loadModuleFromServer(String selectedModule, InterfaceGOParameters goParams) {
|
|
||||||
if (comAdapter.getHostName() == null) {
|
|
||||||
System.err.println("error in loadModuleFromServer!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (comAdapter.getHostName().equals("localhost")) {
|
|
||||||
localMode = true;
|
|
||||||
if (useLocalRMI) {
|
|
||||||
EvAServer Server = new EvAServer(true, false);
|
|
||||||
comAdapter.setLocalRMIServer(Server.getRMIServer());
|
|
||||||
LOGGER.info("Local EvAServer started");
|
|
||||||
comAdapter.setRunLocally(false); // this is not quite true but should have the desired effect
|
|
||||||
} else {
|
|
||||||
LOGGER.info("Working locally");
|
|
||||||
comAdapter.setLocalRMIServer(null);
|
|
||||||
comAdapter.setRunLocally(true);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
localMode = false;
|
|
||||||
comAdapter.setRunLocally(false);
|
|
||||||
}
|
|
||||||
if (selectedModule == null) { // show a dialog and ask for a module
|
|
||||||
String[] moduleNameList = comAdapter.getModuleNameList();
|
|
||||||
if (moduleNameList == null) {
|
|
||||||
JOptionPane.showMessageDialog(this, "No modules available on " + comAdapter.getHostName(), EvAInfo.infoTitle, 1);
|
|
||||||
} else {
|
|
||||||
String lastModule = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
java.util.prefs.Preferences prefs = java.util.prefs.Preferences.userRoot();
|
|
||||||
lastModule = prefs.get("lastModule", null);
|
|
||||||
} catch (SecurityException ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Can't write user preference.", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastModule == null) {
|
|
||||||
lastModule = moduleNameList[0];
|
|
||||||
LOGGER.log(Level.INFO, "Defaulting to module: {0}", lastModule);
|
|
||||||
}
|
|
||||||
|
|
||||||
selectedModule = (String) JOptionPane.showInputDialog(this,
|
|
||||||
"Which module do you want \n to load on host: " + comAdapter.getHostName() + " ?",
|
|
||||||
"Load optimization module on host",
|
|
||||||
JOptionPane.QUESTION_MESSAGE,
|
|
||||||
null,
|
|
||||||
moduleNameList,
|
|
||||||
lastModule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedModule == null) {
|
|
||||||
System.err.println("not loading any module");
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
java.util.prefs.Preferences prefs = java.util.prefs.Preferences.userRoot();
|
|
||||||
prefs.put("lastModule", selectedModule);
|
|
||||||
} catch (SecurityException ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Can't write user preference.", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
loadSpecificModule(selectedModule, goParams);
|
|
||||||
|
|
||||||
if (withGUI) {
|
|
||||||
actHost.setEnabled(true);
|
|
||||||
actAvailableHost.setEnabled(true);
|
|
||||||
}
|
|
||||||
LOGGER.log(Level.INFO, "Selected Module: {0}", selectedModule);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the GOParamters of a loaded module. Return null if no module is
|
* Retrieve the GOParamters of a loaded module. Return null if no module is
|
||||||
* loaded.
|
* loaded.
|
||||||
@ -1015,10 +870,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
showLoadModules = true;
|
showLoadModules = true;
|
||||||
} else {
|
} else {
|
||||||
newModuleAdapter.setConnection(!localMode);
|
newModuleAdapter.setConnection(!localMode);
|
||||||
if (comAdapter.isRunLocally()) {
|
newModuleAdapter.addOptimizationStateListener((OptimizationStateListener) this);
|
||||||
// TODO in rmi-mode this doesnt work yet! meaning e.g. that theres no content in the info log
|
|
||||||
newModuleAdapter.addRemoteStateListener((RemoteStateListener) this);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (withGUI) {
|
if (withGUI) {
|
||||||
// this (or rather: EvAModuleButtonPanelMaker) is where the start button etc come from!
|
// this (or rather: EvAModuleButtonPanelMaker) is where the start button etc come from!
|
||||||
@ -1107,35 +959,6 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
return treeView;
|
return treeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void selectAvailableHost(String[] hostNames) {
|
|
||||||
if (hostNames == null || hostNames.length == 0) {
|
|
||||||
showNoHostFoundDialog();
|
|
||||||
} else {
|
|
||||||
String hostName = (String) JOptionPane.showInputDialog(this,
|
|
||||||
"Which active host do you want to connect to?", "Host", JOptionPane.QUESTION_MESSAGE, null,
|
|
||||||
hostNames, comAdapter.getHostName());
|
|
||||||
if (hostName != null) {
|
|
||||||
selectHost(hostName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectHost(String hostName) {
|
|
||||||
comAdapter.setHostName(hostName);
|
|
||||||
LOGGER.info("Selected Host: " + hostName);
|
|
||||||
if (currentModule != null) {
|
|
||||||
LOGGER.info("Reloading module from server...");
|
|
||||||
loadModuleFromServer(currentModule, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showPleaseWaitDialog() {
|
|
||||||
JOptionPane.showMessageDialog(this, "Please wait one moment.", EvAInfo.infoTitle, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showAboutDialog() {
|
private void showAboutDialog() {
|
||||||
AboutDialog aboutDialog = new AboutDialog(this);
|
AboutDialog aboutDialog = new AboutDialog(this);
|
||||||
aboutDialog.setLocationRelativeTo(this);
|
aboutDialog.setLocationRelativeTo(this);
|
||||||
@ -1150,38 +973,10 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
lgpl.show();
|
lgpl.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showNoHostFoundDialog() {
|
|
||||||
JOptionPane.showMessageDialog(this, "No host with running EVASERVER found. Please start one or \nadd the correct address to the properties list.", EvAInfo.infoTitle, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectAvailableHostToKill(String[] HostNames) {
|
|
||||||
if (HostNames == null || HostNames.length == 0) {
|
|
||||||
showNoHostFoundDialog();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String HostName = (String) JOptionPane.showInputDialog(this,
|
|
||||||
"Which server do you want to be killed ?", "Host", JOptionPane.QUESTION_MESSAGE, null,
|
|
||||||
HostNames, comAdapter.getHostName());
|
|
||||||
if (HostName == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
LOGGER.info("Kill host process on = " + HostName);
|
|
||||||
comAdapter.killServer(HostName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectAllAvailableHostToKill(String[] hostNames) {
|
|
||||||
System.out.println("SelectAllAvailableHostToKill");
|
|
||||||
if (hostNames == null || hostNames.length == 0) {
|
|
||||||
System.out.println("no host is running");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
comAdapter.killAllServers();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performedRestart(String infoString) {
|
public void performedRestart(String infoString) {
|
||||||
if (superListenerList != null) {
|
if (superListenerList != null) {
|
||||||
for (RemoteStateListener l : superListenerList) {
|
for (OptimizationStateListener l : superListenerList) {
|
||||||
l.performedRestart(infoString);
|
l.performedRestart(infoString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1192,7 +987,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void performedStart(String infoString) {
|
public void performedStart(String infoString) {
|
||||||
if (superListenerList != null) {
|
if (superListenerList != null) {
|
||||||
for (RemoteStateListener l : superListenerList) {
|
for (OptimizationStateListener l : superListenerList) {
|
||||||
l.performedStart(infoString);
|
l.performedStart(infoString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1203,7 +998,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void performedStop() {
|
public void performedStop() {
|
||||||
if (superListenerList != null) {
|
if (superListenerList != null) {
|
||||||
for (RemoteStateListener l : superListenerList) {
|
for (OptimizationStateListener l : superListenerList) {
|
||||||
l.performedStop();
|
l.performedStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1222,7 +1017,7 @@ public class EvAClient extends JFrame implements RemoteStateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void updateProgress(final int percent, String msg) {
|
public void updateProgress(final int percent, String msg) {
|
||||||
if (superListenerList != null) {
|
if (superListenerList != null) {
|
||||||
for (RemoteStateListener l : superListenerList) {
|
for (OptimizationStateListener l : superListenerList) {
|
||||||
l.updateProgress(percent, msg);
|
l.updateProgress(percent, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,17 +16,17 @@ import eva2.server.EvAMainAdapter;
|
|||||||
import eva2.server.EvAMainAdapterImpl;
|
import eva2.server.EvAMainAdapterImpl;
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.modules.ModuleAdapter;
|
import eva2.server.modules.ModuleAdapter;
|
||||||
import eva2.tools.jproxy.*;
|
|
||||||
import java.rmi.RemoteException;
|
import java.rmi.RemoteException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EvAComAdapter extends ComAdapter {
|
public class EvAComAdapter {
|
||||||
|
|
||||||
private LoggingPanel loggingPanel;
|
private LoggingPanel loggingPanel;
|
||||||
private EvAMainAdapterImpl localMainAdapter;
|
private EvAMainAdapterImpl localMainAdapter;
|
||||||
private boolean runLocally = false;
|
private boolean runLocally = false;
|
||||||
|
private static EvAComAdapter m_instance;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -41,7 +41,6 @@ public class EvAComAdapter extends ComAdapter {
|
|||||||
public static EvAComAdapter getInstance() {
|
public static EvAComAdapter getInstance() {
|
||||||
if (m_instance == null) {
|
if (m_instance == null) {
|
||||||
m_instance = new EvAComAdapter();
|
m_instance = new EvAComAdapter();
|
||||||
m_instance.addServersFromProperties(EvAInfo.getProperties());
|
|
||||||
}
|
}
|
||||||
return (EvAComAdapter) m_instance;
|
return (EvAComAdapter) m_instance;
|
||||||
}
|
}
|
||||||
@ -53,14 +52,8 @@ public class EvAComAdapter extends ComAdapter {
|
|||||||
*/
|
*/
|
||||||
public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) {
|
public ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile) {
|
||||||
ModuleAdapter newModuleAdapter;
|
ModuleAdapter newModuleAdapter;
|
||||||
if ((m_RMIServer == null) && isRunLocally()) {
|
newModuleAdapter = getLocalMainAdapter().getModuleAdapter(selectedModuleName, goParams, noGuiStatsFile);
|
||||||
newModuleAdapter = getLocalMainAdapter().getModuleAdapter(selectedModuleName, true, getHostName(), goParams, noGuiStatsFile, null);
|
|
||||||
} else {
|
|
||||||
newModuleAdapter = ((RMIConnectionEvA) getConnection(getHostName())).getModuleAdapter(selectedModuleName);
|
|
||||||
if (newModuleAdapter == null) {
|
|
||||||
System.err.println("RMI Error for getting ModuleAdapterObject : " + selectedModuleName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newModuleAdapter;
|
return newModuleAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,19 +75,9 @@ public class EvAComAdapter extends ComAdapter {
|
|||||||
*/
|
*/
|
||||||
public String[] getModuleNameList() {
|
public String[] getModuleNameList() {
|
||||||
String[] list;
|
String[] list;
|
||||||
|
|
||||||
if ((m_RMIServer == null) && isRunLocally()) {
|
|
||||||
list = getLocalMainAdapter().getModuleNameList();
|
list = getLocalMainAdapter().getModuleNameList();
|
||||||
} else {
|
|
||||||
RMIConnectionEvA Connection = (RMIConnectionEvA) getConnection(getHostName());
|
|
||||||
if (Connection == null) {
|
|
||||||
System.err.println("Couldnt create RMIConnection in EvAComAdapter.getModuleNameList");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
list = ((EvAMainAdapter) Connection.getMainAdapter()).getModuleNameList();
|
|
||||||
}
|
|
||||||
if (loggingPanel != null) {
|
if (loggingPanel != null) {
|
||||||
loggingPanel.logMessage("List of modules on server:");
|
loggingPanel.logMessage("List of modules available:");
|
||||||
}
|
}
|
||||||
if (list != null) {
|
if (list != null) {
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
@ -105,33 +88,4 @@ public class EvAComAdapter extends ComAdapter {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected MainAdapter getMainAdapter(RMIInvocationHandler invocHandler) throws RemoteException {
|
|
||||||
try {
|
|
||||||
return (EvAMainAdapter) invocHandler.getWrapper();
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
System.err.println("Warning: cannot cast to EvAMainAdapter in EvAComAdapter.. trying MainAdapter...");
|
|
||||||
}
|
|
||||||
return (MainAdapter) invocHandler.getWrapper();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected RMIConnection createRMIConnection(String Host, MainAdapter mainRemoteObject, MainAdapterClient client) {
|
|
||||||
return new RMIConnectionEvA(Host, mainRemoteObject, client);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the runLocally
|
|
||||||
*/
|
|
||||||
public boolean isRunLocally() {
|
|
||||||
return runLocally;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param runLocally the runLocally to set
|
|
||||||
*/
|
|
||||||
public void setRunLocally(boolean runLocally) {
|
|
||||||
this.runLocally = runLocally;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,54 +0,0 @@
|
|||||||
package eva2.client;
|
|
||||||
|
|
||||||
import eva2.server.EvAMainAdapter;
|
|
||||||
import eva2.server.modules.ModuleAdapter;
|
|
||||||
import eva2.tools.jproxy.MainAdapter;
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIConnection;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
class RMIConnectionEvA extends RMIConnection {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public RMIConnectionEvA(String HostName, MainAdapter Adapter,
|
|
||||||
MainAdapterClient AdapterClient) {
|
|
||||||
super(HostName, Adapter, AdapterClient);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public ModuleAdapter getModuleAdapter(String Modul) {
|
|
||||||
if (m_MainAdapter instanceof EvAMainAdapter) {
|
|
||||||
EvAMainAdapter evaAdapter = (EvAMainAdapter)m_MainAdapter;
|
|
||||||
ModuleAdapter ret = null;
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println("ComAdapter.getModuleAdapter(" + Modul + ")");
|
|
||||||
}
|
|
||||||
String hostAdd = "";
|
|
||||||
try {
|
|
||||||
hostAdd = InetAddress.getLocalHost().getHostAddress();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
hostAdd = "unknown host";
|
|
||||||
}
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println(" Client is = " + hostAdd);
|
|
||||||
}
|
|
||||||
m_MainAdapter.setBuf("Test_1");
|
|
||||||
|
|
||||||
ret = evaAdapter.getModuleAdapter(Modul, false, hostAdd, this.m_MainAdapterClient);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
System.err.println("error, couldnt get module adapter in EvAComAdapter.getModuleAdapter. Main adapter is not of type EvAMainAdapter!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -9,67 +9,34 @@ package eva2.gui;
|
|||||||
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
|
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIProxyRemote;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/*==========================================================================*
|
|
||||||
* CLASS DECLARATION
|
|
||||||
*==========================================================================*/
|
|
||||||
/**
|
/**
|
||||||
* It represents one plot window in the client GUI.
|
* It represents one plot window in the client GUI.
|
||||||
*/
|
*/
|
||||||
public class DataViewer implements DataViewerInterface {
|
public class DataViewer implements DataViewerInterface {
|
||||||
public static boolean TRACE = false;
|
|
||||||
|
|
||||||
|
public static boolean TRACE = false;
|
||||||
static private int m_GraphCounter = -1;
|
static private int m_GraphCounter = -1;
|
||||||
static private ViewContainer m_ViewContainer;
|
static private ViewContainer viewContainer;
|
||||||
private MainAdapterClient m_MainAdapterClient;
|
|
||||||
private static String m_MyHostName;
|
|
||||||
private PlotInterface m_Plotter;
|
|
||||||
private String m_Name;
|
private String m_Name;
|
||||||
private Plot m_Plot;
|
private Plot m_Plot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static DataViewerInterface getInstance (MainAdapterClient client,String GraphWindowName) {
|
public static DataViewerInterface getInstance(String graphWindowName) {
|
||||||
if (m_ViewContainer == null) {
|
if (viewContainer == null) {
|
||||||
m_ViewContainer = new ViewContainer();
|
viewContainer = new ViewContainer();
|
||||||
}
|
}
|
||||||
DataViewerInterface ret = null;
|
DataViewerInterface ret = null;
|
||||||
try {
|
try {
|
||||||
if (!m_ViewContainer.containsName(GraphWindowName)) {
|
if (!viewContainer.containsName(graphWindowName)) {
|
||||||
////////////////////////////////////////////////
|
ret = new DataViewer(graphWindowName, true);
|
||||||
try {
|
viewContainer.add(ret);
|
||||||
m_MyHostName = InetAddress.getLocalHost().getHostName();
|
} else {
|
||||||
} catch (Exception e) {
|
ret = viewContainer.getPlot(graphWindowName);
|
||||||
System.out.println("InetAddress.getLocalHost().getHostAddress() --> ERROR" + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (client != null && client.getHostName().equals(m_MyHostName)== true) {
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println("no RMI");
|
|
||||||
}
|
|
||||||
ret = new DataViewer(GraphWindowName,true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = (DataViewerInterface) RMIProxyRemote.newInstance(new DataViewer(GraphWindowName,false), client);
|
|
||||||
ret.init();
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println("with RMI");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////
|
|
||||||
m_ViewContainer.add(ret);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = m_ViewContainer.getPlot(GraphWindowName);
|
|
||||||
}
|
}
|
||||||
} catch (Exception ee) {
|
} catch (Exception ee) {
|
||||||
System.out.println("GraphWindow ERROR : " + ee.getMessage());
|
System.out.println("GraphWindow ERROR : " + ee.getMessage());
|
||||||
@ -77,6 +44,7 @@ public class DataViewer implements DataViewerInterface {
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -89,12 +57,14 @@ public class DataViewer implements DataViewerInterface {
|
|||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return m_Name;
|
return m_Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -106,6 +76,7 @@ public class DataViewer implements DataViewerInterface {
|
|||||||
}
|
}
|
||||||
return new Graph(InfoString, m_Plot, m_GraphCounter);
|
return new Graph(InfoString, m_Plot, m_GraphCounter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -113,17 +84,21 @@ public class DataViewer implements DataViewerInterface {
|
|||||||
public void init() {
|
public void init() {
|
||||||
m_Plot = new Plot(m_Name, "x", "y", true);
|
m_Plot = new Plot(m_Name, "x", "y", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class ViewContainer extends ArrayList {
|
class ViewContainer extends ArrayList {
|
||||||
|
|
||||||
private DataViewer m_actualPlot;
|
private DataViewer m_actualPlot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public ViewContainer() {}
|
public ViewContainer() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ -137,6 +112,7 @@ class ViewContainer extends ArrayList {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -9,11 +9,10 @@ package eva2.gui;
|
|||||||
* $Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $
|
* $Date: 2007-11-27 14:37:05 +0100 (Tue, 27 Nov 2007) $
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.server.modules.ModuleAdapter;
|
import eva2.server.modules.ModuleAdapter;
|
||||||
import eva2.server.stat.EvAJob;
|
import eva2.server.stat.EvAJob;
|
||||||
import eva2.tools.ToolBoxGui;
|
import eva2.tools.ToolBoxGui;
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -28,7 +27,7 @@ import javax.swing.JToolBar;
|
|||||||
* Contains the GUI elements of start and stop buttons and optionally a help
|
* Contains the GUI elements of start and stop buttons and optionally a help
|
||||||
* button.
|
* button.
|
||||||
*/
|
*/
|
||||||
public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializable, PanelMaker {
|
public class EvAModuleButtonPanelMaker implements OptimizationStateListener, Serializable, PanelMaker {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(EvAModuleButtonPanelMaker.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(EvAModuleButtonPanelMaker.class.getName());
|
||||||
private String m_Name = "undefined";
|
private String m_Name = "undefined";
|
||||||
@ -56,19 +55,8 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
|
|||||||
toolBar = new JToolBar();
|
toolBar = new JToolBar();
|
||||||
toolBar.setFloatable(false);
|
toolBar.setFloatable(false);
|
||||||
|
|
||||||
/* ToDo: This is useless? */
|
moduleAdapter.addOptimizationStateListener((OptimizationStateListener) (this));
|
||||||
if (moduleAdapter.hasConnection()) { // we might be in rmi mode
|
|
||||||
try {
|
|
||||||
String myhostname = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not get hostname", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!moduleAdapter.hasConnection()) {
|
|
||||||
moduleAdapter.addRemoteStateListener((RemoteStateListener) (this));
|
|
||||||
} else {// there is a network RMI connection
|
|
||||||
moduleAdapter.addRemoteStateListener((RemoteStateListener) RMIProxyLocal.newInstance(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
runButton = ToolBoxGui.createIconifiedButton("images/Play24.gif", "Start", true);
|
runButton = ToolBoxGui.createIconifiedButton("images/Play24.gif", "Start", true);
|
||||||
@ -159,7 +147,6 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void makeHelpButton() {
|
private void makeHelpButton() {
|
||||||
///////////////////////////////////////////////////////////////
|
|
||||||
if (helpFileName != null && (!helpFileName.equals(""))) {
|
if (helpFileName != null && (!helpFileName.equals(""))) {
|
||||||
helpButton = new JButton("Description");
|
helpButton = new JButton("Description");
|
||||||
helpButton.setToolTipText("Description of the current optimization algorithm.");
|
helpButton.setToolTipText("Description of the current optimization algorithm.");
|
||||||
@ -167,7 +154,6 @@ public class EvAModuleButtonPanelMaker implements RemoteStateListener, Serializa
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
//System.out.println("Run Opt pressed !!!!!!!!!!!!!!!!======================!!");
|
|
||||||
try {
|
try {
|
||||||
if (helpFileName != null) {
|
if (helpFileName != null) {
|
||||||
HtmlDemo temp = new HtmlDemo(helpFileName);
|
HtmlDemo temp = new HtmlDemo(helpFileName);
|
||||||
|
@ -4,7 +4,6 @@ import eva2.server.go.tools.FileTools;
|
|||||||
import eva2.tools.BasicResourceLoader;
|
import eva2.tools.BasicResourceLoader;
|
||||||
import eva2.tools.EVAHELP;
|
import eva2.tools.EVAHELP;
|
||||||
import eva2.tools.SerializedObject;
|
import eva2.tools.SerializedObject;
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
@ -65,7 +64,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
private GenericObjectEditor genericObjectEditor = null;
|
private GenericObjectEditor genericObjectEditor = null;
|
||||||
private boolean withComboBoxToolTips = true; // should tool tips for the combo box be created?
|
private boolean withComboBoxToolTips = true; // should tool tips for the combo box be created?
|
||||||
private int tipMaxLen = 100; // maximum length of tool tip
|
private int tipMaxLen = 100; // maximum length of tool tip
|
||||||
|
|
||||||
private HashMap<String, String> classNameMap;
|
private HashMap<String, String> classNameMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,7 +97,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
propertySheetPanel = new PropertySheetPanel();
|
propertySheetPanel = new PropertySheetPanel();
|
||||||
propertySheetPanel.addPropertyChangeListener(
|
propertySheetPanel.addPropertyChangeListener(
|
||||||
new PropertyChangeListener() {
|
new PropertyChangeListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(final PropertyChangeEvent event) {
|
public void propertyChange(final PropertyChangeEvent event) {
|
||||||
propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue());
|
propChangeSupport.firePropertyChange("", backupObject, genericObjectEditor.getValue());
|
||||||
@ -109,7 +106,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
openButton.setToolTipText("Load a configured object");
|
openButton.setToolTipText("Load a configured object");
|
||||||
openButton.setEnabled(true);
|
openButton.setEnabled(true);
|
||||||
openButton.addActionListener(new ActionListener() {
|
openButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
Object object = FileTools.openObject(openButton, genericObjectEditor.getClassType());
|
Object object = FileTools.openObject(openButton, genericObjectEditor.getClassType());
|
||||||
@ -128,7 +124,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
saveButton.setToolTipText("Save the current configured object");
|
saveButton.setToolTipText("Save the current configured object");
|
||||||
saveButton.setEnabled(true);
|
saveButton.setEnabled(true);
|
||||||
saveButton.addActionListener(new ActionListener() {
|
saveButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
FileTools.saveObjectWithFileChooser(saveButton, genericObjectEditor.getValue());
|
FileTools.saveObjectWithFileChooser(saveButton, genericObjectEditor.getValue());
|
||||||
@ -138,7 +133,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
okayButton = new JButton("OK");
|
okayButton = new JButton("OK");
|
||||||
okayButton.setEnabled(true);
|
okayButton.setEnabled(true);
|
||||||
okayButton.addActionListener(new ActionListener() {
|
okayButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
backupObject = copyObject(genericObjectEditor.getValue());
|
backupObject = copyObject(genericObjectEditor.getValue());
|
||||||
@ -160,7 +154,6 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
cancelButton = new JButton("Cancel");
|
cancelButton = new JButton("Cancel");
|
||||||
cancelButton.setEnabled(true);
|
cancelButton.setEnabled(true);
|
||||||
cancelButton.addActionListener(new ActionListener() {
|
cancelButton.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(final ActionEvent event) {
|
public void actionPerformed(final ActionEvent event) {
|
||||||
if (backupObject != null) {
|
if (backupObject != null) {
|
||||||
@ -225,8 +218,8 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is duplicated from EvAModuleButtonPanelMaker.
|
* This method is duplicated from EvAModuleButtonPanelMaker. ToDo: Refactor
|
||||||
* ToDo: Refactor this.
|
* this.
|
||||||
*
|
*
|
||||||
* @param iconSrc
|
* @param iconSrc
|
||||||
* @param title
|
* @param title
|
||||||
@ -316,11 +309,7 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
protected void updateClassType() {
|
protected void updateClassType() {
|
||||||
List<String> classesLongNames;
|
List<String> classesLongNames;
|
||||||
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
ArrayList<Class<?>> instances = new ArrayList<Class<?>>(5);
|
||||||
if (Proxy.isProxyClass(genericObjectEditor.getClassType())) {
|
|
||||||
classesLongNames = GenericObjectEditor.getClassesFromProperties(((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) genericObjectEditor.getValue()))).getOriginalClass().getName(), null);
|
|
||||||
} else {
|
|
||||||
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
classesLongNames = GenericObjectEditor.getClassesFromProperties(genericObjectEditor.getClassType().getName(), instances);
|
||||||
}
|
|
||||||
if (classesLongNames.size() > 1) {
|
if (classesLongNames.size() > 1) {
|
||||||
classNameMap = new HashMap<String, String>();
|
classNameMap = new HashMap<String, String>();
|
||||||
for (String className : classesLongNames) {
|
for (String className : classesLongNames) {
|
||||||
@ -396,7 +385,8 @@ public class GOEPanel extends JPanel implements ItemListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the chooser selection is changed, ensures that the Object is changed appropriately.
|
* When the chooser selection is changed, ensures that the Object is changed
|
||||||
|
* appropriately.
|
||||||
*
|
*
|
||||||
* @param e a value of type 'ItemEvent'
|
* @param e a value of type 'ItemEvent'
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,6 @@ package eva2.gui;
|
|||||||
|
|
||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.tools.ReflectPackage;
|
import eva2.tools.ReflectPackage;
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@ -287,14 +286,8 @@ public class GenericObjectEditor implements PropertyEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Vector<String> v = null;
|
Vector<String> v = null;
|
||||||
if (Proxy.isProxyClass(classType)) {
|
|
||||||
//if (TRACE) System.out.println("PROXY! original was " + ((RMIProxyLocal)Proxy.getInvocationHandler(((Proxy)m_Object))).getOriginalClass().getName());
|
|
||||||
v = new Vector<String>(getClassesFromProperties(((RMIProxyLocal) Proxy.getInvocationHandler(((Proxy) m_Object))).getOriginalClass().getName(), null));
|
|
||||||
} else {
|
|
||||||
v = new Vector<String>(getClassesFromProperties(classType.getName(), null));
|
v = new Vector<String>(getClassesFromProperties(classType.getName(), null));
|
||||||
}
|
|
||||||
|
|
||||||
// v = new Vector<String>(getClassesFromProperties(m_ClassType.getName()));
|
|
||||||
try {
|
try {
|
||||||
if (v.size() > 0) {
|
if (v.size() > 0) {
|
||||||
setObject((Object) Class.forName((String) v.get(0)).newInstance());
|
setObject((Object) Class.forName((String) v.get(0)).newInstance());
|
||||||
|
@ -1,503 +0,0 @@
|
|||||||
package eva2.gui;
|
|
||||||
|
|
||||||
|
|
||||||
import eva2.tools.BasicResourceLoader;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.event.*;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.beans.PropertyChangeSupport;
|
|
||||||
import java.beans.PropertyEditor;
|
|
||||||
import java.io.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by IntelliJ IDEA.
|
|
||||||
* User: streiche
|
|
||||||
* Date: 14.12.2004
|
|
||||||
* Time: 11:33:43
|
|
||||||
* To change this template use File | Settings | File Templates.
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class GenericRemoteServersEditor extends JPanel implements PropertyEditor {
|
|
||||||
|
|
||||||
/** Handles property change notification */
|
|
||||||
private PropertyChangeSupport m_Support = new PropertyChangeSupport(this);
|
|
||||||
/** The label for when we can't edit that type */
|
|
||||||
private JLabel m_Label = new JLabel("Can't edit", SwingConstants.CENTER);
|
|
||||||
/** The FilePath that is to be edited*/
|
|
||||||
private PropertyRemoteServers m_RemoteServers;
|
|
||||||
|
|
||||||
/** The gaphix stuff */
|
|
||||||
private JComponent m_Editor;
|
|
||||||
private JPanel m_ParameterPanel;
|
|
||||||
private JTextField m_Login;
|
|
||||||
private JPasswordField m_Password;
|
|
||||||
private JPanel m_ServerList;
|
|
||||||
private JButton[] m_Status;
|
|
||||||
private JTextField[] m_Names;
|
|
||||||
private JComboBox[] m_CPUs;
|
|
||||||
private JButton[] m_Delete;
|
|
||||||
private int prefEditorHeight = 200;
|
|
||||||
|
|
||||||
public GenericRemoteServersEditor() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method will init the CustomEditor Panel
|
|
||||||
*/
|
|
||||||
private void initCustomEditor() {
|
|
||||||
this.m_Editor = new JPanel();
|
|
||||||
// This is the upper panel
|
|
||||||
this.m_ParameterPanel = new JPanel();
|
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 0, 0, 1);
|
|
||||||
this.m_ParameterPanel.setLayout(new GridBagLayout());
|
|
||||||
this.m_ParameterPanel.add(new JLabel("Login: "), gbc);
|
|
||||||
this.m_Login = new JTextField(""+this.m_RemoteServers.getLogin());
|
|
||||||
this.m_Login.addKeyListener(loginListener);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 2, 1, 0, 100);
|
|
||||||
this.m_ParameterPanel.add(this.m_Login, gbc);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 3, 0, 1);
|
|
||||||
this.m_ParameterPanel.add(new JLabel("Password: "), gbc);
|
|
||||||
this.m_Password = new JPasswordField(""+this.m_RemoteServers.getPassword());
|
|
||||||
this.m_Password.addKeyListener(passwordListener);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 2, 4, 0, 100);
|
|
||||||
this.m_ParameterPanel.add(this.m_Password, gbc);
|
|
||||||
|
|
||||||
JButton tmpB;
|
|
||||||
tmpB = makeButtonWith("images/Add24.gif", "add");
|
|
||||||
tmpB.addActionListener(addServer);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 0, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
tmpB = makeButtonWith("images/Export24.gif", "Load");
|
|
||||||
tmpB.addActionListener(loadServers);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 1, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
tmpB = makeButtonWith("images/Import24.gif", "Save");
|
|
||||||
tmpB.addActionListener(saveServers);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 2, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
tmpB = makeButtonWith("images/Refresh24.gif", "Update Status");
|
|
||||||
tmpB.addActionListener(updateServers);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 3, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
tmpB = makeButtonWith("images/Play24.gif", "Start Server");
|
|
||||||
tmpB.addActionListener(startServers);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 4, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
tmpB = makeButtonWith("images/Stop24.gif", "Stop Server");
|
|
||||||
tmpB.addActionListener(killServers);
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, 1, 5, 1, 1);
|
|
||||||
this.m_ParameterPanel.add(tmpB, gbc);
|
|
||||||
|
|
||||||
this.m_ServerList = new JPanel();
|
|
||||||
this.updateServerList();
|
|
||||||
JScrollPane scrollServer = new JScrollPane(this.m_ServerList);
|
|
||||||
scrollServer.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
|
|
||||||
scrollServer.setPreferredSize(new Dimension(200,prefEditorHeight));
|
|
||||||
|
|
||||||
this.m_Editor.setLayout(new BorderLayout());
|
|
||||||
this.m_Editor.add(this.m_ParameterPanel, BorderLayout.NORTH);
|
|
||||||
this.m_Editor.add(scrollServer, BorderLayout.CENTER);
|
|
||||||
this.updateEditor();
|
|
||||||
}
|
|
||||||
|
|
||||||
private JButton makeButtonWith(String iconSrc, String title) {
|
|
||||||
JButton tmpB;
|
|
||||||
byte[] bytes;
|
|
||||||
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation(iconSrc, false);
|
|
||||||
if (bytes!=null) {
|
|
||||||
tmpB = new JButton(title, new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmpB = new JButton(title);
|
|
||||||
}
|
|
||||||
return tmpB;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method updates the server list
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void updateServerList() {
|
|
||||||
byte[] bytes;
|
|
||||||
ServerNode t;
|
|
||||||
this.m_ServerList.removeAll();
|
|
||||||
this.m_ServerList.setLayout(new GridBagLayout());
|
|
||||||
GridBagConstraints gbc = new GridBagConstraints();
|
|
||||||
this.m_Status = new JButton[this.m_RemoteServers.size()];
|
|
||||||
this.m_Names = new JTextField[this.m_RemoteServers.size()];
|
|
||||||
this.m_CPUs = new JComboBox[this.m_RemoteServers.size()];
|
|
||||||
this.m_Delete = new JButton[this.m_RemoteServers.size()];
|
|
||||||
String[] cups = new String[8];
|
|
||||||
for (int i = 0; i < cups.length; i++) {
|
|
||||||
cups[i] = ""+(i+1);
|
|
||||||
}
|
|
||||||
// The head title
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 0, 1);
|
|
||||||
this.m_ServerList.add(new JLabel("Status"), gbc);
|
|
||||||
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 1, 80);
|
|
||||||
this.m_ServerList.add(new JLabel("Server Name"), gbc);
|
|
||||||
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 2, 10);
|
|
||||||
this.m_ServerList.add(new JLabel("CPUs"), gbc);
|
|
||||||
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.REMAINDER, 3, 10);
|
|
||||||
this.m_ServerList.add(new JLabel("Remove"), gbc);
|
|
||||||
|
|
||||||
for (int i = 0; i < this.m_RemoteServers.size(); i++) {
|
|
||||||
t = this.m_RemoteServers.get(i);
|
|
||||||
// the status indicator
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 0, 1);
|
|
||||||
this.m_Status[i] = new JButton(" ");
|
|
||||||
this.m_Status[i].setEnabled(false);
|
|
||||||
if (this.m_RemoteServers.isServerOnline(t.m_ServerName)) {
|
|
||||||
this.m_Status[i].setBackground(Color.GREEN);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.m_Status[i].setBackground(Color.RED);
|
|
||||||
}
|
|
||||||
this.m_ServerList.add(this.m_Status[i], gbc);
|
|
||||||
// the server name
|
|
||||||
gbc = new GridBagConstraints();
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 1, 80);
|
|
||||||
this.m_Names[i] = new JTextField(""+t.m_ServerName);
|
|
||||||
this.m_Names[i].addKeyListener(serverNameListener);
|
|
||||||
this.m_ServerList.add(this.m_Names[i], gbc);
|
|
||||||
// the number of CPUs
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.BOTH, 2, 10);
|
|
||||||
this.m_CPUs[i] = new JComboBox(cups);
|
|
||||||
this.m_CPUs[i].setSelectedIndex(t.m_CPUs-1);
|
|
||||||
this.m_CPUs[i].addItemListener(cpuStateListener);
|
|
||||||
this.m_ServerList.add(this.m_CPUs[i], gbc);
|
|
||||||
// The delete button
|
|
||||||
setGBC(gbc, GridBagConstraints.WEST, GridBagConstraints.REMAINDER, 3, 10);
|
|
||||||
bytes = BasicResourceLoader.instance().getBytesFromResourceLocation("images/Sub24.gif", true);
|
|
||||||
this.m_Delete[i] = new JButton("", new ImageIcon(Toolkit.getDefaultToolkit().createImage(bytes)));
|
|
||||||
this.m_Delete[i].addActionListener(deleteServer);
|
|
||||||
this.m_ServerList.add(this.m_Delete[i], gbc);
|
|
||||||
}
|
|
||||||
String[] h = this.m_RemoteServers.getCheckedServerNodes();
|
|
||||||
// System.out.println("My active nodes: ");
|
|
||||||
// for (int i = 0; i < h.length; i++) {
|
|
||||||
// System.out.println(""+h[i]);
|
|
||||||
// }
|
|
||||||
this.m_ServerList.repaint();
|
|
||||||
this.m_ServerList.validate();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setGBC(GridBagConstraints gbc, int anchor, int fill, int gridx, int weightx) {
|
|
||||||
gbc.anchor = anchor;
|
|
||||||
gbc.fill = fill;
|
|
||||||
gbc.gridx = gridx;
|
|
||||||
gbc.weightx = weightx;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setGBC(GridBagConstraints gbc, int anchor, int fill, int gridwidth, int gridx, int gridy, int weightx) {
|
|
||||||
setGBC(gbc, anchor, fill, gridx, weightx);
|
|
||||||
gbc.gridwidth = gridwidth;
|
|
||||||
gbc.gridy = gridy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener saveServers = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
String text = m_RemoteServers.writeToText();
|
|
||||||
JFileChooser saver = new JFileChooser();
|
|
||||||
int option = saver.showSaveDialog(m_Editor);
|
|
||||||
if (option == JFileChooser.APPROVE_OPTION) {
|
|
||||||
// now save the stuff to the file
|
|
||||||
File file = saver.getSelectedFile();
|
|
||||||
try {
|
|
||||||
BufferedWriter OutputFile = new BufferedWriter(new OutputStreamWriter (new FileOutputStream (file.getAbsolutePath())));
|
|
||||||
OutputFile.write(text);
|
|
||||||
OutputFile.close();
|
|
||||||
} catch (FileNotFoundException t) {
|
|
||||||
System.err.println("Could not open output file! Filename: " + file.getName());
|
|
||||||
} catch (java.io.IOException t) {
|
|
||||||
System.err.println("Could not write to output file! Filename: " + file.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener killServers = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
m_RemoteServers.killServers();
|
|
||||||
updateServerList();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener startServers = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
m_RemoteServers.startServers();
|
|
||||||
updateServerList();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener updateServers = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
updateServerList();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener addServer = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
m_RemoteServers.addServerNode("noname-"+m_RemoteServers.size(), 1);
|
|
||||||
updateServerList();
|
|
||||||
updateEditor();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener deleteServer = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
for (int i = 0; i < m_Delete.length; i++) {
|
|
||||||
if (event.getSource().equals(m_Delete[i])) {
|
|
||||||
m_RemoteServers.removeServerNode(m_RemoteServers.get(i).m_ServerName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateServerList();
|
|
||||||
updateEditor();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener,...
|
|
||||||
*/
|
|
||||||
ActionListener loadServers = new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent event) {
|
|
||||||
String text = "";
|
|
||||||
JFileChooser reader = new JFileChooser();
|
|
||||||
int option = reader.showOpenDialog(m_Editor);
|
|
||||||
if (option == JFileChooser.APPROVE_OPTION) {
|
|
||||||
// now save the stuff to the file
|
|
||||||
File file = reader.getSelectedFile();
|
|
||||||
try {
|
|
||||||
BufferedReader inputFile = new BufferedReader(new FileReader(file.getAbsolutePath()));
|
|
||||||
String line;
|
|
||||||
while ((line = inputFile.readLine()) != null) {
|
|
||||||
text += line +"\n";
|
|
||||||
}
|
|
||||||
inputFile.close();
|
|
||||||
m_RemoteServers.readFromText(text);
|
|
||||||
// text = inputFile.readLine().read();
|
|
||||||
// OutputFile.close();
|
|
||||||
} catch (FileNotFoundException t) {
|
|
||||||
System.out.println("Could not open output file! Filename: " + file.getName());
|
|
||||||
} catch (java.io.IOException t) {
|
|
||||||
System.out.println("Could not write to output file! Filename: " + file.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateServerList();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener reads all values
|
|
||||||
*/
|
|
||||||
KeyListener loginListener = new KeyListener() {
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyTyped(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyReleased(KeyEvent event) {
|
|
||||||
m_RemoteServers.setLogin(m_Login.getText());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener reads all values
|
|
||||||
*/
|
|
||||||
KeyListener passwordListener = new KeyListener() {
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyTyped(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyReleased(KeyEvent event) {
|
|
||||||
m_RemoteServers.setPassword(m_Password.getPassword());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener reads all values
|
|
||||||
*/
|
|
||||||
KeyListener serverNameListener = new KeyListener() {
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyTyped(KeyEvent event) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void keyReleased(KeyEvent event) {
|
|
||||||
for (int i = 0; i < m_Names.length; i++) {
|
|
||||||
if (event.getSource().equals(m_Names[i])) {
|
|
||||||
m_RemoteServers.setNameFor(i, m_Names[i].getText());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** This action listener adds an element to DoubleArray
|
|
||||||
*/
|
|
||||||
ItemListener cpuStateListener = new ItemListener() {
|
|
||||||
@Override
|
|
||||||
public void itemStateChanged(ItemEvent event) {
|
|
||||||
for (int i = 0; i < m_CPUs.length; i++) {
|
|
||||||
if (event.getSource().equals(m_CPUs[i])) {
|
|
||||||
m_RemoteServers.setCPUsFor(i, m_CPUs[i].getSelectedIndex()+1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The object may have changed update the editor.
|
|
||||||
*/
|
|
||||||
private void updateEditor() {
|
|
||||||
if (this.m_Editor != null) {
|
|
||||||
this.m_Editor.validate();
|
|
||||||
this.m_Editor.repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** This method will set the value of object that is to be edited.
|
|
||||||
* @param o an object that must be an array.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setValue(Object o) {
|
|
||||||
if (o instanceof PropertyRemoteServers) {
|
|
||||||
this.m_RemoteServers = (PropertyRemoteServers) o;
|
|
||||||
this.updateEditor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the current object.
|
|
||||||
* @return the current object
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Object getValue() {
|
|
||||||
return this.m_RemoteServers;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getJavaInitializationString() {
|
|
||||||
return "TEST";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String getAsText() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void setAsText(String text) throws IllegalArgumentException {
|
|
||||||
throw new IllegalArgumentException(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String[] getTags() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
|
||||||
if (m_Support == null) {
|
|
||||||
m_Support = new PropertyChangeSupport(this);
|
|
||||||
}
|
|
||||||
m_Support.addPropertyChangeListener(l);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
|
||||||
if (m_Support == null) {
|
|
||||||
m_Support = new PropertyChangeSupport(this);
|
|
||||||
}
|
|
||||||
m_Support.removePropertyChangeListener(l);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This is used to hook an action listener to the ok button
|
|
||||||
* @param a The action listener.
|
|
||||||
*/
|
|
||||||
public void addOkListener(ActionListener a) {
|
|
||||||
//m_OKButton.addActionListener(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This is used to remove an action listener from the ok button
|
|
||||||
* @param a The action listener
|
|
||||||
*/
|
|
||||||
public void removeOkListener(ActionListener a) {
|
|
||||||
//m_OKButton.removeActionListener(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true since the Object can be shown
|
|
||||||
* @return true
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isPaintable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Paints a representation of the current classifier.
|
|
||||||
*
|
|
||||||
* @param gfx the graphics context to use
|
|
||||||
* @param box the area we are allowed to paint into
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void paintValue(Graphics gfx, Rectangle box) {
|
|
||||||
FontMetrics fm = gfx.getFontMetrics();
|
|
||||||
int vpad = (box.height - fm.getAscent()) / 2;
|
|
||||||
String rep = "Remote Servers";
|
|
||||||
gfx.drawString(rep, 2, fm.getHeight() + vpad - 3 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns true because we do support a custom editor.
|
|
||||||
* @return true
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean supportsCustomEditor() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns the array editing component.
|
|
||||||
* @return a value of type 'java.awt.Component'
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Component getCustomEditor() {
|
|
||||||
if (this.m_Editor == null) {
|
|
||||||
this.initCustomEditor();
|
|
||||||
}
|
|
||||||
return m_Editor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,9 +5,6 @@ package eva2.gui;
|
|||||||
* $ $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $ $Author: mkron $
|
* $ $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $ $Author: mkron $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIProxyRemote;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -18,14 +15,13 @@ public class GraphWindow {
|
|||||||
public static boolean TRACE = false;
|
public static boolean TRACE = false;
|
||||||
static private int graphCounter = -1;
|
static private int graphCounter = -1;
|
||||||
static private PlotContainer plotContainer;
|
static private PlotContainer plotContainer;
|
||||||
private MainAdapterClient mainAdapterClient;
|
|
||||||
private PlotInterface plotter;
|
private PlotInterface plotter;
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public static GraphWindow getInstance(MainAdapterClient client, String graphWindowName,
|
public static GraphWindow getInstance(String graphWindowName,
|
||||||
String strx, String stry) {
|
String strx, String stry) {
|
||||||
if (plotContainer == null) {
|
if (plotContainer == null) {
|
||||||
plotContainer = new PlotContainer();
|
plotContainer = new PlotContainer();
|
||||||
@ -39,7 +35,7 @@ public class GraphWindow {
|
|||||||
if (ret != null) {
|
if (ret != null) {
|
||||||
plotContainer.remove(ret); // remove if not valid any more
|
plotContainer.remove(ret); // remove if not valid any more
|
||||||
}
|
}
|
||||||
ret = new GraphWindow(client, graphWindowName, strx, stry);
|
ret = new GraphWindow(graphWindowName, strx, stry);
|
||||||
plotContainer.add(ret);
|
plotContainer.add(ret);
|
||||||
}
|
}
|
||||||
} catch (Exception ee) {
|
} catch (Exception ee) {
|
||||||
@ -60,28 +56,12 @@ public class GraphWindow {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private GraphWindow(MainAdapterClient client, String plotName, String strx, String stry) {
|
private GraphWindow(String plotName, String strx, String stry) {
|
||||||
if (TRACE) {
|
if (TRACE) {
|
||||||
System.out.println("Constructor GraphWindow");
|
System.out.println("Constructor GraphWindow");
|
||||||
}
|
}
|
||||||
mainAdapterClient = client;
|
|
||||||
name = plotName;
|
name = plotName;
|
||||||
try {
|
|
||||||
if ((client == null) || client.getHostName().equals(InetAddress.getLocalHost().getHostName())) {
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println("no RMI");
|
|
||||||
}
|
|
||||||
plotter = new Plot(plotName, strx, stry, true);
|
plotter = new Plot(plotName, strx, stry, true);
|
||||||
} else {
|
|
||||||
plotter = (PlotInterface) RMIProxyRemote.newInstance(new Plot(plotName, strx, stry, false), mainAdapterClient);
|
|
||||||
plotter.init();
|
|
||||||
if (TRACE) {
|
|
||||||
System.out.println("with RMI");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.err.println("InetAddress.getLocalHost().getHostAddress() --> ERROR" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,7 +226,6 @@ public class PropertyEditorProvider {
|
|||||||
PropertyEditorManager.registerEditor(PropertyWeightedLPTchebycheff.class, GenericWeigthedLPTchebycheffEditor.class);
|
PropertyEditorManager.registerEditor(PropertyWeightedLPTchebycheff.class, GenericWeigthedLPTchebycheffEditor.class);
|
||||||
// PropertyEditorManager.registerEditor(PropertyStringList.class , GenericStringListSelectionEditor.class);
|
// PropertyEditorManager.registerEditor(PropertyStringList.class , GenericStringListSelectionEditor.class);
|
||||||
PropertyEditorManager.registerEditor(PropertyFilePath.class , GenericFilePathEditor.class);
|
PropertyEditorManager.registerEditor(PropertyFilePath.class , GenericFilePathEditor.class);
|
||||||
PropertyEditorManager.registerEditor(PropertyRemoteServers.class , GenericRemoteServersEditor.class);
|
|
||||||
PropertyEditorManager.registerEditor(PropertyOptimizationObjectives.class , GenericOptimizationObjectivesEditor.class);
|
PropertyEditorManager.registerEditor(PropertyOptimizationObjectives.class , GenericOptimizationObjectivesEditor.class);
|
||||||
PropertyEditorManager.registerEditor(PropertyOptimizationObjectivesWithParam.class , GenericOptimizationObjectivesWithParamEditor.class);
|
PropertyEditorManager.registerEditor(PropertyOptimizationObjectivesWithParam.class , GenericOptimizationObjectivesWithParamEditor.class);
|
||||||
PropertyEditorManager.registerEditor(eva2.gui.MultiLineString.class, eva2.gui.MultiLineStringEditor.class);
|
PropertyEditorManager.registerEditor(eva2.gui.MultiLineString.class, eva2.gui.MultiLineStringEditor.class);
|
||||||
|
@ -1,312 +0,0 @@
|
|||||||
package eva2.gui;
|
|
||||||
|
|
||||||
import eva2.tools.jproxy.RMIInvocationHandler;
|
|
||||||
import java.rmi.Naming;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by IntelliJ IDEA.
|
|
||||||
* User: streiche
|
|
||||||
* Date: 14.12.2004
|
|
||||||
* Time: 11:33:10
|
|
||||||
* To change this template use File | Settings | File Templates.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ServerNode implements java.io.Serializable {
|
|
||||||
public String m_ServerName;
|
|
||||||
public int m_CPUs;
|
|
||||||
|
|
||||||
public ServerNode(String name, int cpus) {
|
|
||||||
m_ServerName = name;
|
|
||||||
m_CPUs = cpus;
|
|
||||||
}
|
|
||||||
public ServerNode(ServerNode a) {
|
|
||||||
this.m_CPUs = a.m_CPUs;
|
|
||||||
this.m_ServerName = a.m_ServerName;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Object clone() {
|
|
||||||
return (Object) new ServerNode(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class PropertyRemoteServers implements java.io.Serializable {
|
|
||||||
|
|
||||||
private ServerNode[] m_AvailableNodes=null;
|
|
||||||
// private String m_ClassToStart = "eva2.tools.jproxy.RMIServer";
|
|
||||||
private transient String m_password = "";
|
|
||||||
private String m_Login = "";
|
|
||||||
// private boolean m_DeployJar = true;
|
|
||||||
// private String m_JarToDeploy = "JOpt.jar";
|
|
||||||
|
|
||||||
public PropertyRemoteServers() {
|
|
||||||
this.m_AvailableNodes = new ServerNode[0];
|
|
||||||
this.addServerNode("exampleNode.uni-tuebingen.de", 2);
|
|
||||||
this.setLogin("username");
|
|
||||||
this.setPassword("");
|
|
||||||
}
|
|
||||||
|
|
||||||
public PropertyRemoteServers(PropertyRemoteServers e) {
|
|
||||||
this();
|
|
||||||
if (e.m_AvailableNodes != null) {
|
|
||||||
this.m_AvailableNodes = new ServerNode[e.m_AvailableNodes.length];
|
|
||||||
for (int i = 0; i < e.m_AvailableNodes.length; i++) {
|
|
||||||
this.m_AvailableNodes[i] = (ServerNode)e.m_AvailableNodes[i].clone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object clone() {
|
|
||||||
return (Object) new PropertyRemoteServers(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method adds a server to the server nodes list
|
|
||||||
* It will check whether or not the given name is already
|
|
||||||
* in the current list of nodes is so it breaks.
|
|
||||||
* @param name The name of the server
|
|
||||||
* @param cpus The number of cpus on the server
|
|
||||||
*/
|
|
||||||
|
|
||||||
public void addServerNode(String name, int cpus) {
|
|
||||||
// first check for double instances
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
if (this.m_AvailableNodes[i].m_ServerName.equalsIgnoreCase(name)) {
|
|
||||||
if (cpus > this.m_AvailableNodes[i].m_CPUs) {
|
|
||||||
this.m_AvailableNodes[i].m_CPUs = cpus;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now add the guy
|
|
||||||
ServerNode[] newList = new ServerNode[this.m_AvailableNodes.length+1];
|
|
||||||
ServerNode newNode = new ServerNode(name, cpus);
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
newList[i] = this.m_AvailableNodes[i];
|
|
||||||
}
|
|
||||||
newList[this.m_AvailableNodes.length] = newNode;
|
|
||||||
this.m_AvailableNodes = newList;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method removes a surplus node from the current list
|
|
||||||
* @param name The name of the server to remove
|
|
||||||
*/
|
|
||||||
public void removeServerNode(String name) {
|
|
||||||
ArrayList newList = new ArrayList();
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
if (!this.m_AvailableNodes[i].m_ServerName.equalsIgnoreCase(name)) {
|
|
||||||
newList.add(this.m_AvailableNodes[i]);
|
|
||||||
} else {
|
|
||||||
this.killServer(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.m_AvailableNodes = new ServerNode[newList.size()];
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
this.m_AvailableNodes[i] = (ServerNode)newList.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method removes and deactivates all servers
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void removeAll() {
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
this.killServer(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
}
|
|
||||||
this.m_AvailableNodes = new ServerNode[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method returns an unchecked list of server instances
|
|
||||||
* an server with n nodes will occur n times in the returned
|
|
||||||
* server list
|
|
||||||
* @return A list of server instances, with double instances.
|
|
||||||
*/
|
|
||||||
public String[] getServerNodes() {
|
|
||||||
String[] result;
|
|
||||||
ArrayList<String> tmpList = new ArrayList<String>();
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
for (int j = 0; j < this.m_AvailableNodes[i].m_CPUs; j++) {
|
|
||||||
tmpList.add(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = new String[tmpList.size()];
|
|
||||||
for (int i = 0; i < result.length; i++) {
|
|
||||||
result[i] = (String) tmpList.get(i);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method returns an checked list of server instances
|
|
||||||
* an server with n nodes will occur n times in the returned
|
|
||||||
* server list
|
|
||||||
* @return A list of server instances, with double instances.
|
|
||||||
*/
|
|
||||||
public String[] getCheckedServerNodes() {
|
|
||||||
String[] result;
|
|
||||||
ArrayList tmpList = new ArrayList();
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
if (this.isServerOnline(this.m_AvailableNodes[i].m_ServerName)) {
|
|
||||||
for (int j = 0; j < this.m_AvailableNodes[i].m_CPUs; j++) {
|
|
||||||
tmpList.add(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = new String[tmpList.size()];
|
|
||||||
for (int i = 0; i < result.length; i++) {
|
|
||||||
result[i] = (String) tmpList.get(i);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method will check whether or not a given server is online
|
|
||||||
* @param name The name of the server to check
|
|
||||||
* @return true if server is online, false else
|
|
||||||
*/
|
|
||||||
public boolean isServerOnline(String name) {
|
|
||||||
try {
|
|
||||||
String[] list = Naming.list("rmi://" + name + ":" + 1099);
|
|
||||||
if (list == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} catch (Exception et) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method will try to start all server in the current list
|
|
||||||
*/
|
|
||||||
public void startServers() {
|
|
||||||
/* ServerStarter serverstarter;
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
if (!this.isServerOnline(this.m_AvailableNodes[i].m_ServerName)) {
|
|
||||||
serverstarter = new ServerStarter();
|
|
||||||
serverstarter.setPasswd(this.m_password);
|
|
||||||
serverstarter.setClass2Run(this.m_ClassToStart);
|
|
||||||
serverstarter.setDeployJarFile(this.m_DeployJar);
|
|
||||||
serverstarter.setJarfilename(this.m_JarToDeploy);
|
|
||||||
serverstarter.setHostname(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
serverstarter.setLogin(this.m_Login);
|
|
||||||
try {
|
|
||||||
serverstarter.startServer();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Problems starting the server: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method kills the servers
|
|
||||||
* previously started
|
|
||||||
*/
|
|
||||||
public void killServers() {
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
this.killServer(this.m_AvailableNodes[i].m_ServerName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method kills a single server
|
|
||||||
* @param name The name of the server to kill
|
|
||||||
*/
|
|
||||||
public void killServer(String name) {
|
|
||||||
if (this.isServerOnline(name)) {
|
|
||||||
try {
|
|
||||||
String[] list = Naming.list("rmi://" + name + ":" + 1099);
|
|
||||||
for (int j = 0; j < list.length; j++) {
|
|
||||||
System.out.println(""+list[j]);
|
|
||||||
if (list[j].indexOf(this.m_Login) > 0) {
|
|
||||||
RMIInvocationHandler x = (RMIInvocationHandler) Naming.lookup("rmi:"+list[j]);
|
|
||||||
//x.invoke("killThread", null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Error : "+e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** This method returns the number of servers
|
|
||||||
* @return the size
|
|
||||||
*/
|
|
||||||
public int size() {
|
|
||||||
return this.m_AvailableNodes.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ServerNode get(int i) {
|
|
||||||
if ((i >= 0) && (i < this.m_AvailableNodes.length)) {
|
|
||||||
return this.m_AvailableNodes[i];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String writeToText() {
|
|
||||||
String result = "";
|
|
||||||
for (int i = 0; i < this.m_AvailableNodes.length; i++) {
|
|
||||||
result += this.m_AvailableNodes[i].m_ServerName +"\t"+this.m_AvailableNodes[i].m_CPUs+"\n";
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNameFor(int i, String name) {
|
|
||||||
if ((i >= 0) && (i < this.m_AvailableNodes.length)) {
|
|
||||||
this.m_AvailableNodes[i].m_ServerName = name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCPUsFor(int i, int c) {
|
|
||||||
if ((i >= 0) && (i < this.m_AvailableNodes.length)) {
|
|
||||||
this.m_AvailableNodes[i].m_CPUs = c;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void readFromText(String text) {
|
|
||||||
String[] lines = text.split("\n");
|
|
||||||
this.removeAll();
|
|
||||||
for (int i = 0; i < lines.length; i++) {
|
|
||||||
String[] rickel = lines[i].split("\t");
|
|
||||||
this.addServerNode(rickel[0].trim(), new Integer(rickel[1].trim()).intValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
PropertyRemoteServers test = new PropertyRemoteServers();
|
|
||||||
test.m_password = "";
|
|
||||||
test.addServerNode("raold1.informatik.uni-tuebingen.de", 2);
|
|
||||||
//test.addServerNode("raold2.informatik.uni-tuebingen.de", 2);
|
|
||||||
System.out.println(" Getting running Servers:");
|
|
||||||
String[] servers = test.getCheckedServerNodes();
|
|
||||||
for (int i = 0; i < servers.length; i++) {
|
|
||||||
System.out.println("Server "+i+": "+servers[i]);
|
|
||||||
}
|
|
||||||
System.out.println("\n Starting Servers: ");
|
|
||||||
test.startServers();
|
|
||||||
System.out.println(" Getting running Servers:");
|
|
||||||
servers = test.getCheckedServerNodes();
|
|
||||||
for (int i = 0; i < servers.length; i++) {
|
|
||||||
System.out.println("Server "+i+": "+servers[i]);
|
|
||||||
}
|
|
||||||
test.killServers();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLogin() {
|
|
||||||
return this.m_Login;
|
|
||||||
}
|
|
||||||
public void setLogin(String l) {
|
|
||||||
this.m_Login = l;
|
|
||||||
}
|
|
||||||
public String getPassword() {
|
|
||||||
return this.m_password;
|
|
||||||
}
|
|
||||||
public void setPassword(String l) {
|
|
||||||
this.m_password = l;
|
|
||||||
}
|
|
||||||
public void setPassword(char[] l) {
|
|
||||||
this.m_password = new String(l);
|
|
||||||
}
|
|
||||||
}
|
|
16
src/eva2/optimization/OptimizationStateListener.java
Normal file
16
src/eva2/optimization/OptimizationStateListener.java
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* To change this template, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package eva2.optimization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author becker
|
||||||
|
*/
|
||||||
|
public interface OptimizationStateListener {
|
||||||
|
void performedStop();
|
||||||
|
void performedStart(String infoString);
|
||||||
|
void performedRestart(String infoString);
|
||||||
|
void updateProgress(final int percent, String msg);
|
||||||
|
}
|
@ -10,25 +10,15 @@ package eva2.server;
|
|||||||
*/
|
*/
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.modules.ModuleAdapter;
|
import eva2.server.modules.ModuleAdapter;
|
||||||
import eva2.tools.jproxy.MainAdapter;
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface EvAMainAdapter extends MainAdapter {
|
public interface EvAMainAdapter {
|
||||||
|
|
||||||
public String[] getModuleNameList();
|
public String[] getModuleNameList();
|
||||||
// returns the corresponding ModuleAdapter
|
// returns the corresponding ModuleAdapter
|
||||||
|
|
||||||
public ModuleAdapter getModuleAdapter(String selectedModuleName,
|
ModuleAdapter getModuleAdapter(String selectedModuleName);
|
||||||
boolean withoutRMI,
|
|
||||||
String hostAddress,
|
|
||||||
MainAdapterClient client);
|
|
||||||
|
|
||||||
public ModuleAdapter getModuleAdapter(String selectedModuleName,
|
ModuleAdapter getModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiStatsFile);
|
||||||
boolean withoutRMI,
|
|
||||||
String hostAddress,
|
|
||||||
InterfaceGOParameters goParams,
|
|
||||||
String noGuiStatsFile,
|
|
||||||
MainAdapterClient client);
|
|
||||||
}
|
}
|
||||||
|
@ -12,12 +12,10 @@ package eva2.server;
|
|||||||
import eva2.EvAInfo;
|
import eva2.EvAInfo;
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.modules.ModuleAdapter;
|
import eva2.server.modules.ModuleAdapter;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.MainAdapterImpl;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EvAMainAdapterImpl extends MainAdapterImpl implements EvAMainAdapter {
|
public class EvAMainAdapterImpl implements EvAMainAdapter {
|
||||||
|
|
||||||
private ModuleServer moduleServer = null;
|
private ModuleServer moduleServer = null;
|
||||||
|
|
||||||
@ -32,13 +30,13 @@ public class EvAMainAdapterImpl extends MainAdapterImpl implements EvAMainAdapte
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, MainAdapterClient client) {
|
public ModuleAdapter getModuleAdapter(String selectedModule) {
|
||||||
return getModuleAdapter(selectedModule, withoutRMI, hostAddress, null, null, client);
|
return getModuleAdapter(selectedModule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ModuleAdapter getModuleAdapter(String selectedModule, boolean withoutRMI, String hostAddress, InterfaceGOParameters goParams, String noGuiStatsFile, MainAdapterClient client) {
|
public ModuleAdapter getModuleAdapter(String selectedModule, InterfaceGOParameters goParams, String noGuiStatsFile) {
|
||||||
return moduleServer.createModuleAdapter(selectedModule, client, withoutRMI, hostAddress, goParams, noGuiStatsFile);
|
return moduleServer.createModuleAdapter(selectedModule, goParams, noGuiStatsFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,144 +0,0 @@
|
|||||||
package eva2.server;
|
|
||||||
/*
|
|
||||||
* Title: EvA2 Description: Copyright: Copyright (c) 2003 Company: University of
|
|
||||||
* Tuebingen, Computer Architecture @author Holger Ulmer, Felix Streichert,
|
|
||||||
* Hannes Planatscher @version: $Revision: 320 $ $Date: 2007-12-06 16:05:11
|
|
||||||
* +0100 (Thu, 06 Dec 2007) $ $Author: mkron $
|
|
||||||
*/
|
|
||||||
|
|
||||||
import eva2.EvAInfo;
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class EvAServer {
|
|
||||||
/*
|
|
||||||
* MainAdapterImp object. This is need for the first connection between the
|
|
||||||
* server and the client program.
|
|
||||||
*/
|
|
||||||
private EvAMainAdapter mainRemoteObject;
|
|
||||||
//private EvAComAdapter m_ComAdapter;
|
|
||||||
private static String userName;
|
|
||||||
private RMIServerEvA rmiServer;
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(EvAServer.class.getName());
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor of EvAServer. Calls RMIConnection().
|
|
||||||
*/
|
|
||||||
public EvAServer(boolean insideClient, boolean restart) {
|
|
||||||
LOGGER.log(Level.INFO, "Number of CPUs :{0}", Runtime.getRuntime().availableProcessors());
|
|
||||||
LOGGER.log(Level.INFO, "This is EvA Server Version: {0}", EvAInfo.getVersion());
|
|
||||||
LOGGER.log(Level.INFO, "Java Version: {0}", System.getProperty("java.version"));
|
|
||||||
try {
|
|
||||||
userName = System.getProperty("user.name");
|
|
||||||
} catch (SecurityException ex) {
|
|
||||||
/*
|
|
||||||
* This exception is expected to happen in Java WebStart
|
|
||||||
*/
|
|
||||||
LOGGER.log(Level.WARNING, "Could not fetch username property. Setting username to 'WebStart'", ex);
|
|
||||||
userName = "WebStart";
|
|
||||||
}
|
|
||||||
|
|
||||||
rmiServer = RMIServerEvA.getInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Main method of this class. Is the starting point of the server
|
|
||||||
* application.
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
boolean restart = false;
|
|
||||||
boolean noMulti = false;
|
|
||||||
for (int i = 0; i < args.length; i++) {
|
|
||||||
System.out.println("args = " + args[i]);
|
|
||||||
if (args[i].equals("restart")) {
|
|
||||||
restart = true;
|
|
||||||
}
|
|
||||||
if (args[i].equals("nomulti")) {
|
|
||||||
noMulti = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//Runtime.getRuntime().addShutdownHook(new ExitThread());
|
|
||||||
if (restart == true) {
|
|
||||||
String hostName = "Host";
|
|
||||||
try {
|
|
||||||
hostName = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (UnknownHostException e) {
|
|
||||||
System.out.println("ERROR getting HostName (EvAServer.main) " + e.getMessage());
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
System.out.println("Error in sleep of ExitThread");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
System.setOut(new PrintStream(
|
|
||||||
new FileOutputStream(hostName + "_server.txt")));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
System.out.println("System.setOut" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EvAServer evaServer = new EvAServer(false, restart); // false => started not inside the client, solo server
|
|
||||||
// if (nomulti==false)
|
|
||||||
// evaServer.multiServers(1);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public void multiServers(int size) {
|
|
||||||
for (int i = 0; i < size; i++) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(4000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
System.out.println("Error in sleep of ExitThread");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
String cmd = "java -cp \".\" eva2.server.EvAServer nomulti";
|
|
||||||
System.out.println("Calling the command:" + cmd);
|
|
||||||
Process pro = Runtime.getRuntime().exec(cmd);
|
|
||||||
//Process pro = Runtime.getRuntime().exec("server");
|
|
||||||
BufferedReader in = new BufferedReader(new InputStreamReader(pro.getInputStream()));
|
|
||||||
//pro
|
|
||||||
String line = null;
|
|
||||||
while (true) {
|
|
||||||
while ((line = in.readLine()) != null) {
|
|
||||||
System.out.println(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//System.out.println("");
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("Error in calling the command:" + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public RMIServerEvA getRMIServer() {
|
|
||||||
return rmiServer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private int getNumberOfVM(String[] list) {
|
|
||||||
int ret = 0;
|
|
||||||
for (int i = 0; i < list.length; i++) {
|
|
||||||
if (list[i].indexOf(EvAMainAdapterImpl.MAIN_ADAPTER_NAME) != -1) {
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,8 +15,6 @@ import eva2.server.modules.GOModuleAdapter;
|
|||||||
import eva2.server.modules.ModuleAdapter;
|
import eva2.server.modules.ModuleAdapter;
|
||||||
import eva2.tools.EVAERROR;
|
import eva2.tools.EVAERROR;
|
||||||
import eva2.tools.ReflectPackage;
|
import eva2.tools.ReflectPackage;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -29,6 +27,7 @@ import java.util.logging.Logger;
|
|||||||
* Collect available ModuleAdapter implementations and load them on request.
|
* Collect available ModuleAdapter implementations and load them on request.
|
||||||
*/
|
*/
|
||||||
public class ModuleServer {
|
public class ModuleServer {
|
||||||
|
|
||||||
private static final Logger LOGGER = Logger.getLogger(ModuleServer.class.getName());
|
private static final Logger LOGGER = Logger.getLogger(ModuleServer.class.getName());
|
||||||
private static int instanceCounter = 0;
|
private static int instanceCounter = 0;
|
||||||
private List<Class<?>> moduleClassList;
|
private List<Class<?>> moduleClassList;
|
||||||
@ -67,9 +66,8 @@ public class ModuleServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterates over the list of available modules and fetches
|
* Iterates over the list of available modules and fetches the name of the
|
||||||
* the name of the module by calling the static getName()
|
* module by calling the static getName() method.
|
||||||
* method.
|
|
||||||
*
|
*
|
||||||
* @return Array of available modules
|
* @return Array of available modules
|
||||||
*/
|
*/
|
||||||
@ -120,9 +118,7 @@ public class ModuleServer {
|
|||||||
*
|
*
|
||||||
* @return the loaded module adapter instance
|
* @return the loaded module adapter instance
|
||||||
*/
|
*/
|
||||||
public ModuleAdapter createModuleAdapter(String selectedModuleName,
|
public ModuleAdapter createModuleAdapter(String selectedModuleName, InterfaceGOParameters goParams, String noGuiLogFile) {
|
||||||
MainAdapterClient Client, boolean runWithoutRMI,
|
|
||||||
String hostAddress, InterfaceGOParameters goParams, String noGuiLogFile) {
|
|
||||||
moduleAdapterCounter++;
|
moduleAdapterCounter++;
|
||||||
String adapterName = "ERROR MODULADAPTER !!";
|
String adapterName = "ERROR MODULADAPTER !!";
|
||||||
String moduleName = null;
|
String moduleName = null;
|
||||||
@ -136,8 +132,7 @@ public class ModuleServer {
|
|||||||
moduleName = (String) method.invoke((Object[]) null, (Object[]) null);
|
moduleName = (String) method.invoke((Object[]) null, (Object[]) null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
|
LOGGER.log(Level.WARNING, ex.getMessage(), ex);
|
||||||
}
|
}
|
||||||
if ((moduleName != null) && (selectedModuleName.equals(moduleName))) {
|
if ((moduleName != null) && (selectedModuleName.equals(moduleName))) {
|
||||||
@ -155,37 +150,25 @@ public class ModuleServer {
|
|||||||
if (noGuiLogFile != null) {
|
if (noGuiLogFile != null) {
|
||||||
System.err.println("Cant deactivate GUI - no matching constructor found for " + adapterName + " (ModuleServer)");
|
System.err.println("Cant deactivate GUI - no matching constructor found for " + adapterName + " (ModuleServer)");
|
||||||
}
|
}
|
||||||
Object[] Para = new Object[2];
|
Object[] Para = new Object[1];
|
||||||
while ((constructorArr[constrIndex].getParameterTypes().length!=2) && (constrIndex < constructorArr.length)) {
|
while ((constructorArr[constrIndex].getParameterTypes().length != 1) && (constrIndex < constructorArr.length)) {
|
||||||
constrIndex++;
|
constrIndex++;
|
||||||
}
|
}
|
||||||
Class<?> paramTypes[] = (constructorArr[constrIndex]).getParameterTypes();
|
Class<?> paramTypes[] = (constructorArr[constrIndex]).getParameterTypes();
|
||||||
Para[0] = paramTypes[0].cast(adapterName);
|
Para[0] = paramTypes[0].cast(adapterName);
|
||||||
Para[1] = paramTypes[1].cast(Client);
|
|
||||||
moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(Para);
|
moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(Para);
|
||||||
} else {
|
} else {
|
||||||
Object[] param = new Object[4];
|
Object[] param = new Object[4];
|
||||||
param[0] = (String) adapterName;
|
param[0] = (String) adapterName;
|
||||||
param[1] = (InterfaceGOParameters) goParams;
|
param[1] = (InterfaceGOParameters) goParams;
|
||||||
param[2] = (String) noGuiLogFile;
|
param[2] = (String) noGuiLogFile;
|
||||||
param[3] = (MainAdapterClient) Client;
|
|
||||||
while ((constructorArr[constrIndex].getParameterTypes().length != 4) && (constrIndex < constructorArr.length)) {
|
while ((constructorArr[constrIndex].getParameterTypes().length != 4) && (constrIndex < constructorArr.length)) {
|
||||||
constrIndex++;
|
constrIndex++;
|
||||||
}
|
}
|
||||||
moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(param);
|
moduleAdapter = (ModuleAdapter) constructorArr[constrIndex].newInstance(param);
|
||||||
}
|
}
|
||||||
if (!runWithoutRMI) {
|
|
||||||
/* if we're using RMI, send the object to a remote server
|
|
||||||
* for this to work the class of moduleAdapter itself must
|
|
||||||
* implement the ModuleAdapter interface for a strange reason,
|
|
||||||
* it is _not_ enough if a superclass implements the same interface!
|
|
||||||
*/
|
|
||||||
moduleAdapter = (ModuleAdapter) RMIProxyLocal.newInstance(moduleAdapter, adapterName);
|
|
||||||
(moduleAdapter).setRemoteThis(moduleAdapter);
|
|
||||||
}
|
|
||||||
// m_RunnungModules.add(m_ModuleAdapter);
|
// m_RunnungModules.add(m_ModuleAdapter);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.SEVERE, "Error in RMI-Moduladapter initialization", ex);
|
LOGGER.log(Level.SEVERE, "Error in RMI-Moduladapter initialization", ex);
|
||||||
EVAERROR.EXIT("Error in RMI-Moduladapter initialization: " + ex.getMessage());
|
EVAERROR.EXIT("Error in RMI-Moduladapter initialization: " + ex.getMessage());
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
package eva2.server;
|
|
||||||
/**
|
|
||||||
* Title: The JProxy Framework
|
|
||||||
* Description: API for distributed and parallel computing.
|
|
||||||
* Copyright: Copyright (c) 2004
|
|
||||||
* Company: University of Tuebingen
|
|
||||||
* @version: $Revision: 250 $
|
|
||||||
* $Date: 2007-11-13 10:32:19 +0100 (Tue, 13 Nov 2007) $
|
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import eva2.tools.jproxy.RMIServer;
|
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class RMIServerEvA extends RMIServer {
|
|
||||||
|
|
||||||
public static RMIServerEvA getInstance() {
|
|
||||||
if (instance==null) {
|
|
||||||
instance = new RMIServerEvA();
|
|
||||||
}
|
|
||||||
return (RMIServerEvA)instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void createMainRemoteObject(String mainAdapterName) {
|
|
||||||
try {
|
|
||||||
mainRemoteObject = new EvAMainAdapterImpl();
|
|
||||||
mainRemoteObject =
|
|
||||||
(EvAMainAdapter) RMIProxyLocal.newInstance(
|
|
||||||
mainRemoteObject,
|
|
||||||
mainAdapterName + "_" + numberOfVM);
|
|
||||||
mainRemoteObject.setRemoteThis(mainRemoteObject);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not create main remote object!", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -18,7 +18,6 @@ import eva2.server.go.strategies.EvolutionStrategies;
|
|||||||
import eva2.server.go.strategies.GeneticAlgorithm;
|
import eva2.server.go.strategies.GeneticAlgorithm;
|
||||||
import eva2.server.go.strategies.InterfaceOptimizer;
|
import eva2.server.go.strategies.InterfaceOptimizer;
|
||||||
import eva2.server.modules.GOParameters;
|
import eva2.server.modules.GOParameters;
|
||||||
import eva2.tools.jproxy.ThreadProxy;
|
|
||||||
import eva2.tools.math.RNG;
|
import eva2.tools.math.RNG;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.List;
|
import java.awt.List;
|
||||||
@ -34,14 +33,12 @@ import java.util.Date;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by IntelliJ IDEA.
|
* Created by IntelliJ IDEA. User: streiche Copyright: Copyright (c) 2003
|
||||||
* User: streiche
|
|
||||||
* Copyright: Copyright (c) 2003
|
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
* Company: University of Tuebingen, Computer Architecture
|
||||||
|
*
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
||||||
* @version: $Revision: 306 $
|
* @version: $Revision: 306 $ $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec
|
||||||
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
|
* 2007) $ $Author: mkron $
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
*/
|
||||||
public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopulationChangedEventListener, java.io.Serializable {
|
public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopulationChangedEventListener, java.io.Serializable {
|
||||||
|
|
||||||
@ -57,7 +54,6 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
transient private SwingWorker worker;
|
transient private SwingWorker worker;
|
||||||
transient private boolean show = false;
|
transient private boolean show = false;
|
||||||
// transient private InterfaceTest test = new Test1();
|
// transient private InterfaceTest test = new Test1();
|
||||||
|
|
||||||
// Opt. Algorithms and Parameters
|
// Opt. Algorithms and Parameters
|
||||||
//transient private InterfaceOptimizer m_Optimizer = new EvolutionaryMultiObjectiveOptimization();
|
//transient private InterfaceOptimizer m_Optimizer = new EvolutionaryMultiObjectiveOptimization();
|
||||||
//transient private InterfaceOptimizationProblem m_Problem = new TF1Problem();
|
//transient private InterfaceOptimizationProblem m_Problem = new TF1Problem();
|
||||||
@ -72,22 +68,19 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
transient private String m_OutputPath = "";
|
transient private String m_OutputPath = "";
|
||||||
transient private String m_OutputFileName = "none";
|
transient private String m_OutputFileName = "none";
|
||||||
// transient private GOStandaloneVersion m_yself;
|
// transient private GOStandaloneVersion m_yself;
|
||||||
|
|
||||||
// these parameters are for the continue option
|
// these parameters are for the continue option
|
||||||
transient private Population m_Backup;
|
transient private Population m_Backup;
|
||||||
transient private boolean m_ContinueFlag;
|
transient private boolean m_ContinueFlag;
|
||||||
|
|
||||||
// Plot Panel stuff
|
// Plot Panel stuff
|
||||||
transient private eva2.gui.Plot m_Plot;
|
transient private eva2.gui.Plot m_Plot;
|
||||||
transient private ArrayList m_PerformedRuns = new ArrayList();
|
transient private ArrayList m_PerformedRuns = new ArrayList();
|
||||||
transient private ArrayList m_TmpData;
|
transient private ArrayList m_TmpData;
|
||||||
transient private BufferedWriter m_OutputFile;
|
transient private BufferedWriter m_OutputFile;
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
transient private List m_List;
|
transient private List m_List;
|
||||||
|
|
||||||
|
/**
|
||||||
/** Create a new EALectureGUI.
|
* Create a new EALectureGUI.
|
||||||
*/
|
*/
|
||||||
public GOStandaloneVersion() {
|
public GOStandaloneVersion() {
|
||||||
// this.m_List = new List();
|
// this.m_List = new List();
|
||||||
@ -101,14 +94,16 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
RNG.setRandomSeed(m_GO.getSeed());
|
RNG.setRandomSeed(m_GO.getSeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to get the current GO parameters
|
/**
|
||||||
|
* This method allows you to get the current GO parameters
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public GOParameters getGOParameters() {
|
public GOParameters getGOParameters() {
|
||||||
return this.m_GO;
|
return this.m_GO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method will generate a Plot Frame and a main Editing Frame
|
/**
|
||||||
|
* This method will generate a Plot Frame and a main Editing Frame
|
||||||
*/
|
*/
|
||||||
public void initFrame() {
|
public void initFrame() {
|
||||||
this.m_ProgressBar = new JProgressBar();
|
this.m_ProgressBar = new JProgressBar();
|
||||||
@ -196,8 +191,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
this.m_Frame.validate();
|
this.m_Frame.validate();
|
||||||
this.m_Frame.setVisible(true);
|
this.m_Frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/** This action listener, called by the "Run/Restart" button, will init the problem and start the computation.
|
* This action listener, called by the "Run/Restart" button, will init the
|
||||||
|
* problem and start the computation.
|
||||||
*/
|
*/
|
||||||
ActionListener runListener = new ActionListener() {
|
ActionListener runListener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -207,6 +203,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
public Object construct() {
|
public Object construct() {
|
||||||
return doWork();
|
return doWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finished() {
|
public void finished() {
|
||||||
m_RunButton.setEnabled(true);
|
m_RunButton.setEnabled(true);
|
||||||
@ -221,10 +218,10 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
m_StopButton.setEnabled(true);
|
m_StopButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
/** This action listener, called by the "Cancel" button, interrupts
|
* This action listener, called by the "Cancel" button, interrupts the
|
||||||
* the worker thread which is running this.doWork(). Note that
|
* worker thread which is running this.doWork(). Note that the doWork()
|
||||||
* the doWork() method handles InterruptedExceptions cleanly.
|
* method handles InterruptedExceptions cleanly.
|
||||||
*/
|
*/
|
||||||
ActionListener stopListener = new ActionListener() {
|
ActionListener stopListener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -238,10 +235,10 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
/** This action listener, called by the "Cancel" button, interrupts
|
* This action listener, called by the "Cancel" button, interrupts the
|
||||||
* the worker thread which is running this.doWork(). Note that
|
* worker thread which is running this.doWork(). Note that the doWork()
|
||||||
* the doWork() method handles InterruptedExceptions cleanly.
|
* method handles InterruptedExceptions cleanly.
|
||||||
*/
|
*/
|
||||||
ActionListener continueListener = new ActionListener() {
|
ActionListener continueListener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -252,6 +249,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
public Object construct() {
|
public Object construct() {
|
||||||
return doWork();
|
return doWork();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void finished() {
|
public void finished() {
|
||||||
m_RunButton.setEnabled(true);
|
m_RunButton.setEnabled(true);
|
||||||
@ -271,9 +269,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
m_StopButton.setEnabled(true);
|
m_StopButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
/** This action listener, called by the "show" button will show the
|
* This action listener, called by the "show" button will show the currently
|
||||||
* currently best solution in a frame.
|
* best solution in a frame.
|
||||||
*/
|
*/
|
||||||
ActionListener showSolListener = new ActionListener() {
|
ActionListener showSolListener = new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -289,7 +287,8 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** This method gives the experimental settings and starts the work.
|
/**
|
||||||
|
* This method gives the experimental settings and starts the work.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void startExperiment() {
|
public void startExperiment() {
|
||||||
@ -360,11 +359,10 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method represents the application code that we'd like to
|
* This method represents the application code that we'd like to run on a
|
||||||
* run on a separate thread. It simulates slowly computing
|
* separate thread. It simulates slowly computing a value, in this case just
|
||||||
* a value, in this case just a string 'All Done'. It updates the
|
* a string 'All Done'. It updates the progress bar every half second to
|
||||||
* progress bar every half second to remind the user that
|
* remind the user that we're still busy.
|
||||||
* we're still busy.
|
|
||||||
*/
|
*/
|
||||||
public Object doWork() {
|
public Object doWork() {
|
||||||
try {
|
try {
|
||||||
@ -449,8 +447,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
this.draw();
|
this.draw();
|
||||||
}
|
}
|
||||||
this.m_ExperimentName = this.m_GO.getOptimizer().getName() + "-" + this.m_PerformedRuns.size();
|
this.m_ExperimentName = this.m_GO.getOptimizer().getName() + "-" + this.m_PerformedRuns.size();
|
||||||
}
|
} catch (InterruptedException e) {
|
||||||
catch (InterruptedException e) {
|
|
||||||
updateStatus(0);
|
updateStatus(0);
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
this.m_StatusField.setText("Interrupted...");
|
this.m_StatusField.setText("Interrupted...");
|
||||||
@ -467,7 +464,8 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
if (this.show) {
|
if (this.show) {
|
||||||
for (int i = 0; i < this.m_MultiRuns; i++) {
|
for (int i = 0; i < this.m_MultiRuns; i++) {
|
||||||
this.m_Plot.clearGraph(1000 + i);
|
this.m_Plot.clearGraph(1000 + i);
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
updateStatus(0);
|
updateStatus(0);
|
||||||
if (this.show) {
|
if (this.show) {
|
||||||
this.m_StatusField.setText("Finished...");
|
this.m_StatusField.setText("Finished...");
|
||||||
@ -475,7 +473,8 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
return "All Done";
|
return "All Done";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method refreshes the plot
|
/**
|
||||||
|
* This method refreshes the plot
|
||||||
*/
|
*/
|
||||||
private void draw() {
|
private void draw() {
|
||||||
ArrayList multiRuns, singleRun;
|
ArrayList multiRuns, singleRun;
|
||||||
@ -525,8 +524,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
for (int j = 0; j < data.length; j++) {
|
for (int j = 0; j < data.length; j++) {
|
||||||
if (this.m_ContinueFlag) {
|
if (this.m_ContinueFlag) {
|
||||||
this.m_Plot.setConnectedPoint(data[j][0] + this.m_RecentFC, data[j][1], this.currentExperiment);
|
this.m_Plot.setConnectedPoint(data[j][0] + this.m_RecentFC, data[j][1], this.currentExperiment);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.m_Plot.setConnectedPoint(data[j][0], data[j][1], this.currentExperiment);
|
this.m_Plot.setConnectedPoint(data[j][0], data[j][1], this.currentExperiment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,10 +533,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the worker needs to update the GUI we do so by queuing
|
* When the worker needs to update the GUI we do so by queuing a Runnable
|
||||||
* a Runnable for the event dispatching thread with
|
* for the event dispatching thread with SwingUtilities.invokeLater(). In
|
||||||
* SwingUtilities.invokeLater(). In this case we're just
|
* this case we're just changing the progress bars value.
|
||||||
* changing the progress bars value.
|
|
||||||
*/
|
*/
|
||||||
void updateStatus(final int i) {
|
void updateStatus(final int i) {
|
||||||
if (this.m_ProgressBar != null) {
|
if (this.m_ProgressBar != null) {
|
||||||
@ -552,29 +549,27 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method will create a new instance of LectureGUI and will call show() to create
|
/**
|
||||||
* the necessary frames. This method will ignore all arguments.
|
* This method will create a new instance of LectureGUI and will call show()
|
||||||
|
* to create the necessary frames. This method will ignore all arguments.
|
||||||
|
*
|
||||||
* @param args
|
* @param args
|
||||||
*/
|
*/
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
if (false) {
|
|
||||||
InterfaceGOStandalone app = (InterfaceGOStandalone)ThreadProxy.newInstance(new GOStandaloneVersion());
|
|
||||||
app.startExperiment();
|
|
||||||
app.setShow(false);
|
|
||||||
} else {
|
|
||||||
GOStandaloneVersion program = new GOStandaloneVersion();
|
GOStandaloneVersion program = new GOStandaloneVersion();
|
||||||
RNG.setRandomSeed(1);
|
RNG.setRandomSeed(1);
|
||||||
program.initFrame();
|
program.initFrame();
|
||||||
program.setShow(true);
|
program.setShow(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setShow(boolean t) {
|
public void setShow(boolean t) {
|
||||||
this.show = t;
|
this.show = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows an optimizer to register a change in the optimizer.
|
/**
|
||||||
|
* This method allows an optimizer to register a change in the optimizer.
|
||||||
|
*
|
||||||
* @param source The source of the event.
|
* @param source The source of the event.
|
||||||
* @param name Could be used to indicate the nature of the event.
|
* @param name Could be used to indicate the nature of the event.
|
||||||
*/
|
*/
|
||||||
@ -616,8 +611,7 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
if (this.m_Plot != null) {
|
if (this.m_Plot != null) {
|
||||||
if (this.m_ContinueFlag) {
|
if (this.m_ContinueFlag) {
|
||||||
this.m_Plot.setConnectedPoint(tmpData[0].doubleValue() + this.m_RecentFC, tmpData[1].doubleValue(), 1000 + this.currentRun);
|
this.m_Plot.setConnectedPoint(tmpData[0].doubleValue() + this.m_RecentFC, tmpData[1].doubleValue(), 1000 + this.currentRun);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
this.m_Plot.setConnectedPoint(tmpData[0].doubleValue(), tmpData[1].doubleValue(), 1000 + this.currentRun);
|
this.m_Plot.setConnectedPoint(tmpData[0].doubleValue(), tmpData[1].doubleValue(), 1000 + this.currentRun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,7 +619,9 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method writes Data to file.
|
/**
|
||||||
|
* This method writes Data to file.
|
||||||
|
*
|
||||||
* @param line The line that is to be added to the file
|
* @param line The line that is to be added to the file
|
||||||
*/
|
*/
|
||||||
private void writeToFile(String line) {
|
private void writeToFile(String line) {
|
||||||
@ -641,41 +637,51 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows the CommonJavaObjectEditorPanel to read the
|
/**
|
||||||
* name to the current object.
|
* This method allows the CommonJavaObjectEditorPanel to read the name to
|
||||||
|
* the current object.
|
||||||
|
*
|
||||||
* @return The name.
|
* @return The name.
|
||||||
*/
|
*/
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "EA Lecture GUI";
|
return "EA Lecture GUI";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
/**
|
||||||
|
* ********************************************************************************************************************
|
||||||
* These are for GUI
|
* These are for GUI
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
/** This method returns a global info string
|
* This method returns a global info string
|
||||||
|
*
|
||||||
* @return description
|
* @return description
|
||||||
*/
|
*/
|
||||||
public static String globalInfo() {
|
public static String globalInfo() {
|
||||||
return "This is a simple example framework for Evolutionary Algorithms.";
|
return "This is a simple example framework for Evolutionary Algorithms.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to set the number of mulitruns that are to be performed,
|
/**
|
||||||
* necessary for stochastic optimizers to ensure reliable results.
|
* This method allows you to set the number of mulitruns that are to be
|
||||||
|
* performed, necessary for stochastic optimizers to ensure reliable
|
||||||
|
* results.
|
||||||
|
*
|
||||||
* @param multiruns The number of multiruns that are to be performed
|
* @param multiruns The number of multiruns that are to be performed
|
||||||
*/
|
*/
|
||||||
public void setMultiRuns(int multiruns) {
|
public void setMultiRuns(int multiruns) {
|
||||||
this.m_MultiRuns = multiruns;
|
this.m_MultiRuns = multiruns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMultiRuns() {
|
public int getMultiRuns() {
|
||||||
return this.m_MultiRuns;
|
return this.m_MultiRuns;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String multiRunsTipText() {
|
public String multiRunsTipText() {
|
||||||
return "Multiple runs may be necessary to produce reliable results for stochastic optimizing algorithms.";
|
return "Multiple runs may be necessary to produce reliable results for stochastic optimizing algorithms.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to set the seed for the random number
|
/**
|
||||||
* generator.
|
* This method allows you to set the seed for the random number generator.
|
||||||
|
*
|
||||||
* @param seed The seed for the random number generator
|
* @param seed The seed for the random number generator
|
||||||
*/
|
*/
|
||||||
// MK: These methods have nothing to do with the seed parameter from the m_GO object which is actually used, so I comment them out
|
// MK: These methods have nothing to do with the seed parameter from the m_GO object which is actually used, so I comment them out
|
||||||
@ -688,47 +694,57 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
// public String seedTipText() {
|
// public String seedTipText() {
|
||||||
// return "Choose the seed for the random number generator.";
|
// return "Choose the seed for the random number generator.";
|
||||||
// }
|
// }
|
||||||
|
/**
|
||||||
/** This method sets the name of the current experiment as it will occur in the
|
* This method sets the name of the current experiment as it will occur in
|
||||||
* plot legend.
|
* the plot legend.
|
||||||
|
*
|
||||||
* @param experimentName The experiment name
|
* @param experimentName The experiment name
|
||||||
*/
|
*/
|
||||||
public void setExpName(String experimentName) {
|
public void setExpName(String experimentName) {
|
||||||
this.m_ExperimentName = experimentName;
|
this.m_ExperimentName = experimentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getExpName() {
|
public String getExpName() {
|
||||||
return this.m_ExperimentName;
|
return this.m_ExperimentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String expNameTipText() {
|
public String expNameTipText() {
|
||||||
return "Set the name of the experiment as it will occur in the legend.";
|
return "Set the name of the experiment as it will occur in the legend.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method will set the output filename
|
/**
|
||||||
|
* This method will set the output filename
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public void setOutputFileName(String name) {
|
public void setOutputFileName(String name) {
|
||||||
this.m_OutputFileName = name;
|
this.m_OutputFileName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOutputFileName() {
|
public String getOutputFileName() {
|
||||||
return this.m_OutputFileName;
|
return this.m_OutputFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String outputFileNameTipText() {
|
public String outputFileNameTipText() {
|
||||||
return "Set the name for the output file, if 'none' no output file will be created.";
|
return "Set the name for the output file, if 'none' no output file will be created.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method will set the output filename
|
/**
|
||||||
|
* This method will set the output filename
|
||||||
|
*
|
||||||
* @param name
|
* @param name
|
||||||
*/
|
*/
|
||||||
public void setList(List name) {
|
public void setList(List name) {
|
||||||
this.m_List = name;
|
this.m_List = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getListe() {
|
public List getListe() {
|
||||||
return this.m_List;
|
return this.m_List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String listTipText() {
|
public String listTipText() {
|
||||||
return "Set the name for the output file, if 'none' no output file will be created.";
|
return "Set the name for the output file, if 'none' no output file will be created.";
|
||||||
}
|
}
|
||||||
|
|
||||||
// /** This method allows you to set the number of functions calls that are to
|
// /** This method allows you to set the number of functions calls that are to
|
||||||
// * be evaluated. Note generational optimizers may exceed this number since
|
// * be evaluated. Note generational optimizers may exceed this number since
|
||||||
// * they allways evaluate the complete population
|
// * they allways evaluate the complete population
|
||||||
@ -759,7 +775,6 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
// public String optimizerTipText() {
|
// public String optimizerTipText() {
|
||||||
// return "Choose a optimizing strategies.";
|
// return "Choose a optimizing strategies.";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// /** This method will set the problem that is to be optimized
|
// /** This method will set the problem that is to be optimized
|
||||||
// * @param problem
|
// * @param problem
|
||||||
// */
|
// */
|
||||||
@ -773,8 +788,6 @@ public class GOStandaloneVersion implements InterfaceGOStandalone, InterfacePopu
|
|||||||
// public String problemTipText() {
|
// public String problemTipText() {
|
||||||
// return "Choose the problem that is to optimize and the EA individual parameters.";
|
// return "Choose the problem that is to optimize and the EA individual parameters.";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// public void setTest(InterfaceTest v) {
|
// public void setTest(InterfaceTest v) {
|
||||||
// this.test = v;
|
// this.test = v;
|
||||||
// }
|
// }
|
||||||
|
@ -1,17 +1,7 @@
|
|||||||
package eva2.server.go;
|
package eva2.server.go;
|
||||||
|
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
import eva2.optimization.OptimizationStateListener;
|
||||||
|
|
||||||
/*
|
|
||||||
* Title: EvA2
|
|
||||||
* Description:
|
|
||||||
* Copyright: Copyright (c) 2003
|
|
||||||
* Company: University of Tuebingen, Computer Architecture
|
|
||||||
* @author Holger Ulmer, Felix Streichert, Hannes Planatscher
|
|
||||||
* @version: $Revision: 306 $
|
|
||||||
* $Date: 2007-12-04 14:22:52 +0100 (Tue, 04 Dec 2007) $
|
|
||||||
* $Author: mkron $
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for Optimization Processor.
|
* Interface for Optimization Processor.
|
||||||
@ -34,11 +24,11 @@ public interface InterfaceProcessor {
|
|||||||
void stopOpt();
|
void stopOpt();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new RemoteStateListener.
|
* Adds a new OptimizationStateListener.
|
||||||
*
|
*
|
||||||
* @param module The module to add.
|
* @param module The module to add.
|
||||||
*/
|
*/
|
||||||
void addListener(RemoteStateListener module);
|
void addListener(OptimizationStateListener module);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Info String about the Optimization.
|
* Get Info String about the Optimization.
|
||||||
|
@ -3,7 +3,6 @@ package eva2.server.go.mocco;
|
|||||||
|
|
||||||
import eva2.gui.GenericObjectEditor;
|
import eva2.gui.GenericObjectEditor;
|
||||||
import eva2.gui.PropertyEditorProvider;
|
import eva2.gui.PropertyEditorProvider;
|
||||||
import eva2.gui.PropertyRemoteServers;
|
|
||||||
import eva2.server.go.InterfaceTerminator;
|
import eva2.server.go.InterfaceTerminator;
|
||||||
import eva2.server.go.MOCCOStandalone;
|
import eva2.server.go.MOCCOStandalone;
|
||||||
import eva2.server.go.operators.migration.SOBestMigration;
|
import eva2.server.go.operators.migration.SOBestMigration;
|
||||||
@ -240,12 +239,13 @@ public class MOCCOParameterizeRefPoint extends MOCCOPhase implements InterfacePr
|
|||||||
}
|
}
|
||||||
// then set the values
|
// then set the values
|
||||||
// if (!m_Island.getLocalOnly()) {
|
// if (!m_Island.getLocalOnly()) {
|
||||||
PropertyRemoteServers t = m_Island.getServers();
|
// ToDo: Think of new ways to do this!
|
||||||
|
/*PropertyRemoteServers t = m_Island.getServers();
|
||||||
String[] servers = t.getServerNodes();
|
String[] servers = t.getServerNodes();
|
||||||
if (servers.length != m_Perturbations) {
|
if (servers.length != m_Perturbations) {
|
||||||
System.out.println("Warning: Number of servers overrides number of perturbations!");
|
System.out.println("Warning: Number of servers overrides number of perturbations!");
|
||||||
m_Perturbations = servers.length;
|
m_Perturbations = servers.length;
|
||||||
}
|
}*/
|
||||||
// } else {
|
// } else {
|
||||||
// m_Island.setNumberLocalCPUs(m_Perturbations);
|
// m_Island.setNumberLocalCPUs(m_Perturbations);
|
||||||
// }
|
// }
|
||||||
|
@ -3,7 +3,6 @@ package eva2.server.go.mocco;
|
|||||||
|
|
||||||
import eva2.gui.GenericObjectEditor;
|
import eva2.gui.GenericObjectEditor;
|
||||||
import eva2.gui.PropertyEditorProvider;
|
import eva2.gui.PropertyEditorProvider;
|
||||||
import eva2.gui.PropertyRemoteServers;
|
|
||||||
import eva2.server.go.InterfaceTerminator;
|
import eva2.server.go.InterfaceTerminator;
|
||||||
import eva2.server.go.MOCCOStandalone;
|
import eva2.server.go.MOCCOStandalone;
|
||||||
import eva2.server.go.operators.migration.SOBestMigration;
|
import eva2.server.go.operators.migration.SOBestMigration;
|
||||||
@ -241,12 +240,13 @@ public class MOCCOParameterizeTchebycheff extends MOCCOPhase implements Interfac
|
|||||||
}
|
}
|
||||||
// then set the values
|
// then set the values
|
||||||
// if (!m_Island.getLocalOnly()) {
|
// if (!m_Island.getLocalOnly()) {
|
||||||
PropertyRemoteServers servs = m_Island.getServers();
|
// ToDo: Think of new ways to do this!
|
||||||
|
/* PropertyRemoteServers servs = m_Island.getServers();
|
||||||
String[] servers = servs.getServerNodes();
|
String[] servers = servs.getServerNodes();
|
||||||
if (servers.length != m_Perturbations) {
|
if (servers.length != m_Perturbations) {
|
||||||
System.out.println("Warning: Number of servers overrides number of perturbations!");
|
System.out.println("Warning: Number of servers overrides number of perturbations!");
|
||||||
m_Perturbations = servers.length;
|
m_Perturbations = servers.length;
|
||||||
}
|
}*/
|
||||||
// } else {
|
// } else {
|
||||||
// m_Island.setNumberLocalCPUs(m_Perturbations);
|
// m_Island.setNumberLocalCPUs(m_Perturbations);
|
||||||
// }
|
// }
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package eva2.server.go.problems;
|
package eva2.server.go.problems;
|
||||||
|
|
||||||
import eva2.gui.PropertyRemoteServers;
|
|
||||||
import eva2.tools.jproxy.RMIProxyRemoteThread;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is under construction.
|
* This class is under construction.
|
||||||
*
|
*
|
||||||
@ -14,14 +11,14 @@ import eva2.tools.jproxy.RMIProxyRemoteThread;
|
|||||||
*/
|
*/
|
||||||
public abstract class AbstractParallelOptimizationProblem extends AbstractOptimizationProblem {
|
public abstract class AbstractParallelOptimizationProblem extends AbstractOptimizationProblem {
|
||||||
|
|
||||||
private PropertyRemoteServers m_Servers = new PropertyRemoteServers();
|
// private PropertyRemoteServers m_Servers = new PropertyRemoteServers();
|
||||||
private int m_LocalCPUs = 4;
|
private int m_LocalCPUs = 4;
|
||||||
private boolean m_Parallelize = false;
|
private boolean m_Parallelize = false;
|
||||||
private AbstractOptimizationProblem[] m_Slaves;
|
private AbstractOptimizationProblem[] m_Slaves;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initProblem() {
|
public void initProblem() {
|
||||||
if (this.m_Parallelize) {
|
/* if (this.m_Parallelize) {
|
||||||
// this is running on remote maschines
|
// this is running on remote maschines
|
||||||
String[] nodesList = this.m_Servers.getCheckedServerNodes();
|
String[] nodesList = this.m_Servers.getCheckedServerNodes();
|
||||||
if ((nodesList == null) || (nodesList.length == 0)) {
|
if ((nodesList == null) || (nodesList.length == 0)) {
|
||||||
@ -37,22 +34,8 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi
|
|||||||
for (int i = 0; i < this.m_LocalCPUs; i++) {
|
for (int i = 0; i < this.m_LocalCPUs; i++) {
|
||||||
this.m_Slaves[i] = (AbstractOptimizationProblem) this.clone();
|
this.m_Slaves[i] = (AbstractOptimizationProblem) this.clone();
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// /** This method evaluates a given population and set the fitness values
|
|
||||||
// * accordingly
|
|
||||||
// * @param population The population that is to be evaluated.
|
|
||||||
// */
|
|
||||||
// public void evaluate(Population population) {
|
|
||||||
// AbstractEAIndividual tmpIndy;
|
|
||||||
// int curIndex = 0;
|
|
||||||
//
|
|
||||||
// while (curIndex < population.size()) {
|
|
||||||
// what the ?? is this??
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**********************************************************************************************************************
|
/**********************************************************************************************************************
|
||||||
* These are for GUI
|
* These are for GUI
|
||||||
@ -88,7 +71,7 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi
|
|||||||
/** This method allows you to managae the available servers
|
/** This method allows you to managae the available servers
|
||||||
* @return The current servers
|
* @return The current servers
|
||||||
*/
|
*/
|
||||||
public PropertyRemoteServers getServers() {
|
/* public PropertyRemoteServers getServers() {
|
||||||
return this.m_Servers;
|
return this.m_Servers;
|
||||||
}
|
}
|
||||||
public void setServers(PropertyRemoteServers b){
|
public void setServers(PropertyRemoteServers b){
|
||||||
@ -97,7 +80,7 @@ public abstract class AbstractParallelOptimizationProblem extends AbstractOptimi
|
|||||||
public String serversTipText() {
|
public String serversTipText() {
|
||||||
return "Choose and manage the servers (only active in parallelized mode).";
|
return "Choose and manage the servers (only active in parallelized mode).";
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/** This method allows you to set the number of processors in local mode
|
/** This method allows you to set the number of processors in local mode
|
||||||
* @param n Number of processors.
|
* @param n Number of processors.
|
||||||
*/
|
*/
|
||||||
|
@ -2,7 +2,6 @@ package eva2.server.go.strategies;
|
|||||||
|
|
||||||
import eva2.gui.BeanInspector;
|
import eva2.gui.BeanInspector;
|
||||||
import eva2.gui.Plot;
|
import eva2.gui.Plot;
|
||||||
import eva2.gui.PropertyRemoteServers;
|
|
||||||
import eva2.server.go.InterfacePopulationChangedEventListener;
|
import eva2.server.go.InterfacePopulationChangedEventListener;
|
||||||
import eva2.server.go.individuals.ESIndividualDoubleData;
|
import eva2.server.go.individuals.ESIndividualDoubleData;
|
||||||
import eva2.server.go.operators.migration.InterfaceMigration;
|
import eva2.server.go.operators.migration.InterfaceMigration;
|
||||||
@ -17,9 +16,6 @@ import eva2.server.go.problems.F1Problem;
|
|||||||
import eva2.server.go.problems.F8Problem;
|
import eva2.server.go.problems.F8Problem;
|
||||||
import eva2.server.go.problems.InterfaceOptimizationProblem;
|
import eva2.server.go.problems.InterfaceOptimizationProblem;
|
||||||
import eva2.server.go.problems.TF1Problem;
|
import eva2.server.go.problems.TF1Problem;
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import eva2.tools.jproxy.RMIProxyRemoteThread;
|
|
||||||
import eva2.tools.jproxy.RMIServer;
|
|
||||||
|
|
||||||
/** The one and only island model for parallelization. Since parallelization based
|
/** The one and only island model for parallelization. Since parallelization based
|
||||||
* on the RMIProxyRemoteThread is on the one hand much slower than benchmark function
|
* on the RMIProxyRemoteThread is on the one hand much slower than benchmark function
|
||||||
@ -41,6 +37,7 @@ import eva2.tools.jproxy.RMIServer;
|
|||||||
* Time: 14:48:20
|
* Time: 14:48:20
|
||||||
* To change this template use File | Settings | File Templates.
|
* To change this template use File | Settings | File Templates.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class IslandModelEA implements InterfacePopulationChangedEventListener, InterfaceOptimizer, java.io.Serializable {
|
public class IslandModelEA implements InterfacePopulationChangedEventListener, InterfaceOptimizer, java.io.Serializable {
|
||||||
|
|
||||||
private Population m_Population = new Population();
|
private Population m_Population = new Population();
|
||||||
@ -50,13 +47,11 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
// private String[] m_NodesList;
|
// private String[] m_NodesList;
|
||||||
private int m_MigrationRate = 10;
|
private int m_MigrationRate = 10;
|
||||||
private boolean m_HeterogenuousProblems = false;
|
private boolean m_HeterogenuousProblems = false;
|
||||||
private PropertyRemoteServers m_Servers = new PropertyRemoteServers();
|
|
||||||
|
|
||||||
// These are the processor to run on
|
// These are the processor to run on
|
||||||
private int m_numLocalCPUs = 1;
|
private int m_numLocalCPUs = 1;
|
||||||
private boolean m_localOnly = false;
|
private boolean m_localOnly = false;
|
||||||
transient private InterfaceOptimizer[] m_Islands;
|
transient private InterfaceOptimizer[] m_Islands;
|
||||||
transient private RMIServer m_LocalServer = null;
|
|
||||||
|
|
||||||
// This is for debugging
|
// This is for debugging
|
||||||
private boolean m_LogLocalChanges = true;
|
private boolean m_LogLocalChanges = true;
|
||||||
@ -76,7 +71,6 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
this.m_Problem = (InterfaceOptimizationProblem)a.m_Problem.clone();
|
this.m_Problem = (InterfaceOptimizationProblem)a.m_Problem.clone();
|
||||||
this.m_Optimizer = (InterfaceOptimizer)a.m_Optimizer.clone();
|
this.m_Optimizer = (InterfaceOptimizer)a.m_Optimizer.clone();
|
||||||
this.m_Migration = (InterfaceMigration)a.m_Migration.clone();
|
this.m_Migration = (InterfaceMigration)a.m_Migration.clone();
|
||||||
this.m_Servers = (PropertyRemoteServers)a.m_Servers.clone();
|
|
||||||
this.m_MigrationRate = a.m_MigrationRate;
|
this.m_MigrationRate = a.m_MigrationRate;
|
||||||
this.m_HeterogenuousProblems = a.m_HeterogenuousProblems;
|
this.m_HeterogenuousProblems = a.m_HeterogenuousProblems;
|
||||||
this.m_numLocalCPUs = a.m_numLocalCPUs;
|
this.m_numLocalCPUs = a.m_numLocalCPUs;
|
||||||
@ -119,7 +113,8 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is running on remote machines
|
// this is running on remote machines
|
||||||
if (this.m_LocalServer == null) {
|
// ToDo: Parallelize with Threads?!?
|
||||||
|
/*if (this.m_LocalServer == null) {
|
||||||
this.m_LocalServer = RMIServer.getInstance();
|
this.m_LocalServer = RMIServer.getInstance();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -139,7 +134,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
if (this.m_LogLocalChanges) {
|
if (this.m_LogLocalChanges) {
|
||||||
this.m_Islands[i].addPopulationChangedEventListener(myLocal);
|
this.m_Islands[i].addPopulationChangedEventListener(myLocal);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
this.m_Migration.initMigration(this.m_Islands);
|
this.m_Migration.initMigration(this.m_Islands);
|
||||||
@ -193,6 +188,8 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is running on remote machines
|
// this is running on remote machines
|
||||||
|
// ToDo: Parallellize with threads?!?
|
||||||
|
/*
|
||||||
if (this.m_LocalServer == null) {
|
if (this.m_LocalServer == null) {
|
||||||
this.m_LocalServer = RMIServer.getInstance();
|
this.m_LocalServer = RMIServer.getInstance();
|
||||||
}
|
}
|
||||||
@ -213,7 +210,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
if (this.m_LogLocalChanges) {
|
if (this.m_LogLocalChanges) {
|
||||||
this.m_Islands[i].addPopulationChangedEventListener(myLocal);
|
this.m_Islands[i].addPopulationChangedEventListener(myLocal);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
this.m_Migration.initMigration(this.m_Islands);
|
this.m_Migration.initMigration(this.m_Islands);
|
||||||
@ -282,7 +279,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.m_Population.clear();
|
this.m_Population.clear();
|
||||||
this.m_Population.SetFunctionCalls(0);
|
this.m_Population.setFunctionCalls(0);
|
||||||
Population pop;
|
Population pop;
|
||||||
for (int i = 0; i < this.m_Islands.length; i++) {
|
for (int i = 0; i < this.m_Islands.length; i++) {
|
||||||
pop = (Population)this.m_Islands[i].getPopulation().clone();
|
pop = (Population)this.m_Islands[i].getPopulation().clone();
|
||||||
@ -372,16 +369,9 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// @todo die ServerStarter muss ich noch hin kriegen
|
// @todo die ServerStarter muss ich noch hin kriegen
|
||||||
// @todo Wichtig ich brauche den eva2.tools.jproxy.RMIServer!
|
// @todo Wichtig ich brauche den eva2.tools.jproxy.RMIServer!
|
||||||
PropertyRemoteServers s = new PropertyRemoteServers();
|
|
||||||
s.addServerNode("raold1.informatik.uni-tuebingen.de", 2);
|
|
||||||
s.addServerNode("raold2.informatik.uni-tuebingen.de", 2);
|
|
||||||
s.addServerNode("raold3.informatik.uni-tuebingen.de", 2);
|
|
||||||
s.setPassword("KozeOpL;");
|
|
||||||
s.startServers();
|
|
||||||
IslandModelEA imea = new IslandModelEA();
|
IslandModelEA imea = new IslandModelEA();
|
||||||
imea.m_Show = true;
|
imea.m_Show = true;
|
||||||
imea.m_localOnly = false;
|
imea.m_localOnly = false;
|
||||||
imea.setServers(s);
|
|
||||||
if (false) {
|
if (false) {
|
||||||
imea.m_Optimizer = new MultiObjectiveEA();
|
imea.m_Optimizer = new MultiObjectiveEA();
|
||||||
((MultiObjectiveEA)imea.m_Optimizer).setArchiveSize(25);
|
((MultiObjectiveEA)imea.m_Optimizer).setArchiveSize(25);
|
||||||
@ -565,15 +555,6 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
|||||||
return "Set the migration rate for communication between islands.";
|
return "Set the migration rate for communication between islands.";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method allows you to managae the available servers
|
|
||||||
* @return The current servers
|
|
||||||
*/
|
|
||||||
public PropertyRemoteServers getServers() {
|
|
||||||
return this.m_Servers;
|
|
||||||
}
|
|
||||||
public void setServers(PropertyRemoteServers b){
|
|
||||||
this.m_Servers = b;
|
|
||||||
}
|
|
||||||
public String serversTipText() {
|
public String serversTipText() {
|
||||||
return "Choose and manage the servers (only active in parallelized mode).";
|
return "Choose and manage the servers (only active in parallelized mode).";
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,8 @@ package eva2.server.modules;
|
|||||||
*/
|
*/
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.server.go.InterfaceProcessor;
|
import eva2.server.go.InterfaceProcessor;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.InetAddress;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -32,39 +30,20 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
|||||||
protected String hostName = "not defined";
|
protected String hostName = "not defined";
|
||||||
protected boolean hasConnection = true;
|
protected boolean hasConnection = true;
|
||||||
protected ModuleAdapter remoteModuleAdapter = null;
|
protected ModuleAdapter remoteModuleAdapter = null;
|
||||||
protected boolean useRMI = true;
|
private List<OptimizationStateListener> optimizationStateListeners;
|
||||||
protected MainAdapterClient mainAdapterClient; // connection to client
|
|
||||||
private List<RemoteStateListener> remoteStateListeners;
|
|
||||||
|
|
||||||
protected AbstractModuleAdapter(MainAdapterClient client) {
|
protected AbstractModuleAdapter() {
|
||||||
instanceCounter++;
|
instanceCounter++;
|
||||||
instanceNumber = instanceCounter;
|
instanceNumber = instanceCounter;
|
||||||
|
optimizationStateListeners = new ArrayList<OptimizationStateListener>();
|
||||||
if (client != null) {
|
|
||||||
try {
|
|
||||||
hostName = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (Exception e) {
|
|
||||||
System.out.println("InetAddress.getLocalHost().getHostAddress() --> ERROR" + e.getMessage());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hostName = "localhost";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((client == null) || client.getHostName().equals(hostName)) {
|
|
||||||
useRMI = false;
|
|
||||||
} else {
|
|
||||||
/* we use RMI */
|
|
||||||
useRMI = true;
|
|
||||||
}
|
|
||||||
remoteStateListeners = new ArrayList<RemoteStateListener>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* From the interface RemoteStateListener. Added this method to make progress bar possible.
|
* From the interface OptimizationStateListener. Added this method to make progress bar possible.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateProgress(final int percent, String msg) {
|
public void updateProgress(final int percent, String msg) {
|
||||||
for (RemoteStateListener listener : remoteStateListeners) {
|
for (OptimizationStateListener listener : optimizationStateListeners) {
|
||||||
listener.updateProgress(percent, msg);
|
listener.updateProgress(percent, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,8 +134,8 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
|||||||
* Adds a remote state listener.
|
* Adds a remote state listener.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addRemoteStateListener(RemoteStateListener remoteListener) {
|
public void addOptimizationStateListener(OptimizationStateListener remoteListener) {
|
||||||
remoteStateListeners.add(remoteListener);
|
optimizationStateListeners.add(remoteListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,21 +179,21 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void performedStop() {
|
public void performedStop() {
|
||||||
for (RemoteStateListener listener : remoteStateListeners) {
|
for (OptimizationStateListener listener : optimizationStateListeners) {
|
||||||
listener.performedStop();
|
listener.performedStop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performedStart(String infoString) {
|
public void performedStart(String infoString) {
|
||||||
for (RemoteStateListener listener : remoteStateListeners) {
|
for (OptimizationStateListener listener : optimizationStateListeners) {
|
||||||
listener.performedStart(infoString);
|
listener.performedStart(infoString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void performedRestart(String infoString) {
|
public void performedRestart(String infoString) {
|
||||||
for (RemoteStateListener listener : remoteStateListeners) {
|
for (OptimizationStateListener listener : optimizationStateListeners) {
|
||||||
listener.performedRestart(infoString);
|
listener.performedRestart(infoString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the DE module adapter necessary to access this implementation from the EvA top level.
|
* This the DE module adapter necessary to access this implementation from the EvA top level.
|
||||||
*/
|
*/
|
||||||
@ -10,8 +7,8 @@ public class DEModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
|
|
||||||
private static final String moduleName = "Differential_Evolution";
|
private static final String moduleName = "Differential_Evolution";
|
||||||
|
|
||||||
public DEModuleAdapter(String adapterName, MainAdapterClient client) {
|
public DEModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "DE.html", client, DEParameters.getInstance(), true);
|
super(adapterName, "DE.html", DEParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the EP module adapter necessary to access this implementation from the EvA top level.
|
* This the EP module adapter necessary to access this implementation from the EvA top level.
|
||||||
*/
|
*/
|
||||||
@ -9,8 +7,8 @@ public class EPModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
|
|
||||||
private static final String moduleName = "Evolutionary_Programming";
|
private static final String moduleName = "Evolutionary_Programming";
|
||||||
|
|
||||||
public EPModuleAdapter(String adapterName, MainAdapterClient client) {
|
public EPModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "EP.html", client, EPParameters.getInstance(), true);
|
super(adapterName, "EP.html", EPParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the GA module adapter necessary to access this implementation from the EvA top level.
|
* This the GA module adapter necessary to access this implementation from the EvA top level.
|
||||||
@ -9,8 +8,8 @@ public class GAModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
|
|
||||||
private static final String moduleName = "Genetic_Algorithm";
|
private static final String moduleName = "Genetic_Algorithm";
|
||||||
|
|
||||||
public GAModuleAdapter(String adapterName, MainAdapterClient client) {
|
public GAModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "GA.html", client, GAParameters.getInstance(), true);
|
super(adapterName, "GA.html", GAParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.server.go.InterfaceGOParameters;
|
import eva2.server.go.InterfaceGOParameters;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
@ -25,8 +24,8 @@ public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
* @param AdapterName the title of the ModulAdapter
|
* @param AdapterName the title of the ModulAdapter
|
||||||
* @param Client the client instance
|
* @param Client the client instance
|
||||||
*/
|
*/
|
||||||
public GOModuleAdapter(String adapterName, MainAdapterClient client) {
|
public GOModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "", client, GOParameters.getInstance(), false);
|
super(adapterName, "", GOParameters.getInstance(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,9 +34,8 @@ public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
* @param AdapterName the title of the ModulAdapter
|
* @param AdapterName the title of the ModulAdapter
|
||||||
* @param Client the client instance
|
* @param Client the client instance
|
||||||
*/
|
*/
|
||||||
public GOModuleAdapter(String adapterName, InterfaceGOParameters goParams, String noGuiLogFile, MainAdapterClient client) {
|
public GOModuleAdapter(String adapterName, InterfaceGOParameters goParams, String noGuiLogFile) {
|
||||||
//super(adapterName, "", client, GOParameters.getInstance(serParamsFile, false), false);
|
super(adapterName, "", goParams, false, noGuiLogFile);
|
||||||
super(adapterName, "", client, goParams, false, noGuiLogFile);
|
|
||||||
}
|
}
|
||||||
// /**
|
// /**
|
||||||
// * Starts a statistics GUI and the GOProcessor thread with a given GOParameters file.
|
// * Starts a statistics GUI and the GOProcessor thread with a given GOParameters file.
|
||||||
|
@ -12,8 +12,6 @@ import eva2.server.stat.EvAJobList;
|
|||||||
import eva2.server.stat.InterfaceStatisticsParameter;
|
import eva2.server.stat.InterfaceStatisticsParameter;
|
||||||
import eva2.server.stat.StatisticsStandalone;
|
import eva2.server.stat.StatisticsStandalone;
|
||||||
import eva2.server.stat.StatisticsWithGUI;
|
import eva2.server.stat.StatisticsWithGUI;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Proxy;
|
import java.lang.reflect.Proxy;
|
||||||
|
|
||||||
@ -29,22 +27,19 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
|||||||
*
|
*
|
||||||
* @param adapterName The AdapterName
|
* @param adapterName The AdapterName
|
||||||
* @param helperFName Name of a HTML help file name
|
* @param helperFName Name of a HTML help file name
|
||||||
* @param adapterClient The client to serve
|
|
||||||
* @param params A parameter set describing the optimizer module
|
* @param params A parameter set describing the optimizer module
|
||||||
* @param optimizerExpert Set to true if setting the optimizer is an expert option being hidden
|
* @param optimizerExpert Set to true if setting the optimizer is an expert option being hidden
|
||||||
* from the gui
|
* from the gui
|
||||||
* @param noGUIStatOut If null, statistics with GUI are used, else the standalone statistics
|
* @param noGUIStatOut If null, statistics with GUI are used, else the standalone statistics
|
||||||
* with given output filename.
|
* with given output filename.
|
||||||
*/
|
*/
|
||||||
public GenericModuleAdapter(String adapterName, String helperFName, MainAdapterClient adapterClient, InterfaceGOParameters params, boolean optimizerExpert, String noGUIStatOut) {
|
public GenericModuleAdapter(String adapterName, String helperFName, InterfaceGOParameters params, boolean optimizerExpert, String noGUIStatOut) {
|
||||||
super(adapterClient);
|
|
||||||
remoteModuleAdapter = this;
|
remoteModuleAdapter = this;
|
||||||
this.adapterName = adapterName;
|
this.adapterName = adapterName;
|
||||||
mainAdapterClient = adapterClient;
|
|
||||||
helperFilename = helperFName;
|
helperFilename = helperFName;
|
||||||
|
|
||||||
if (noGUIStatOut==null) {
|
if (noGUIStatOut==null) {
|
||||||
statisticsModule = new StatisticsWithGUI(adapterClient);
|
statisticsModule = new StatisticsWithGUI();
|
||||||
} else {
|
} else {
|
||||||
statisticsModule = new StatisticsStandalone(noGUIStatOut);
|
statisticsModule = new StatisticsStandalone(noGUIStatOut);
|
||||||
}
|
}
|
||||||
@ -69,8 +64,8 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
|||||||
* @param params a parameter set describing the optimizer module
|
* @param params a parameter set describing the optimizer module
|
||||||
* @param optimizerExpert set to true if setting the optimizer is an expert option being hidden from the gui
|
* @param optimizerExpert set to true if setting the optimizer is an expert option being hidden from the gui
|
||||||
*/
|
*/
|
||||||
public GenericModuleAdapter(String adapterName, String helperFName, MainAdapterClient Client, InterfaceGOParameters params, boolean optimizerExpert) {
|
public GenericModuleAdapter(String adapterName, String helperFName, InterfaceGOParameters params, boolean optimizerExpert) {
|
||||||
this(adapterName, helperFName, Client, params, optimizerExpert, null);
|
this(adapterName, helperFName, params, optimizerExpert, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,27 +93,17 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
|||||||
ButtonPanel.setHelperFilename(helperFilename);
|
ButtonPanel.setHelperFilename(helperFilename);
|
||||||
frmMkr.addPanelMaker(ButtonPanel);
|
frmMkr.addPanelMaker(ButtonPanel);
|
||||||
InterfaceGOParameters goParams = ((Processor) processor).getGOParams();
|
InterfaceGOParameters goParams = ((Processor) processor).getGOParams();
|
||||||
// TODO do we really need proxies here?
|
|
||||||
if (useRMI && !Proxy.isProxyClass(goParams.getClass())) {
|
|
||||||
frmMkr.addPanelMaker(paramPanel = new JParaPanel(RMIProxyLocal.newInstance(goParams), goParams.getName()));
|
|
||||||
} else {
|
|
||||||
frmMkr.addPanelMaker(paramPanel = new JParaPanel(goParams, goParams.getName()));
|
frmMkr.addPanelMaker(paramPanel = new JParaPanel(goParams, goParams.getName()));
|
||||||
}
|
|
||||||
if (useRMI && !Proxy.isProxyClass(Stat.getClass())) {
|
|
||||||
frmMkr.addPanelMaker(new JParaPanel(RMIProxyLocal.newInstance(Stat), Stat.getName()));
|
|
||||||
} else {
|
|
||||||
frmMkr.addPanelMaker(new JParaPanel(Stat, Stat.getName()));
|
frmMkr.addPanelMaker(new JParaPanel(Stat, Stat.getName()));
|
||||||
}
|
|
||||||
|
|
||||||
jobList = new EvAJobList(new EvAJob[]{});
|
jobList = new EvAJobList(new EvAJob[]{});
|
||||||
jobList.setModule(this);
|
jobList.setModule(this);
|
||||||
jobList.addTextListener((AbstractStatistics) ((Processor) processor).getStatistics());
|
jobList.addTextListener((AbstractStatistics) ((Processor) processor).getStatistics());
|
||||||
|
|
||||||
if (useRMI && !Proxy.isProxyClass(Stat.getClass())) {
|
|
||||||
jobPanel = new JParaPanel(RMIProxyLocal.newInstance(jobList), jobList.getName());
|
|
||||||
} else {
|
|
||||||
jobPanel = new JParaPanel(jobList, jobList.getName());
|
jobPanel = new JParaPanel(jobList, jobList.getName());
|
||||||
}
|
|
||||||
|
|
||||||
frmMkr.addPanelMaker(jobPanel);
|
frmMkr.addPanelMaker(jobPanel);
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the HC module adapter necessary to access this implementation from the EvA top level.
|
* This the HC module adapter necessary to access this implementation from the EvA top level.
|
||||||
*/
|
*/
|
||||||
@ -15,8 +13,8 @@ public class HCModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
public HCModuleAdapter(String adapterName, MainAdapterClient client) {
|
public HCModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "HC.html", client, HCParameters.getInstance(), true);
|
super(adapterName, "HC.html", HCParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the MC module adapter necessary to access this implementation from the EvA top level.
|
* This the MC module adapter necessary to access this implementation from the EvA top level.
|
||||||
*/
|
*/
|
||||||
@ -15,8 +13,8 @@ public class MCModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
|||||||
* @param adapterName The AdapterName
|
* @param adapterName The AdapterName
|
||||||
* @param client The client to serve
|
* @param client The client to serve
|
||||||
*/
|
*/
|
||||||
public MCModuleAdapter(String adapterName, MainAdapterClient client) {
|
public MCModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "MC.html", client, MCParameters.getInstance(), true);
|
super(adapterName, "MC.html", MCParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
@ -12,13 +11,13 @@ public class MOEAModuleAdapter extends GenericModuleAdapter implements Serializa
|
|||||||
private static final String moduleName = "Multi-Objective_Evolutionary_Algorithms";
|
private static final String moduleName = "Multi-Objective_Evolutionary_Algorithms";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the ModuleAdapter
|
* Constructor of the ModuleAdapter.
|
||||||
*
|
*
|
||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
public MOEAModuleAdapter(String adapterName, MainAdapterClient client) {
|
public MOEAModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "MOEA.html", client, MOEAParameters.getInstance(), true);
|
super(adapterName, "MOEA.html", MOEAParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -10,12 +10,12 @@ package eva2.server.modules;
|
|||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
import eva2.gui.EvATabbedFrameMaker;
|
import eva2.gui.EvATabbedFrameMaker;
|
||||||
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.server.stat.EvAJob;
|
import eva2.server.stat.EvAJob;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface ModuleAdapter extends RemoteStateListener {
|
public interface ModuleAdapter extends OptimizationStateListener {
|
||||||
|
|
||||||
EvATabbedFrameMaker getModuleFrame();
|
EvATabbedFrameMaker getModuleFrame();
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public interface ModuleAdapter extends RemoteStateListener {
|
|||||||
*/
|
*/
|
||||||
boolean startPostProcessing();
|
boolean startPostProcessing();
|
||||||
|
|
||||||
void addRemoteStateListener(RemoteStateListener x);
|
void addOptimizationStateListener(OptimizationStateListener x);
|
||||||
|
|
||||||
String getAdapterName();
|
String getAdapterName();
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the PBIL module adapter necessary to access this implementation from the EvA top level.
|
* This the PBIL module adapter necessary to access this implementation from the EvA top level.
|
||||||
@ -15,8 +14,8 @@ public class PBILModuleAdapter extends GenericModuleAdapter implements ModuleAda
|
|||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
public PBILModuleAdapter(String adapterName, MainAdapterClient client) {
|
public PBILModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "PBIL.html", client, PBILParameters.getInstance(), true);
|
super(adapterName, "PBIL.html", PBILParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the PSO module adapter necessary to access this implementation from the EvA top level.
|
* This the PSO module adapter necessary to access this implementation from the EvA top level.
|
||||||
@ -10,13 +9,13 @@ public class PSOModuleAdapter extends GenericModuleAdapter implements ModuleAdap
|
|||||||
private static final String moduleName = "Particle_Swarm_Optimization";
|
private static final String moduleName = "Particle_Swarm_Optimization";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the Moduladapter
|
* Constructor of the ModulAdapter.
|
||||||
*
|
*
|
||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
public PSOModuleAdapter(String adapterName, MainAdapterClient client) {
|
public PSOModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "PSO.html", client, PSOParameters.getInstance(), true);
|
super(adapterName, "PSO.html", PSOParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.gui.BeanInspector;
|
import eva2.gui.BeanInspector;
|
||||||
|
import eva2.optimization.OptimizationStateListener;
|
||||||
import eva2.server.go.*;
|
import eva2.server.go.*;
|
||||||
import eva2.server.go.operators.paramcontrol.ConstantParameters;
|
import eva2.server.go.operators.paramcontrol.ConstantParameters;
|
||||||
import eva2.server.go.operators.paramcontrol.InterfaceParameterControl;
|
import eva2.server.go.operators.paramcontrol.InterfaceParameterControl;
|
||||||
@ -19,7 +20,6 @@ import eva2.server.stat.StatisticsWithGUI;
|
|||||||
import eva2.tools.EVAERROR;
|
import eva2.tools.EVAERROR;
|
||||||
import eva2.tools.EVAHELP;
|
import eva2.tools.EVAHELP;
|
||||||
import eva2.tools.StringTools;
|
import eva2.tools.StringTools;
|
||||||
import eva2.tools.jproxy.RemoteStateListener;
|
|
||||||
import eva2.tools.math.RNG;
|
import eva2.tools.math.RNG;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -28,14 +28,15 @@ import java.util.logging.Logger;
|
|||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Processor may run as a thread permanently (GenericModuleAdapter) and is then stopped and started
|
* The Processor may run as a thread permanently (GenericModuleAdapter) and is
|
||||||
* by a switch in startOpt/stopOpt.
|
* then stopped and started by a switch in startOpt/stopOpt.
|
||||||
*
|
*
|
||||||
* Processor also handles adaptive parameter control by checking for the method getParamControl in (so far)
|
* Processor also handles adaptive parameter control by checking for the method
|
||||||
* Optimizer and Problem instances. The return-value may be InterfaceParameterControl or an array of Objects.
|
* getParamControl in (so far) Optimizer and Problem instances. The return-value
|
||||||
* If it is a control interface, it is applied to the instance that returned it directly. For arrays of objects
|
* may be InterfaceParameterControl or an array of Objects. If it is a control
|
||||||
* each array entry is again handled by checking for getParamControl, thus recursive controllable structures
|
* interface, it is applied to the instance that returned it directly. For
|
||||||
* are possible.
|
* arrays of objects each array entry is again handled by checking for
|
||||||
|
* getParamControl, thus recursive controllable structures are possible.
|
||||||
*
|
*
|
||||||
* @author mkron
|
* @author mkron
|
||||||
*
|
*
|
||||||
@ -48,32 +49,32 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
private InterfaceGOParameters goParams;
|
private InterfaceGOParameters goParams;
|
||||||
private boolean m_createInitialPopulations = true;
|
private boolean m_createInitialPopulations = true;
|
||||||
private boolean saveParams = true;
|
private boolean saveParams = true;
|
||||||
private RemoteStateListener remoteStateListener;
|
private OptimizationStateListener optimizationStateListener;
|
||||||
private boolean wasRestarted = false;
|
private boolean wasRestarted = false;
|
||||||
private int runCounter = 0;
|
private int runCounter = 0;
|
||||||
private Population resPop = null;
|
private Population resPop = null;
|
||||||
private boolean userAborted = false;
|
private boolean userAborted = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addListener(RemoteStateListener module) {
|
public void addListener(OptimizationStateListener module) {
|
||||||
LOGGER.log(
|
LOGGER.log(
|
||||||
Level.FINEST,
|
Level.FINEST,
|
||||||
"Processor: setting module as listener: " + ((module == null)
|
"Processor: setting module as listener: " + ((module == null)
|
||||||
? "null" : module.toString()));
|
? "null" : module.toString()));
|
||||||
|
|
||||||
remoteStateListener = module;
|
optimizationStateListener = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a Processor instance and make statistics instance informable of the parameters,
|
* Construct a Processor instance and make statistics instance informable of
|
||||||
* such they can by dynamically show additional information.
|
* the parameters, such they can by dynamically show additional information.
|
||||||
*
|
*
|
||||||
* @see InterfaceNotifyOnInformers
|
* @see InterfaceNotifyOnInformers
|
||||||
*/
|
*/
|
||||||
public Processor(InterfaceStatistics Stat, ModuleAdapter moduleAdapter, InterfaceGOParameters params) {
|
public Processor(InterfaceStatistics Stat, ModuleAdapter moduleAdapter, InterfaceGOParameters params) {
|
||||||
goParams = params;
|
goParams = params;
|
||||||
m_Statistics = Stat;
|
m_Statistics = Stat;
|
||||||
remoteStateListener = moduleAdapter;
|
optimizationStateListener = moduleAdapter;
|
||||||
|
|
||||||
// the statistics want to be informed if the strategy or the optimizer (which provide statistical data as InterfaceAdditionalInformer) change.
|
// the statistics want to be informed if the strategy or the optimizer (which provide statistical data as InterfaceAdditionalInformer) change.
|
||||||
if (Stat != null && (params != null)) {
|
if (Stat != null && (params != null)) {
|
||||||
@ -118,8 +119,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the optimization was stopped by the user instead of
|
* Return true if the optimization was stopped by the user instead of the
|
||||||
* the termination criterion.
|
* termination criterion.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -195,17 +196,17 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
}
|
}
|
||||||
//m_Statistics.stopOptPerformed(false);
|
//m_Statistics.stopOptPerformed(false);
|
||||||
setOptRunning(false); // normal finish
|
setOptRunning(false); // normal finish
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
remoteStateListener.performedStop(); // is only needed in client server mode
|
optimizationStateListener.performedStop(); // is only needed in client server mode
|
||||||
remoteStateListener.updateProgress(0, errMsg);
|
optimizationStateListener.updateProgress(0, errMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resPop;
|
return resPop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main optimization loop.
|
* Main optimization loop. Return a population containing the solutions of
|
||||||
* Return a population containing the solutions of the last run if there were multiple.
|
* the last run if there were multiple.
|
||||||
*/
|
*/
|
||||||
protected Population optimize(String infoString) {
|
protected Population optimize(String infoString) {
|
||||||
Population resultPop = null;
|
Population resultPop = null;
|
||||||
@ -217,11 +218,11 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
|
|
||||||
RNG.setRandomSeed(goParams.getSeed());
|
RNG.setRandomSeed(goParams.getSeed());
|
||||||
|
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
if (wasRestarted) {
|
if (wasRestarted) {
|
||||||
remoteStateListener.performedRestart(getInfoString());
|
optimizationStateListener.performedRestart(getInfoString());
|
||||||
} else {
|
} else {
|
||||||
remoteStateListener.performedStart(getInfoString());
|
optimizationStateListener.performedStart(getInfoString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,8 +243,8 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
}
|
}
|
||||||
|
|
||||||
//m_Statistics.createNextGenerationPerformed((PopulationInterface)this.m_ModulParameter.getOptimizer().getPopulation());
|
//m_Statistics.createNextGenerationPerformed((PopulationInterface)this.m_ModulParameter.getOptimizer().getPopulation());
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
remoteStateListener.updateProgress(getStatusPercent(goParams.getOptimizer().getPopulation(), runCounter, m_Statistics.getStatisticsParameter().getMultiRuns()), null);
|
optimizationStateListener.updateProgress(getStatusPercent(goParams.getOptimizer().getPopulation(), runCounter, m_Statistics.getStatisticsParameter().getMultiRuns()), null);
|
||||||
}
|
}
|
||||||
if (popLog != null) {
|
if (popLog != null) {
|
||||||
EVAHELP.clearLog(popLog);
|
EVAHELP.clearLog(popLog);
|
||||||
@ -278,11 +279,11 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
|
|
||||||
}
|
}
|
||||||
setOptRunning(false); // normal finish
|
setOptRunning(false); // normal finish
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
remoteStateListener.performedStop(); // is only needed in client server mode
|
optimizationStateListener.performedStop(); // is only needed in client server mode
|
||||||
}
|
}
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
remoteStateListener.updateProgress(0, null);
|
optimizationStateListener.updateProgress(0, null);
|
||||||
}
|
}
|
||||||
goParams.getOptimizer().removePopulationChangedEventListener(this);
|
goParams.getOptimizer().removePopulationChangedEventListener(this);
|
||||||
return resultPop;
|
return resultPop;
|
||||||
@ -331,14 +332,13 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
InterfaceOptimizer optimizer = goParams.getOptimizer();
|
InterfaceOptimizer optimizer = goParams.getOptimizer();
|
||||||
if (terminator instanceof GenerationTerminator) {
|
if (terminator instanceof GenerationTerminator) {
|
||||||
args = new Object[]{optimizer, optimizer.getPopulation(), optimizer.getPopulation().getGeneration(), ((GenerationTerminator) terminator).getGenerations()};
|
args = new Object[]{optimizer, optimizer.getPopulation(), optimizer.getPopulation().getGeneration(), ((GenerationTerminator) terminator).getGenerations()};
|
||||||
} // ((InterfaceParameterControl)paramCtrl).updateParameters(optimizer, optimizer.getPopulation().getGeneration(), ((GenerationTerminator)terminator).getGenerations());
|
}
|
||||||
else if (terminator instanceof EvaluationTerminator) {
|
else if (terminator instanceof EvaluationTerminator) {
|
||||||
args = new Object[]{optimizer, optimizer.getPopulation(), optimizer.getPopulation().getFunctionCalls(), ((EvaluationTerminator) terminator).getFitnessCalls()};
|
args = new Object[]{optimizer, optimizer.getPopulation(), optimizer.getPopulation().getFunctionCalls(), ((EvaluationTerminator) terminator).getFitnessCalls()};
|
||||||
} // ((InterfaceParameterControl)paramCtrl).updateParameters(optimizer, optimizer.getPopulation().getFunctionCalls(), ((EvaluationTerminator)terminator).getFitnessCalls());
|
}
|
||||||
else {
|
else {
|
||||||
args = new Object[]{optimizer};
|
args = new Object[]{optimizer};
|
||||||
}
|
}
|
||||||
// ((InterfaceParameterControl)paramCtrl).updateParameters(optimizer);
|
|
||||||
|
|
||||||
if (args != null) { // only if iteration counting is available
|
if (args != null) { // only if iteration counting is available
|
||||||
iterateParamCtrl(optimizer, "updateParameters", args);
|
iterateParamCtrl(optimizer, "updateParameters", args);
|
||||||
@ -348,8 +348,9 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the percentage of current (multi-)run already performed, based on evaluations/generations
|
* Calculate the percentage of current (multi-)run already performed, based
|
||||||
* for the EvaluationTerminator/GenerationTerminator or multi-runs only.
|
* on evaluations/generations for the
|
||||||
|
* EvaluationTerminator/GenerationTerminator or multi-runs only.
|
||||||
*
|
*
|
||||||
* @param pop
|
* @param pop
|
||||||
* @param currentRun
|
* @param currentRun
|
||||||
@ -374,19 +375,19 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
/**
|
/**
|
||||||
* This method allows an optimizer to register a change in the optimizer.
|
* This method allows an optimizer to register a change in the optimizer.
|
||||||
* Send some information to the statistics module and update the progress.
|
* Send some information to the statistics module and update the progress.
|
||||||
|
*
|
||||||
* @param source The source of the event.
|
* @param source The source of the event.
|
||||||
* @param name Could be used to indicate the nature of the event.
|
* @param name Could be used to indicate the nature of the event.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void registerPopulationStateChanged(Object source, String name) {
|
public void registerPopulationStateChanged(Object source, String name) {
|
||||||
if (name.equals(Population.nextGenerationPerformed)) {
|
if (name.equals(Population.nextGenerationPerformed)) {
|
||||||
// System.out.println(getGOParams().getOptimizer().getPopulation().getFunctionCalls() + " " + getGOParams().getOptimizer().getPopulation().getBestFitness()[0]);
|
|
||||||
m_Statistics.createNextGenerationPerformed(
|
m_Statistics.createNextGenerationPerformed(
|
||||||
(PopulationInterface) this.goParams.getOptimizer().getPopulation(),
|
(PopulationInterface) this.goParams.getOptimizer().getPopulation(),
|
||||||
this.goParams.getOptimizer(),
|
this.goParams.getOptimizer(),
|
||||||
getInformerList());
|
getInformerList());
|
||||||
if (remoteStateListener != null) {
|
if (optimizationStateListener != null) {
|
||||||
remoteStateListener.updateProgress(
|
optimizationStateListener.updateProgress(
|
||||||
getStatusPercent(
|
getStatusPercent(
|
||||||
goParams.getOptimizer().getPopulation(),
|
goParams.getOptimizer().getPopulation(),
|
||||||
runCounter,
|
runCounter,
|
||||||
@ -405,7 +406,9 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
return informerList;
|
return informerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This method writes Data to file.
|
/**
|
||||||
|
* This method writes Data to file.
|
||||||
|
*
|
||||||
* @param line The line that is to be added to the file
|
* @param line The line that is to be added to the file
|
||||||
*/
|
*/
|
||||||
// private void writeToFile(String line) {
|
// private void writeToFile(String line) {
|
||||||
@ -469,8 +472,9 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform a post processing step with given parameters, based on all solutions found by the optimizer.
|
* Perform a post processing step with given parameters, based on all
|
||||||
* Use getResultPopulation() to retrieve results.
|
* solutions found by the optimizer. Use getResultPopulation() to retrieve
|
||||||
|
* results.
|
||||||
*
|
*
|
||||||
* @param ppp
|
* @param ppp
|
||||||
* @param listener
|
* @param listener
|
||||||
@ -487,7 +491,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
|||||||
Population resultPop = (Population) (goParams.getOptimizer().getAllSolutions().getSolutions().clone());
|
Population resultPop = (Population) (goParams.getOptimizer().getAllSolutions().getSolutions().clone());
|
||||||
if (resultPop.getFunctionCalls() != goParams.getOptimizer().getPopulation().getFunctionCalls()) {
|
if (resultPop.getFunctionCalls() != goParams.getOptimizer().getPopulation().getFunctionCalls()) {
|
||||||
// System.err.println("bad case in Processor::performNewPostProcessing ");
|
// System.err.println("bad case in Processor::performNewPostProcessing ");
|
||||||
resultPop.SetFunctionCalls(goParams.getOptimizer().getPopulation().getFunctionCalls());
|
resultPop.setFunctionCalls(goParams.getOptimizer().getPopulation().getFunctionCalls());
|
||||||
}
|
}
|
||||||
// if (!resultPop.contains(m_Statistics.getBestSolution())) {
|
// if (!resultPop.contains(m_Statistics.getBestSolution())) {
|
||||||
// resultPop.add(m_Statistics.getBestSolution());
|
// resultPop.add(m_Statistics.getBestSolution());
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the SA module adapter necessary to access this implementation from the EvA top level.
|
* This the SA module adapter necessary to access this implementation from the
|
||||||
|
* EvA top level.
|
||||||
*/
|
*/
|
||||||
public class SAModuleAdapter extends GenericModuleAdapter implements ModuleAdapter {
|
public class SAModuleAdapter extends GenericModuleAdapter implements ModuleAdapter {
|
||||||
|
|
||||||
private static final String moduleName = "Simulated_Annealing";
|
private static final String moduleName = "Simulated_Annealing";
|
||||||
|
|
||||||
/** Constructor of the Moduladapter
|
/**
|
||||||
|
* Constructor of the ModulAdapter.
|
||||||
|
*
|
||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
|
public SAModuleAdapter(String adapterName) {
|
||||||
public SAModuleAdapter(String adapterName, MainAdapterClient client) {
|
super(adapterName, "SA.html", SAParameters.getInstance(), true);
|
||||||
super (adapterName, "SA.html", client, SAParameters.getInstance(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method returns the name of the ModulAdapter
|
* This method returns the name of the ModulAdapter
|
||||||
|
*
|
||||||
* @return The name
|
* @return The name
|
||||||
*/
|
*/
|
||||||
public static String getName() {
|
public static String getName() {
|
||||||
|
@ -1,22 +1,21 @@
|
|||||||
package eva2.server.modules;
|
package eva2.server.modules;
|
||||||
|
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This the SSGA module adapter necessary to access this implementation from the EvA top level.
|
* This the SSGA module adapter necessary to access this implementation from the
|
||||||
|
* EvA top level.
|
||||||
*/
|
*/
|
||||||
public class SSGAModuleAdapter extends GenericModuleAdapter implements ModuleAdapter {
|
public class SSGAModuleAdapter extends GenericModuleAdapter implements ModuleAdapter {
|
||||||
|
|
||||||
private static final String moduleName = "Steady_State_Genetic_Algorithm";
|
private static final String moduleName = "Steady_State_Genetic_Algorithm";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor of the ModuleAdapter
|
* Constructor of the ModuleAdapter.
|
||||||
*
|
*
|
||||||
* @param AdapterName The AdapterName
|
* @param AdapterName The AdapterName
|
||||||
* @param Client The client to serve
|
* @param Client The client to serve
|
||||||
*/
|
*/
|
||||||
public SSGAModuleAdapter(String adapterName, MainAdapterClient client) {
|
public SSGAModuleAdapter(String adapterName) {
|
||||||
super(adapterName, "SSGA.html", client, SSGAParameters.getInstance(), true);
|
super(adapterName, "SSGA.html", SSGAParameters.getInstance(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,13 +9,9 @@ package eva2.server.stat;
|
|||||||
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
|
* $Date: 2007-12-06 16:05:11 +0100 (Thu, 06 Dec 2007) $
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
import eva2.gui.DataViewer;
|
import eva2.gui.DataViewer;
|
||||||
import eva2.gui.DataViewerInterface;
|
import eva2.gui.DataViewerInterface;
|
||||||
import eva2.gui.Graph;
|
import eva2.gui.Graph;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@ -33,14 +29,6 @@ public class GenericStatistics implements Serializable {
|
|||||||
private transient Field[] fields;
|
private transient Field[] fields;
|
||||||
private DataViewerInterface viewer;
|
private DataViewerInterface viewer;
|
||||||
private Graph graph;
|
private Graph graph;
|
||||||
private static MainAdapterClient mainAdapterClient;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public static void setMainAdapterClient(MainAdapterClient adapter) {
|
|
||||||
mainAdapterClient = adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -131,7 +119,7 @@ public class GenericStatistics implements Serializable {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public void initViewer() {
|
public void initViewer() {
|
||||||
viewer = DataViewer.getInstance(mainAdapterClient, "test");
|
viewer = DataViewer.getInstance("test");
|
||||||
graph = viewer.getNewGraph("test");
|
graph = viewer.getNewGraph("test");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,6 @@ package eva2.server.stat;
|
|||||||
* $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007) $
|
* $Date: 2007-12-11 17:24:07 +0100 (Tue, 11 Dec 2007) $
|
||||||
* $Author: mkron $
|
* $Author: mkron $
|
||||||
*/
|
*/
|
||||||
/*==========================================================================*
|
|
||||||
* IMPORTS
|
|
||||||
*==========================================================================*/
|
|
||||||
import eva2.gui.BeanInspector;
|
import eva2.gui.BeanInspector;
|
||||||
import eva2.gui.Graph;
|
import eva2.gui.Graph;
|
||||||
import eva2.gui.GraphWindow;
|
import eva2.gui.GraphWindow;
|
||||||
@ -24,9 +21,6 @@ import eva2.server.go.PopulationInterface;
|
|||||||
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
import eva2.server.go.problems.InterfaceAdditionalPopulationInformer;
|
||||||
import eva2.tools.EVAERROR;
|
import eva2.tools.EVAERROR;
|
||||||
import eva2.tools.Pair;
|
import eva2.tools.Pair;
|
||||||
import eva2.tools.jproxy.MainAdapterClient;
|
|
||||||
import eva2.tools.jproxy.RMIProxyLocal;
|
|
||||||
import eva2.tools.jproxy.RMIProxyRemote;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -35,10 +29,10 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A statistics class to plot fitness curves in client-server mode. Mainly, arrays of GraphWindows
|
* A statistics class to plot fitness curves in client-server mode. Mainly,
|
||||||
* and Graphs are managed and the selected data fields are plotted.
|
* arrays of GraphWindows and Graphs are managed and the selected data fields
|
||||||
* TODO: this could finally be cleanly reduced to an InterfaceStatisticsListener - without inheriting
|
* are plotted. TODO: this could finally be cleanly reduced to an
|
||||||
* from AbstractStatistics.
|
* InterfaceStatisticsListener - without inheriting from AbstractStatistics.
|
||||||
*/
|
*/
|
||||||
public class StatisticsWithGUI extends AbstractStatistics implements Serializable, InterfaceStatistics {
|
public class StatisticsWithGUI extends AbstractStatistics implements Serializable, InterfaceStatistics {
|
||||||
|
|
||||||
@ -50,7 +44,6 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
private Graph[][] statGraph;
|
private Graph[][] statGraph;
|
||||||
private String graphInfoString;
|
private String graphInfoString;
|
||||||
protected int plotCounter;
|
protected int plotCounter;
|
||||||
private MainAdapterClient mainAdapterClient; // the connection to the client MainAdapter
|
|
||||||
private JTextoutputFrameInterface proxyPrinter;
|
private JTextoutputFrameInterface proxyPrinter;
|
||||||
/*
|
/*
|
||||||
* List of descriptor strings and optional indices. strictly its redundant
|
* List of descriptor strings and optional indices. strictly its redundant
|
||||||
@ -63,35 +56,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public MainAdapterClient getMainAdapterClient() {
|
public StatisticsWithGUI() {
|
||||||
return mainAdapterClient;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public StatisticsWithGUI(MainAdapterClient client) {
|
|
||||||
mainAdapterClient = client;
|
|
||||||
if (client != null) { // We are probably in rmi mode
|
|
||||||
try {
|
|
||||||
hostName = InetAddress.getLocalHost().getHostName();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
LOGGER.log(Level.WARNING, "Could not retrieve hostname.", ex);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hostName = "localhost";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ((client == null) || client.getHostName().equals(hostName)) {
|
|
||||||
m_StatsParams = StatisticsParameter.getInstance(true);
|
m_StatsParams = StatisticsParameter.getInstance(true);
|
||||||
proxyPrinter = new JTextoutputFrame("TextOutput of " + hostName);
|
proxyPrinter = new JTextoutputFrame("TextOutput of " + hostName);
|
||||||
} else { // we use RMI
|
|
||||||
m_StatsParams = (InterfaceStatisticsParameter) RMIProxyLocal.newInstance(
|
|
||||||
StatisticsParameter.getInstance(true));
|
|
||||||
proxyPrinter = (JTextoutputFrameInterface) RMIProxyRemote.newInstance(new JTextoutputFrame("TextOutput " + hostName),
|
|
||||||
mainAdapterClient);
|
|
||||||
}
|
|
||||||
addTextListener(proxyPrinter);
|
addTextListener(proxyPrinter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,10 +137,9 @@ public class StatisticsWithGUI extends AbstractStatistics implements Serializabl
|
|||||||
maybeShowProxyPrinter();
|
maybeShowProxyPrinter();
|
||||||
int windowCount = 1; // TODO this was earlier description.length for the 2-D String-Array returned by m_StatsParams.getPlotDescriptions, which however always returned an array of length 1 (in the first dim).
|
int windowCount = 1; // TODO this was earlier description.length for the 2-D String-Array returned by m_StatsParams.getPlotDescriptions, which however always returned an array of length 1 (in the first dim).
|
||||||
int graphCount = graphDesc.size();
|
int graphCount = graphDesc.size();
|
||||||
// System.out.println("Initializing " + graphCount + " plots (StatisticsWithGUI)");
|
|
||||||
fitnessFrame = new GraphWindow[windowCount];
|
fitnessFrame = new GraphWindow[windowCount];
|
||||||
for (int i = 0; i < fitnessFrame.length; i++) {
|
for (int i = 0; i < fitnessFrame.length; i++) {
|
||||||
fitnessFrame[i] = GraphWindow.getInstance(mainAdapterClient, "Optimization " + i + " " + " on " + hostName, "function calls", "fitness");
|
fitnessFrame[i] = GraphWindow.getInstance("Optimization " + i, "function calls", "fitness");
|
||||||
}
|
}
|
||||||
|
|
||||||
fitnessGraph = new Graph[windowCount][];
|
fitnessGraph = new Graph[windowCount][];
|
||||||
|
@ -1,70 +0,0 @@
|
|||||||
package eva2.tools;
|
|
||||||
|
|
||||||
import eva2.server.EvAMainAdapter;
|
|
||||||
import eva2.server.EvAMainAdapterImpl;
|
|
||||||
import eva2.tools.jproxy.RMIInvocationHandler;
|
|
||||||
import java.rmi.Naming;
|
|
||||||
import java.util.StringTokenizer;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Title: EvA2</p>
|
|
||||||
* <p>Description: </p>
|
|
||||||
* <p>Copyright: Copyright (c) 2003</p>
|
|
||||||
* <p>Company: </p>
|
|
||||||
* @author planatsc
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class ServerPingThread extends Thread {
|
|
||||||
|
|
||||||
boolean isServerAlive;
|
|
||||||
String hostname;
|
|
||||||
|
|
||||||
public ServerPingThread(String hostname) {
|
|
||||||
this.isServerAlive = false;
|
|
||||||
this.hostname = hostname;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
isServerAlive = rmiPing(hostname);
|
|
||||||
this.sleep(3000);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
System.out.println(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean rmiPing(String testurl) {
|
|
||||||
EvAMainAdapter Test = null;
|
|
||||||
String SEP = "_";
|
|
||||||
int len = testurl.indexOf(SEP);
|
|
||||||
String Host = testurl;
|
|
||||||
String Number = "_0";
|
|
||||||
if (len != -1) {
|
|
||||||
StringTokenizer st = new StringTokenizer(testurl, SEP);
|
|
||||||
Host = st.nextToken().trim();
|
|
||||||
Number = SEP + st.nextToken().trim();
|
|
||||||
}
|
|
||||||
String UserName = System.getProperty("user.name");
|
|
||||||
String MainAdapterName = UserName + EvAMainAdapterImpl.MAIN_ADAPTER_NAME + Number;
|
|
||||||
try {
|
|
||||||
RMIInvocationHandler x = (RMIInvocationHandler) Naming.lookup("rmi://" + Host + ":" + EvAMainAdapterImpl.PORT + "/" + MainAdapterName); // attention !!
|
|
||||||
Test = (EvAMainAdapter) x.getWrapper();
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public boolean isServerAlive() {
|
|
||||||
return isServerAlive;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user