More cleanup.
This commit is contained in:
parent
2cd764776a
commit
75211cb769
@ -107,7 +107,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
}
|
||||
|
||||
public InterfaceOptimizationParameters getGOParams() {
|
||||
return proc.getGOParams();
|
||||
return proc.getOptimizationParameterss();
|
||||
}
|
||||
|
||||
public InterfaceStatistics getStats() {
|
||||
@ -118,7 +118,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
if (proc.isOptimizationRunning()) {
|
||||
throw new RuntimeException("Error - cannot change statistics instance during optimization.");
|
||||
}
|
||||
InterfaceOptimizationParameters params = proc.getGOParams();
|
||||
InterfaceOptimizationParameters params = proc.getOptimizationParameterss();
|
||||
proc = new Processor(stats, null, params);
|
||||
if (proc.getStatistics() instanceof AbstractStatistics) {
|
||||
((AbstractStatistics) proc.getStatistics()).setSaveParams(false);
|
||||
@ -149,7 +149,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
try {
|
||||
proc.setSaveParams(false);
|
||||
if (postProcessOnly) {
|
||||
proc.performPostProcessing((PostProcessParams) proc.getGOParams().getPostProcessParams(), listener);
|
||||
proc.performPostProcessing((PostProcessParams) proc.getOptimizationParameterss().getPostProcessParams(), listener);
|
||||
} else {
|
||||
if (doRestart) {
|
||||
proc.restartOptimization();
|
||||
@ -199,15 +199,15 @@ public class OptimizerRunnable implements Runnable {
|
||||
}
|
||||
|
||||
public SolutionSet getSolutionSet() {
|
||||
return (SolutionSet) proc.getGOParams().getOptimizer().getAllSolutions();
|
||||
return (SolutionSet) proc.getOptimizationParameterss().getOptimizer().getAllSolutions();
|
||||
}
|
||||
|
||||
public void setPostProcessingParams(InterfacePostProcessParams ppp) {
|
||||
proc.getGOParams().setPostProcessParams(ppp);
|
||||
proc.getOptimizationParameterss().setPostProcessParams(ppp);
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return proc.getGOParams().getOptimizer().getPopulation().getFunctionCalls();
|
||||
return proc.getOptimizationParameterss().getOptimizer().getPopulation().getFunctionCalls();
|
||||
}
|
||||
|
||||
public String terminatedBecause() {
|
||||
@ -215,7 +215,7 @@ public class OptimizerRunnable implements Runnable {
|
||||
if (postProcessOnly) {
|
||||
return "Post processing finished";
|
||||
} else {
|
||||
InterfaceTerminator term = proc.getGOParams().getTerminator();
|
||||
InterfaceTerminator term = proc.getOptimizationParameterss().getTerminator();
|
||||
return term.lastTerminationMessage();
|
||||
}
|
||||
} else {
|
||||
|
@ -37,11 +37,12 @@ public class EvAModuleButtonPanelMaker implements OptimizationStateListener, Ser
|
||||
name = "GENERAL";
|
||||
runningState = state;
|
||||
moduleAdapter = adapter;
|
||||
|
||||
toolBar = new JToolBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JToolBar makePanel() {
|
||||
toolBar = new JToolBar();
|
||||
toolBar.setFloatable(false);
|
||||
|
||||
moduleAdapter.addOptimizationStateListener(this);
|
||||
|
@ -791,7 +791,6 @@ public class Main extends JFrame implements OptimizationStateListener {
|
||||
ReflectPackage.resetDynCP();
|
||||
comAdapter.updateLocalMainAdapter();
|
||||
loadSpecificModule(selectedModule, optimizationParameters); // end recursive call! handle with care!
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
newModuleAdapter.addOptimizationStateListener(this);
|
||||
|
@ -297,8 +297,8 @@ public class ESIndividualBinaryData extends AbstractEAIndividual implements Inte
|
||||
|
||||
@Override
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
|
||||
ESIndividualDoubleData.defaultInit(genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange());
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitializationRange() != null)) {
|
||||
ESIndividualDoubleData.defaultInit(genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitializationRange());
|
||||
} else {
|
||||
ESIndividualDoubleData.defaultInit(genotype, initializationRange);
|
||||
}
|
||||
|
@ -374,8 +374,8 @@ public class ESIndividualDoubleData extends AbstractEAIndividual implements Inte
|
||||
|
||||
@Override
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
|
||||
ESIndividualDoubleData.defaultInit(genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitRange());
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitializationRange() != null)) {
|
||||
ESIndividualDoubleData.defaultInit(genotype, (double[][]) ((InterfaceHasInitRange) prob).getInitializationRange());
|
||||
} else {
|
||||
ESIndividualDoubleData.defaultInit(genotype, range);
|
||||
}
|
||||
|
@ -335,8 +335,8 @@ public class ESIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
@Override
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
int[][] range = this.range;
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
|
||||
range = (int[][]) ((InterfaceHasInitRange) prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitializationRange() != null)) {
|
||||
range = (int[][]) ((InterfaceHasInitRange) prob).getInitializationRange();
|
||||
}
|
||||
for (int i = 0; i < this.genotype.length; i++) {
|
||||
this.genotype[i] = RNG.randomInt(range[i][0], range[i][1]);
|
||||
|
@ -370,8 +370,8 @@ public class ESIndividualPermutationData extends AbstractEAIndividual implements
|
||||
@Override
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
double[][][] range = initializationRange;
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
|
||||
range = (double[][][]) ((InterfaceHasInitRange) prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitializationRange() != null)) {
|
||||
range = (double[][][]) ((InterfaceHasInitRange) prob).getInitializationRange();
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.genotype.length; i++) {
|
||||
|
@ -328,8 +328,8 @@ public class GIIndividualIntegerData extends AbstractEAIndividual implements Int
|
||||
@Override
|
||||
public void defaultInit(InterfaceOptimizationProblem prob) {
|
||||
int[][] range = initializationRange;
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitRange() != null)) {
|
||||
Object rng = ((InterfaceHasInitRange) prob).getInitRange();
|
||||
if ((prob != null) && (prob instanceof InterfaceHasInitRange) && (((InterfaceHasInitRange) prob).getInitializationRange() != null)) {
|
||||
Object rng = ((InterfaceHasInitRange) prob).getInitializationRange();
|
||||
if (rng instanceof double[][]) {
|
||||
double[][] dblRng = (double[][]) rng;
|
||||
range = new int[dblRng.length][dblRng[0].length];
|
||||
|
@ -60,7 +60,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
||||
*/
|
||||
@Override
|
||||
public boolean hasPostProcessing() {
|
||||
return ((processor instanceof Processor) && ((Processor) processor).getGOParams().getPostProcessParams().isDoPostProcessing());
|
||||
return ((processor instanceof Processor) && ((Processor) processor).getOptimizationParameterss().getPostProcessParams().isDoPostProcessing());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
||||
*/
|
||||
@Override
|
||||
public boolean startPostProcessing() {
|
||||
if (hasPostProcessing() && ((Processor) processor).getGOParams().getPostProcessParams().isDoPostProcessing()) {
|
||||
if (hasPostProcessing() && ((Processor) processor).getOptimizationParameterss().getPostProcessParams().isDoPostProcessing()) {
|
||||
((Processor) processor).performPostProcessing();
|
||||
return true;
|
||||
} else {
|
||||
@ -80,7 +80,7 @@ abstract public class AbstractModuleAdapter implements ModuleAdapter, Serializab
|
||||
|
||||
public InterfaceOptimizationParameters getOptimizationParameters() {
|
||||
if ((processor != null) && (processor instanceof Processor)) {
|
||||
return ((Processor) processor).getGOParams();
|
||||
return ((Processor) processor).getOptimizationParameterss();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -38,14 +38,4 @@ public class GOModuleAdapter extends GenericModuleAdapter implements ModuleAdapt
|
||||
public GOModuleAdapter(String adapterName, InterfaceOptimizationParameters goParams, String noGuiLogFile) {
|
||||
super(adapterName, "", goParams, false, noGuiLogFile);
|
||||
}
|
||||
// /**
|
||||
// * Starts a statistics GUI and the GOProcessor thread with a given OptimizationParameters file.
|
||||
// *
|
||||
// * @param AdapterName the title of the ModulAdapter
|
||||
// * @param Client the client instance
|
||||
// */
|
||||
// public GOModuleAdapter(String adapterName, String serParamsFile, String noGuiLogFile, MainAdapterClient client) {
|
||||
// //super(adapterName, "", client, OptimizationParameters.getInstance(serParamsFile, false), false);
|
||||
// super(adapterName, "", client, OptimizationParameters.getInstance(serParamsFile, serParamsFile==null), false, noGuiLogFile);
|
||||
// }
|
||||
}
|
@ -78,18 +78,18 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
||||
@Override
|
||||
public EvATabbedFrameMaker getModuleFrame() {
|
||||
if (!(statisticsModule instanceof StatisticsWithGUI)) {
|
||||
System.err.println("Error: Unable to create Frame when startet with noGUI option (GenericModuleAdapter)!");
|
||||
System.err.println("Error: Unable to create Frame when started with noGUI option (GenericModuleAdapter)!");
|
||||
return null;
|
||||
}
|
||||
EvATabbedFrameMaker frmMkr = new EvATabbedFrameMaker();
|
||||
|
||||
InterfaceStatisticsParameter Stat = statisticsModule.getStatisticsParameter();
|
||||
EvAModuleButtonPanelMaker ButtonPanel = new EvAModuleButtonPanelMaker(remoteModuleAdapter, ((Processor) processor).isOptimizationRunning());
|
||||
ButtonPanel.setHelperFilename(helperFilename);
|
||||
frmMkr.addPanelMaker(ButtonPanel);
|
||||
InterfaceOptimizationParameters goParams = ((Processor) processor).getGOParams();
|
||||
EvAModuleButtonPanelMaker buttonPanel = new EvAModuleButtonPanelMaker(remoteModuleAdapter, ((Processor) processor).isOptimizationRunning());
|
||||
buttonPanel.setHelperFilename(helperFilename);
|
||||
frmMkr.addPanelMaker(buttonPanel);
|
||||
InterfaceOptimizationParameters optimizationParameters = ((Processor) processor).getOptimizationParameterss();
|
||||
|
||||
frmMkr.addPanelMaker(paramPanel = new JParaPanel(goParams, goParams.getName()));
|
||||
frmMkr.addPanelMaker(paramPanel = new JParaPanel(optimizationParameters, optimizationParameters.getName()));
|
||||
|
||||
frmMkr.addPanelMaker(new JParaPanel(Stat, Stat.getName()));
|
||||
|
||||
@ -102,7 +102,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
||||
|
||||
frmMkr.addPanelMaker(jobPanel);
|
||||
|
||||
((Processor) processor).getGOParams().addInformableInstance(frmMkr);
|
||||
((Processor) processor).getOptimizationParameterss().addInformableInstance(frmMkr);
|
||||
return frmMkr;
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public class GenericModuleAdapter extends AbstractModuleAdapter implements Seria
|
||||
|
||||
@Override
|
||||
public OptimizationJob scheduleJob() {
|
||||
OptimizationJob job = jobList.addJob(((Processor) processor).getGOParams(), (AbstractStatistics) (((Processor) processor).getStatistics()));
|
||||
OptimizationJob job = jobList.addJob(((Processor) processor).getOptimizationParameterss(), (AbstractStatistics) (((Processor) processor).getStatistics()));
|
||||
jobPanel.getEditor().setValue(jobList);
|
||||
return job;
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package eva2.optimization.modules;
|
||||
import eva2.optimization.go.InterfaceOptimizationParameters;
|
||||
import eva2.optimization.operator.terminators.EvaluationTerminator;
|
||||
import eva2.optimization.operator.terminators.InterfaceTerminator;
|
||||
import eva2.optimization.strategies.DifferentialEvolution;
|
||||
import eva2.problems.F1Problem;
|
||||
import eva2.problems.InterfaceOptimizationProblem;
|
||||
import eva2.optimization.strategies.GeneticAlgorithm;
|
||||
@ -34,7 +35,7 @@ public class OptimizationParameters extends AbstractOptimizationParameters imple
|
||||
* @return
|
||||
*/
|
||||
public static OptimizationParameters getInstance() {
|
||||
return getInstance("OptimizationParameters.set", true);
|
||||
return getInstance("OptimizationParameters.ser", true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,7 +61,7 @@ public class OptimizationParameters extends AbstractOptimizationParameters imple
|
||||
}
|
||||
|
||||
public OptimizationParameters() {
|
||||
super(new GeneticAlgorithm(), new F1Problem(), new EvaluationTerminator(1000));
|
||||
super(new DifferentialEvolution(), new F1Problem(), new EvaluationTerminator(5000));
|
||||
}
|
||||
|
||||
public OptimizationParameters(InterfaceOptimizer opt, InterfaceOptimizationProblem prob, InterfaceTerminator term) {
|
||||
|
@ -423,7 +423,7 @@ public class Processor extends Thread implements InterfaceProcessor, InterfacePo
|
||||
/**
|
||||
* These methods allow you to get and set the Module Parameters.
|
||||
*/
|
||||
public InterfaceOptimizationParameters getGOParams() {
|
||||
public InterfaceOptimizationParameters getOptimizationParameterss() {
|
||||
return optimizationParameters;
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,4 @@
|
||||
package eva2.optimization.population;
|
||||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
import eva2.optimization.individuals.IndividualInterface;
|
||||
|
||||
|
@ -113,7 +113,6 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
@Override
|
||||
public void initialize() {
|
||||
this.optimizationProblem.initializePopulation(this.population);
|
||||
// children = new Population(population.size());
|
||||
this.evaluatePopulation(this.population);
|
||||
this.firePropertyChangedEvent(Population.NEXT_GENERATION_PERFORMED);
|
||||
}
|
||||
@ -754,11 +753,11 @@ public class DifferentialEvolution implements InterfaceOptimizer, java.io.Serial
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return "DE";
|
||||
return "Differential Evolution";
|
||||
}
|
||||
|
||||
/**
|
||||
* Assuming that all optimizer will store their data in a population we will
|
||||
* Assuming that all optimizers will store their data in a population we will
|
||||
* allow access to this population to query to current state of the
|
||||
* optimizer.
|
||||
*
|
||||
|
@ -202,7 +202,7 @@ public class Tribes implements InterfaceOptimizer, java.io.Serializable {
|
||||
optimizationProblem = (AbstractOptimizationProblem) problem;
|
||||
range = null;
|
||||
if (problem instanceof InterfaceHasInitRange) {
|
||||
initRange = (double[][]) ((InterfaceHasInitRange) problem).getInitRange();
|
||||
initRange = (double[][]) ((InterfaceHasInitRange) problem).getInitializationRange();
|
||||
}
|
||||
Population pop = new Population(1);
|
||||
problem.initializePopulation(pop);
|
||||
|
@ -465,7 +465,7 @@ public class ExternalRuntimeProblem extends AbstractOptimizationProblem
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public Object getInitRange() {
|
||||
public Object getInitializationRange() {
|
||||
if (initializationRange == null) {
|
||||
if (range == null) {
|
||||
System.err.println("Warning, neither range nor initRange has been set in ExternalRuntimeProblem!");
|
||||
|
@ -106,7 +106,7 @@ public class F1Problem extends AbstractProblemDoubleOffset implements Interface2
|
||||
* If initialRangeRatio<1, produce a reduced initial range in the negative corner of the range.
|
||||
*/
|
||||
@Override
|
||||
public Object getInitRange() {
|
||||
public Object getInitializationRange() {
|
||||
if (initialRangeRatio < 1.) {
|
||||
double[][] gR = makeRange();
|
||||
double[][] initR = makeRange();
|
||||
|
@ -16,5 +16,5 @@ public interface InterfaceHasInitRange {
|
||||
*
|
||||
* @return An initial search range or null in case it is equal to the global search range.
|
||||
*/
|
||||
public Object getInitRange();
|
||||
public Object getInitializationRange();
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ public class MatlabProblem extends AbstractOptimizationProblem implements Interf
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInitRange() {
|
||||
public Object getInitializationRange() {
|
||||
log("retrieving initial range..., first entry: " + ((initialRange == null) ? "null" : BeanInspector.toString(initialRange[0])));
|
||||
return initialRange;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user