Additions to bugfix of StringSelection (stats not being informed of GOParameters beforehand)
This commit is contained in:
parent
0d2fe54df1
commit
30080dcd8f
@ -88,10 +88,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
public OptimizerRunnable(GOParameters params, InterfaceStatistics stats, boolean restart) {
|
||||
rnblID = cntID;
|
||||
cntID++;
|
||||
if (stats.getStatisticsParameter() instanceof InterfaceNotifyOnInformers) {
|
||||
// addition for the statistics revision with selectable strings - make sure the go parameters are represented within the statistics
|
||||
params.addInformableInstance((InterfaceNotifyOnInformers)(stats.getStatisticsParameter()));
|
||||
}
|
||||
|
||||
proc = new Processor(stats, null, params);
|
||||
if (proc.getStatistics() instanceof AbstractStatistics) ((AbstractStatistics)proc.getStatistics()).setSaveParams(false);
|
||||
doRestart = restart;
|
||||
@ -126,10 +123,6 @@ public class OptimizerRunnable implements Runnable {
|
||||
InterfaceGOParameters params = proc.getGOParams();
|
||||
proc = new Processor(stats, null, params);
|
||||
if (proc.getStatistics() instanceof AbstractStatistics) ((AbstractStatistics)proc.getStatistics()).setSaveParams(false);
|
||||
if (stats.getStatisticsParameter() instanceof InterfaceNotifyOnInformers) {
|
||||
// addition for the statistics revision with selectable strings - make sure the go parameters are represented within the statistics
|
||||
params.addInformableInstance((InterfaceNotifyOnInformers)(stats.getStatisticsParameter()));
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextListener(InterfaceTextListener lsnr) {
|
||||
|
@ -49,8 +49,9 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
||||
m_Processor = new Processor(m_StatisticsModul,this, params);
|
||||
|
||||
// the statistics want to be informed if the strategy or the optimizer (which provide statistical data as InterfaceAdditionalInformer) change.
|
||||
if (m_StatisticsModul.getStatisticsParameter() instanceof InterfaceNotifyOnInformers)
|
||||
params.addInformableInstance((InterfaceNotifyOnInformers)m_StatisticsModul.getStatisticsParameter());
|
||||
// THIS is now done directly in the constructor of a Processor
|
||||
// if (m_StatisticsModul.getStatisticsParameter() instanceof InterfaceNotifyOnInformers)
|
||||
// params.addInformableInstance((InterfaceNotifyOnInformers)m_StatisticsModul.getStatisticsParameter());
|
||||
// this prevents the optimizer property to be shown by the GOE if optimizerExpert is true
|
||||
GenericObjectEditor.setExpertProperty(params.getClass(), "optimizer", optimizerExpert);
|
||||
|
||||
|
@ -6,13 +6,13 @@ import javax.swing.JOptionPane;
|
||||
|
||||
import eva2.gui.BeanInspector;
|
||||
import eva2.server.go.InterfaceGOParameters;
|
||||
import eva2.server.go.InterfaceNotifyOnInformers;
|
||||
import eva2.server.go.InterfacePopulationChangedEventListener;
|
||||
import eva2.server.go.InterfaceProcessor;
|
||||
import eva2.server.go.InterfaceTerminator;
|
||||
import eva2.server.go.PopulationInterface;
|
||||
import eva2.server.go.operators.paramcontrol.ConstantParameters;
|
||||
import eva2.server.go.operators.paramcontrol.InterfaceParameterControl;
|
||||
import eva2.server.go.operators.paramcontrol.ParamAdaption;
|
||||
import eva2.server.go.operators.postprocess.PostProcess;
|
||||
import eva2.server.go.operators.postprocess.PostProcessParams;
|
||||
import eva2.server.go.operators.terminators.EvaluationTerminator;
|
||||
@ -26,7 +26,6 @@ import eva2.server.stat.InterfaceTextListener;
|
||||
import eva2.server.stat.StatisticsWithGUI;
|
||||
import eva2.tools.EVAERROR;
|
||||
import eva2.tools.EVAHELP;
|
||||
import eva2.tools.Pair;
|
||||
import eva2.tools.StringTools;
|
||||
import eva2.tools.jproxy.RemoteStateListener;
|
||||
import eva2.tools.math.RNG;
|
||||
@ -69,18 +68,23 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a Processor instance and make statistics instance informable of the parameters,
|
||||
* such they can by dynamically show additional information.
|
||||
*
|
||||
* @see InterfaceNotifyOnInformers
|
||||
*/
|
||||
public Processor(InterfaceStatistics Stat, ModuleAdapter Adapter, InterfaceGOParameters params) {
|
||||
goParams = params;
|
||||
m_Statistics = Stat;
|
||||
m_ListenerModule = Adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Processor(InterfaceStatistics Stat) {
|
||||
m_Statistics = Stat;
|
||||
|
||||
// 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.getStatisticsParameter() instanceof InterfaceNotifyOnInformers) {
|
||||
// addition for the statistics revision with selectable strings - make sure the go parameters are represented within the statistics
|
||||
params.addInformableInstance((InterfaceNotifyOnInformers)(Stat.getStatisticsParameter()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOptRunning() {
|
||||
|
@ -64,7 +64,9 @@ public class Serializer {
|
||||
FileInputStream file = new FileInputStream(f);
|
||||
ObjectInputStream in = new ObjectInputStream(file);
|
||||
Object ret = in.readObject();
|
||||
if (ret instanceof SerializedObject) ret = ((SerializedObject)ret).getObject();
|
||||
if (ret instanceof SerializedObject) {
|
||||
ret = ((SerializedObject)ret).getObject();
|
||||
}
|
||||
in.close();
|
||||
file.close();
|
||||
return ret;
|
||||
@ -210,6 +212,9 @@ public class Serializer {
|
||||
} catch (InvalidClassException e) {
|
||||
System.err.println("WARNING: loading object File "+Filename+ " not possible, this may happen on source code changes.");
|
||||
System.err.println(e.getMessage());
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.err.println("ClassNotFoundException on loading object File " + Filename + ". This may happen on refactorings.");
|
||||
System.err.println(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("WARNING: loading object File "+Filename+ " not possible! ("+e.getMessage()+")");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user