Merging mk branch rev 130.
This commit is contained in:
parent
99e5ca1450
commit
18b63d9d97
@ -16,9 +16,11 @@ import eva2.server.go.populations.Population;
|
||||
import eva2.server.modules.GOParameters;
|
||||
import eva2.server.modules.Processor;
|
||||
import eva2.server.stat.AbstractStatistics;
|
||||
import eva2.server.stat.InterfaceStatistics;
|
||||
import eva2.server.stat.StatisticsDummy;
|
||||
import eva2.server.stat.InterfaceTextListener;
|
||||
import eva2.server.stat.StatisticsStandalone;
|
||||
import eva2.server.stat.StatsParameter;
|
||||
|
||||
|
||||
/**
|
||||
@ -77,6 +79,10 @@ public class OptimizerRunnable implements Runnable {
|
||||
return proc.getGOParams();
|
||||
}
|
||||
|
||||
public InterfaceStatistics getStats() {
|
||||
return proc.getStatistics();
|
||||
}
|
||||
|
||||
public void setTextListener(InterfaceTextListener lsnr) {
|
||||
proc.getStatistics().removeTextListener(listener);
|
||||
this.listener = lsnr;
|
||||
@ -175,7 +181,9 @@ public class OptimizerRunnable implements Runnable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the verbosity level in the statistics module to the given value. See StatsParameter.
|
||||
* Set the verbosity level in the statistics module to the given value.
|
||||
*
|
||||
* @see StatsParameter
|
||||
* @param vLev
|
||||
*/
|
||||
public void setVerbosityLevel(int vLev) {
|
||||
@ -183,4 +191,35 @@ public class OptimizerRunnable implements Runnable {
|
||||
proc.getStatistics().getStatisticsParameter().getOutputVerbosity().setSelectedTag(vLev);
|
||||
} else System.err.println("Invalid verbosity leveln in OptimizerRunnable.setVerbosityLevel!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output direction in the statistics module.
|
||||
*
|
||||
* @see StatsParameter
|
||||
* @param outp
|
||||
*/
|
||||
public void setOutputTo(int outp) {
|
||||
((StatsParameter)proc.getStatistics().getStatisticsParameter()).setOutputTo(outp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of multiruns in the statistics module.
|
||||
* @param multis
|
||||
*/
|
||||
public void setMultiRuns(int multis) {
|
||||
((AbstractStatistics)proc.getStatistics()).getStatisticsParameter().setMultiRuns(multis);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the additional info output.
|
||||
* @see StatsParameter
|
||||
* @param addInfo
|
||||
*/
|
||||
public void setOutputAdditionalInfo(boolean addInfo) {
|
||||
((AbstractStatistics)proc.getStatistics()).getStatisticsParameter().setOutputAdditionalInfo(addInfo);
|
||||
}
|
||||
|
||||
// public void configureStats(int verbosityLevel, int outputDirection, int multiRuns, boolean additionalInfo) {
|
||||
// asdf
|
||||
// }
|
||||
}
|
@ -3,6 +3,7 @@ package eva2.server.go.individuals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.BitSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import wsi.ra.math.RNG;
|
||||
@ -57,8 +58,9 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
public double m_MutationProbability = 0.2;
|
||||
protected InterfaceMutation m_MutationOperator = new NoMutation();
|
||||
protected InterfaceCrossover m_CrossoverOperator = new NoCrossover();
|
||||
protected String[] m_Identifiers = new String[m_ObjectIncrement];
|
||||
protected Object[] m_Objects = new Object[m_ObjectIncrement];
|
||||
// protected String[] m_Identifiers = new String[m_ObjectIncrement];
|
||||
// protected Object[] m_Objects = new Object[m_ObjectIncrement];
|
||||
protected HashMap<String,Object> m_dataHash = new HashMap<String,Object>();
|
||||
|
||||
public AbstractEAIndividual() {
|
||||
m_IDcounter++;
|
||||
@ -111,8 +113,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
*/
|
||||
public void cloneAEAObjects(AbstractEAIndividual individual) {
|
||||
// m_Name = new String(individual.m_Name);
|
||||
m_Identifiers = new String[individual.m_Identifiers.length];
|
||||
m_Objects = new Object[individual.m_Identifiers.length];
|
||||
m_dataHash = (HashMap<String,Object>)(individual.m_dataHash.clone());
|
||||
m_ConstraintViolation = individual.m_ConstraintViolation;
|
||||
m_AreaConst4ParallelViolated = individual.m_AreaConst4ParallelViolated;
|
||||
m_Marked = individual.m_Marked;
|
||||
@ -122,8 +123,6 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
parentTree = new AbstractEAIndividual[individual.parentTree.length];
|
||||
for (int i=0; i<parentTree.length; i++) parentTree[i] = individual.parentTree[i];
|
||||
}
|
||||
System.arraycopy(individual.m_Identifiers,0,m_Identifiers,0,individual.m_Identifiers.length);
|
||||
System.arraycopy(individual.m_Objects,0,m_Objects,0,individual.m_Objects.length);
|
||||
}
|
||||
|
||||
/** This method allows you to compare two individuals
|
||||
@ -199,11 +198,12 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
// }
|
||||
}
|
||||
|
||||
/** Returns a hash code value for the object. This method is supported for the
|
||||
/**
|
||||
* Returns a hash code value for the object. This method is supported for the
|
||||
* benefit of hashtables such as those provided by java.util.Hashtable
|
||||
*/
|
||||
public int hashCode() {
|
||||
String t = this.getStringRepresentation();
|
||||
String t = AbstractEAIndividual.getDefaultStringRepresentation(this);
|
||||
return t.hashCode();
|
||||
}
|
||||
|
||||
@ -412,8 +412,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
/** This method allows you to reset the user data
|
||||
*/
|
||||
public void resetUserData() {
|
||||
this.m_Identifiers = new String[m_ObjectIncrement];
|
||||
this.m_Objects = new Object[m_ObjectIncrement];
|
||||
m_dataHash.clear();
|
||||
}
|
||||
|
||||
/** This method allows you to reset the level of constraint violation for an
|
||||
@ -741,28 +740,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @param obj The object that is to be stored.
|
||||
*/
|
||||
public void SetData(String name, Object obj) {
|
||||
for (int i = 0; i < this.m_Identifiers.length; i++) {
|
||||
if (this.m_Identifiers[i] == null) {
|
||||
// Identifier has not been found, but there is empty space to store it
|
||||
this.m_Identifiers[i] = name;
|
||||
this.m_Objects[i] = obj;
|
||||
return;
|
||||
}
|
||||
if (this.m_Identifiers[i].equalsIgnoreCase(name)) {
|
||||
this.m_Objects[i] = obj;
|
||||
return;
|
||||
}
|
||||
}
|
||||
// The identifier could not be found and there is not enough space
|
||||
String[] tmpId = new String[this.m_Identifiers.length + this.m_ObjectIncrement];
|
||||
Object[] tmpOb = new Object[this.m_Identifiers.length + this.m_ObjectIncrement];
|
||||
for (int i = 0; i < this.m_Identifiers.length; i++) {
|
||||
tmpId[i] = this.m_Identifiers[i];
|
||||
tmpOb[i] = this.m_Objects[i];
|
||||
}
|
||||
this.m_Identifiers = tmpId;
|
||||
this.m_Objects = tmpOb;
|
||||
this.SetData(name, obj);
|
||||
m_dataHash.put(name, obj);
|
||||
}
|
||||
|
||||
/** This method will return a stored object.
|
||||
@ -770,19 +748,13 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return Object
|
||||
*/
|
||||
public Object getData(String name) {
|
||||
if (name.equalsIgnoreCase("SelectionProbability")) return this.getSelectionProbability();
|
||||
if (name.equalsIgnoreCase("SelectionProbabilityArray")) return this.getSelectionProbability();
|
||||
if (name.equalsIgnoreCase("Fitness")) return this.getFitness();
|
||||
if (name.equalsIgnoreCase("FitnessArray")) return this.getFitness();
|
||||
for (int i = 0; i < this.m_Identifiers.length; i++) {
|
||||
if (this.m_Identifiers[i] == null) {
|
||||
return null;
|
||||
}
|
||||
if (this.m_Identifiers[i].equalsIgnoreCase(name)) {
|
||||
return this.m_Objects[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
// if (name.equalsIgnoreCase("SelectionProbability")) return this.getSelectionProbability();
|
||||
// if (name.equalsIgnoreCase("SelectionProbabilityArray")) return this.getSelectionProbability();
|
||||
// if (name.equalsIgnoreCase("Fitness")) return this.getFitness();
|
||||
// if (name.equalsIgnoreCase("FitnessArray")) return this.getFitness();
|
||||
Object data = m_dataHash.get(name);
|
||||
if (data==null) System.err.println("Warning: data key " + name + " unknown!");
|
||||
return data;
|
||||
}
|
||||
|
||||
/** This method will return a string description of the Individal
|
||||
@ -799,6 +771,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return The description.
|
||||
*/
|
||||
public static String getDefaultStringRepresentation(AbstractEAIndividual individual) {
|
||||
// Note that changing this method might change the hashcode of an individual
|
||||
// which might interfere with some functionality.
|
||||
StringBuffer sb = new StringBuffer(getDefaultDataString(individual));
|
||||
|
||||
sb.append(", fitness: ");
|
||||
@ -818,6 +792,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return
|
||||
*/
|
||||
public static String getDefaultDataString(IndividualInterface individual) {
|
||||
// Note that changing this method might change the hashcode of an individual
|
||||
// which might interfere with some functionality.
|
||||
return getDefaultDataString(individual, "; ");
|
||||
}
|
||||
|
||||
@ -829,6 +805,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
||||
* @return
|
||||
*/
|
||||
public static String getDefaultDataString(IndividualInterface individual, String separator) {
|
||||
// Note that changing this method might change the hashcode of an individual
|
||||
// which might interfere with some functionality.
|
||||
if (individual == null) return "null";
|
||||
StringBuffer sb = new StringBuffer("");
|
||||
char left = '[';
|
||||
|
@ -17,12 +17,13 @@ import eva2.server.go.operators.distancemetric.InterfaceDistanceMetric;
|
||||
import eva2.server.go.operators.distancemetric.PhenotypeMetric;
|
||||
import eva2.tools.EVAERROR;
|
||||
import eva2.tools.Mathematics;
|
||||
import eva2.tools.Pair;
|
||||
|
||||
|
||||
/** This is a basic implementation for a EA Population.
|
||||
* Copyright: Copyright (c) 2003
|
||||
* Company: University of Tuebingen, Computer Architecture
|
||||
* @author Felix Streichert
|
||||
* @author Felix Streichert, Marcel Kronfeld
|
||||
* @version: $Revision: 307 $
|
||||
* $Date: 2007-12-04 14:31:47 +0100 (Tue, 04 Dec 2007) $
|
||||
* $Author: mkron $
|
||||
@ -34,9 +35,11 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
protected int m_FunctionCalls = 0;
|
||||
protected int m_Size = 50;
|
||||
protected Population m_Archive = null;
|
||||
|
||||
transient private ArrayList<AbstractEAIndividual> sortedArr = null;
|
||||
private int lastQModCount = -1;
|
||||
transient protected InterfacePopulationChangedEventListener m_Listener = null;
|
||||
|
||||
// the evaluation interval at which listeners are notified
|
||||
protected int notifyEvalInterval = 0;
|
||||
protected HashMap<String, Object> additionalPopData = null;
|
||||
|
||||
@ -45,6 +48,13 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
boolean useHistory = false;
|
||||
public ArrayList<AbstractEAIndividual> m_History = new ArrayList<AbstractEAIndividual>();
|
||||
|
||||
// remember when the last sorted queue was prepared
|
||||
private int lastQModCount = -1;
|
||||
// remember when the last evaluation was performed
|
||||
private Pair<Integer,Integer> evaluationTimeHashes = null;
|
||||
// remember when the last evaluation was performed
|
||||
private int evaluationTimeModCount = -1;
|
||||
|
||||
public Population() {
|
||||
}
|
||||
|
||||
@ -129,6 +139,8 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
this.m_History = new ArrayList();
|
||||
this.m_Generation = 0;
|
||||
this.m_FunctionCalls = 0;
|
||||
evaluationTimeHashes = null;
|
||||
evaluationTimeModCount = -1;
|
||||
if (this.m_Archive != null) {
|
||||
this.m_Archive.clear();
|
||||
this.m_Archive.init();
|
||||
@ -178,7 +190,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
*
|
||||
* @param d The number of function calls to increment.
|
||||
*/
|
||||
public void incrFunctionCallsby(int d) {
|
||||
public void incrFunctionCallsBy(int d) {
|
||||
if (doEvalNotify()) {
|
||||
// System.out.println("checking funcall event...");
|
||||
int nextStep; // next interval boundary
|
||||
@ -271,7 +283,7 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the fitness to the maximum possible value for the given individual.
|
||||
* Resets the fitnes to the maximum possible value for the given individual.
|
||||
*
|
||||
* @param indy an individual whose fitness will be reset
|
||||
*/
|
||||
@ -915,4 +927,39 @@ public class Population extends ArrayList implements PopulationInterface, Clonea
|
||||
public void setNotifyEvalInterval(int notifyEvalInterval) {
|
||||
this.notifyEvalInterval = notifyEvalInterval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the population at the current state has been marked as
|
||||
* evaluated. This allows to avoid double evaluations.
|
||||
*
|
||||
* @return true if the population has been marked as evaluated in its current state, else false
|
||||
*/
|
||||
public boolean isEvaluated() {
|
||||
Pair<Integer,Integer> hashes = getIndyHashSums();
|
||||
|
||||
if (evaluationTimeHashes == null) return false;
|
||||
else return (hashes.head()==evaluationTimeHashes.head() && (hashes.tail() == evaluationTimeHashes.tail()) && (evaluationTimeModCount == modCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the population at the current state as evaluated. Changes to the modCount or hashes of individuals
|
||||
* will invalidate the mark.
|
||||
*
|
||||
* @see isEvaluated()
|
||||
*/
|
||||
public void setEvaluated() {
|
||||
evaluationTimeModCount = modCount;
|
||||
evaluationTimeHashes = getIndyHashSums();
|
||||
}
|
||||
|
||||
private Pair<Integer,Integer> getIndyHashSums() {
|
||||
int hashSum = 0, hashSumAbs = 0;
|
||||
int hash;
|
||||
for (int i=0; i<size(); i++) {
|
||||
hash = get(i).hashCode();
|
||||
hashSum += hash;
|
||||
hashSumAbs += Math.abs(hash);
|
||||
}
|
||||
return new Pair(hashSum, hashSumAbs);
|
||||
}
|
||||
}
|
||||
|
@ -53,16 +53,21 @@ public abstract class AbstractOptimizationProblem implements InterfaceOptimizati
|
||||
public void evaluate(Population population) {
|
||||
AbstractEAIndividual tmpIndy;
|
||||
|
||||
// @todo This is the position to implement a granular
|
||||
// @todo paralliziation scheme
|
||||
evaluatePopulationStart(population);
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) population.get(i);
|
||||
tmpIndy.resetConstraintViolation();
|
||||
this.evaluate(tmpIndy);
|
||||
population.incrFunctionCalls();
|
||||
if (population.isEvaluated()) {
|
||||
System.err.println("Population evaluation seems not required!");
|
||||
} else {
|
||||
// @todo This is the position to implement a granular
|
||||
// @todo paralliziation scheme
|
||||
evaluatePopulationStart(population);
|
||||
for (int i = 0; i < population.size(); i++) {
|
||||
tmpIndy = (AbstractEAIndividual) population.get(i);
|
||||
tmpIndy.resetConstraintViolation();
|
||||
this.evaluate(tmpIndy);
|
||||
population.incrFunctionCalls();
|
||||
}
|
||||
evaluatePopulationEnd(population);
|
||||
population.setEvaluated();
|
||||
}
|
||||
evaluatePopulationEnd(population);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -425,7 +425,7 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
|
||||
}
|
||||
// reinit the surplus individuals and add these new individuals to undifferentiated
|
||||
m_Undifferentiated.addPopulation(this.initializeIndividuals(reinitCount));
|
||||
m_Undifferentiated.incrFunctionCallsby(reinitCount);
|
||||
m_Undifferentiated.incrFunctionCallsBy(reinitCount);
|
||||
m_Undifferentiated.setPopulationSize(this.m_Undifferentiated.getPopulationSize()+reinitCount);
|
||||
// if (this.m_Debug) {
|
||||
// System.out.println("Undiff.Size: " + this.m_Undifferentiated.size() +"/"+this.m_Undifferentiated.getPopulationSize());
|
||||
@ -454,12 +454,12 @@ public class ClusterBasedNichingEA implements InterfacePopulationChangedEventLis
|
||||
//////////////////////
|
||||
if (!isActive(m_Undifferentiated)) {
|
||||
if (TRACE) System.out.println("Inactive Undiff-pop, adding " + m_Undifferentiated.size() + " fun calls...");
|
||||
m_Undifferentiated.incrFunctionCallsby(m_Undifferentiated.size());
|
||||
m_Undifferentiated.incrFunctionCallsBy(m_Undifferentiated.size());
|
||||
}
|
||||
if (this.m_Undifferentiated.getFunctionCalls() % this.m_PopulationSize != 0) {
|
||||
if (TRACE) System.out.println("### mismatching number of funcalls, inactive species? Correcting by " + (m_PopulationSize - (m_Undifferentiated.getFunctionCalls() % m_PopulationSize)));
|
||||
if (TRACE) System.out.println("### undiff " + ((isActive(m_Undifferentiated)) ? "active!" : "inactive!"));
|
||||
m_Undifferentiated.incrFunctionCallsby(m_PopulationSize - (m_Undifferentiated.getFunctionCalls() % m_PopulationSize));
|
||||
m_Undifferentiated.incrFunctionCallsBy(m_PopulationSize - (m_Undifferentiated.getFunctionCalls() % m_PopulationSize));
|
||||
} else if (TRACE) System.out.println("### undiff active: " + isActive(m_Undifferentiated));
|
||||
|
||||
// possible species differentiation and convergence
|
||||
|
@ -166,7 +166,7 @@ public class ClusteringHillClimbing implements InterfacePopulationChangedEventLi
|
||||
// reset population while keeping function calls etc.
|
||||
m_Population.clear();
|
||||
m_Population.addPopulation(tmpPop);
|
||||
m_Population.incrFunctionCallsby(tmpPop.size());
|
||||
m_Population.incrFunctionCallsBy(tmpPop.size());
|
||||
|
||||
} else { // decrease step size
|
||||
mutator.setSigma(mutator.getSigma()*reduceFactor);
|
||||
|
@ -63,8 +63,8 @@ public interface InterfaceOptimizer {
|
||||
* Return all found solutions (local optima) if they are not contained in the current population. Be
|
||||
* sure to set the Population properties, especially function calls and generation, with respect
|
||||
* to the ongoing optimization.
|
||||
* May return the same as getPopulation if the optimizer makes no distinction, i.e. does not collect
|
||||
* solutions outside the current population.
|
||||
* May return the the same set as getPopulation if the optimizer makes no distinction, i.e. does
|
||||
* not collect solutions outside the current population.
|
||||
*
|
||||
* @return A population of found solutions.
|
||||
*/
|
||||
|
@ -133,7 +133,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
||||
for (int i = 0; i < this.m_Islands.length; i++) {
|
||||
pop = (Population)this.m_Islands[i].getPopulation().clone();
|
||||
this.m_Population.addPopulation(pop);
|
||||
this.m_Population.incrFunctionCallsby(pop.getFunctionCalls());
|
||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||
}
|
||||
this.firePropertyChangedEvent("NextGenerationPerformed", this.m_Optimizer.getPopulation());
|
||||
}
|
||||
@ -192,7 +192,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
||||
for (int i = 0; i < this.m_Islands.length; i++) {
|
||||
pop = (Population)this.m_Islands[i].getPopulation().clone();
|
||||
this.m_Population.addPopulation(pop);
|
||||
this.m_Population.incrFunctionCallsby(pop.getFunctionCalls());
|
||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||
}
|
||||
this.firePropertyChangedEvent("NextGenerationPerformed", this.m_Optimizer.getPopulation());
|
||||
}
|
||||
@ -246,7 +246,7 @@ public class IslandModelEA implements InterfacePopulationChangedEventListener, I
|
||||
for (int i = 0; i < this.m_Islands.length; i++) {
|
||||
pop = (Population)this.m_Islands[i].getPopulation().clone();
|
||||
this.m_Population.addPopulation(pop);
|
||||
this.m_Population.incrFunctionCallsby(pop.getFunctionCalls());
|
||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||
}
|
||||
// System.out.println("Fitnesscalls :" + this.m_Population.getFunctionCalls());
|
||||
this.firePropertyChangedEvent("NextGenerationPerformed", this.m_Optimizer.getPopulation());
|
||||
|
@ -107,7 +107,7 @@ public class SteadyStateGA implements InterfaceOptimizer, java.io.Serializable {
|
||||
|
||||
public void optimize() {
|
||||
for (int i = 0; i < this.m_Population.size(); i++) this.generateChildren();
|
||||
this.m_Population.incrFunctionCallsby(this.m_Population.size());
|
||||
this.m_Population.incrFunctionCallsBy(this.m_Population.size());
|
||||
this.m_Population.incrGeneration();
|
||||
this.firePropertyChangedEvent("NextGenerationPerformed");
|
||||
}
|
||||
|
@ -162,11 +162,11 @@ public class WingedMultiObjectiveEA implements InterfaceOptimizer, java.io.Seria
|
||||
// first collect all the data
|
||||
pop = (Population)this.m_MOOptimizer.getPopulation().clone();
|
||||
this.m_Population.addPopulation(pop);
|
||||
this.m_Population.incrFunctionCallsby(pop.getFunctionCalls());
|
||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||
for (int i = 0; i < this.m_SOOptimizers.length; i++) {
|
||||
pop = (Population)this.m_SOOptimizers[i].getPopulation().clone();
|
||||
this.m_Population.addPopulation(pop);
|
||||
this.m_Population.incrFunctionCallsby(pop.getFunctionCalls());
|
||||
this.m_Population.incrFunctionCallsBy(pop.getFunctionCalls());
|
||||
}
|
||||
oldFunctionCalls = this.m_Population.getFunctionCalls();
|
||||
this.m_Problem.evaluate(this.m_Population);
|
||||
|
@ -150,8 +150,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
if (Mathematics.norm(bestCurrentIndividual.getFitness()) < this.m_StatsParams.getConvergenceRateThreshold()) {
|
||||
convergenceCnt++;
|
||||
}
|
||||
if (printRunStoppedVerbosity()) printToTextListener(" Best solution: " + BeanInspector.toString(bestCurrentIndividual) + "\n");
|
||||
if (printRunStoppedVerbosity()) printToTextListener(AbstractEAIndividual.getDefaultDataString(bestCurrentIndividual) + "\n");
|
||||
if (printRunStoppedVerbosity()) printToTextListener(" Run best individual : " + BeanInspector.toString(bestCurrentIndividual) + "\n");
|
||||
if (printRunStoppedVerbosity()) printToTextListener(" run solution data : " + AbstractEAIndividual.getDefaultDataString(bestCurrentIndividual) + "\n");
|
||||
if (printRunStoppedVerbosity()) printToTextListener(" run solution fit : " + BeanInspector.toString(bestCurrentIndividual.getFitness()) + "\n");
|
||||
}
|
||||
if (currentBestFit!= null) {
|
||||
if (printRunStoppedVerbosity()) printToTextListener(" Best Fitness: " + BeanInspector.toString(currentBestFit) + "\n");
|
||||
@ -162,9 +163,9 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
||||
protected void finalizeOutput() {
|
||||
if (printFinalVerbosity()) printToTextListener("*******\n Runs performed: " + optRunsPerformed + ", reached target " + convergenceCnt + " times with threshold " + m_StatsParams.getConvergenceRateThreshold() + ", rate " + convergenceCnt/(double)m_StatsParams.getMultiRuns() + '\n');
|
||||
if (printFinalVerbosity()) printToTextListener(" Average function calls: " + (functionCallSum/optRunsPerformed) + "\n");
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener("Best overall individual: " + BeanInspector.toString(bestIndividualAllover) + '\n');
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener(" solution : " + AbstractEAIndividual.getDefaultDataString(bestIndividualAllover) + '\n');
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener(" fitness : " + BeanInspector.toString(bestIndividualAllover.getFitness()) + '\n');
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener(" Overall best individual : " + BeanInspector.toString(bestIndividualAllover) + '\n');
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener(" overall solution data : " + AbstractEAIndividual.getDefaultDataString(bestIndividualAllover) + '\n');
|
||||
if (printFinalVerbosity() && (bestIndividualAllover != null)) printToTextListener(" overall solution fit : " + BeanInspector.toString(bestIndividualAllover.getFitness()) + '\n');
|
||||
if (refineMultiRuns && (optRunsPerformed>1) && (meanCollection != null)) {
|
||||
if (printFinalVerbosity()) printToTextListener("Averaged performance:\n");
|
||||
for (int i=0; i<meanCollection.size(); i++) divideMean(meanCollection.get(i), optRunsPerformed);
|
||||
|
@ -29,318 +29,322 @@ import eva2.tools.Tag;
|
||||
*
|
||||
*/
|
||||
public class StatsParameter implements InterfaceStatisticsParameter, Serializable {
|
||||
public final static int PLOT_BEST = 0;
|
||||
public final static int PLOT_WORST = 1;
|
||||
public final static int PLOT_BEST_AND_WORST = 2;
|
||||
public final static int PLOT_BEST_AND_MEASURES = 3;
|
||||
public final static Tag[] TAGS_PLOT_FITNESS = {
|
||||
new Tag(PLOT_BEST, "plot best fitness"),
|
||||
new Tag(PLOT_WORST, "plot worst fitness"),
|
||||
new Tag(PLOT_BEST_AND_WORST, "both best and worst"),
|
||||
new Tag(PLOT_BEST_AND_MEASURES, "both best and population measures")
|
||||
};
|
||||
|
||||
public final static int VERBOSITY_NONE = 0;
|
||||
public final static int VERBOSITY_FINAL = 1;
|
||||
public final static int VERBOSITY_KTH_IT = 2;
|
||||
public final static int VERBOSITY_ALL = 3;
|
||||
SelectedTag outputVerbosity = new SelectedTag("No output", "Final results", "K-th iterations", "All iterations");
|
||||
SelectedTag outputTo = new SelectedTag("File (current dir.)", "Text-window", "Both file and text-window");
|
||||
private int verboK = 10;
|
||||
public final static int PLOT_BEST = 0;
|
||||
public final static int PLOT_WORST = 1;
|
||||
public final static int PLOT_BEST_AND_WORST = 2;
|
||||
public final static int PLOT_BEST_AND_MEASURES = 3;
|
||||
public final static Tag[] TAGS_PLOT_FITNESS = {
|
||||
new Tag(PLOT_BEST, "plot best fitness"),
|
||||
new Tag(PLOT_WORST, "plot worst fitness"),
|
||||
new Tag(PLOT_BEST_AND_WORST, "both best and worst"),
|
||||
new Tag(PLOT_BEST_AND_MEASURES, "both best and population measures")
|
||||
};
|
||||
|
||||
private int m_PlotFitness = PLOT_BEST;
|
||||
private int m_Textoutput = 0;
|
||||
private int m_Plotoutput = 1;
|
||||
private int m_MultiRuns = 1;
|
||||
private String m_ResultFilePrefix = "JE2";
|
||||
protected String m_Name = "not defined";
|
||||
protected String m_InfoString = "";
|
||||
private boolean m_useStatPlot = true;
|
||||
private boolean showAdditionalProblemInfo = false;
|
||||
private double m_ConvergenceRateThreshold=0.001;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static StatsParameter getInstance() {
|
||||
StatsParameter Instance = (StatsParameter) Serializer.loadObject("Statistics.ser");
|
||||
if (Instance == null)
|
||||
Instance = new StatsParameter();
|
||||
return Instance;
|
||||
}
|
||||
public final static int VERBOSITY_NONE = 0;
|
||||
public final static int VERBOSITY_FINAL = 1;
|
||||
public final static int VERBOSITY_KTH_IT = 2;
|
||||
public final static int VERBOSITY_ALL = 3;
|
||||
SelectedTag outputVerbosity = new SelectedTag("No output", "Final results", "K-th iterations", "All iterations");
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public StatsParameter() {
|
||||
m_Name = "Statistics";
|
||||
outputVerbosity.setSelectedTag(2);
|
||||
outputTo.setSelectedTag(1);
|
||||
}
|
||||
public final static int OUTPUT_FILE = 0;
|
||||
public final static int OUTPUT_WINDOW = 1;
|
||||
public final static int OUTPUT_FILE_WINDOW = 2;
|
||||
SelectedTag outputTo = new SelectedTag("File (current dir.)", "Text-window", "Both file and text-window");
|
||||
private int verboK = 10;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String toString() {
|
||||
String ret = "\r\nStatParameter:\r\nm_MultiRuns=" + m_MultiRuns +
|
||||
"\r\nm_Textoutput=" + m_Textoutput +
|
||||
"\r\nm_Plotoutput=" + m_Plotoutput;
|
||||
return ret;
|
||||
}
|
||||
private int m_PlotFitness = PLOT_BEST;
|
||||
private int m_Textoutput = 0;
|
||||
private int m_Plotoutput = 1;
|
||||
private int m_MultiRuns = 1;
|
||||
private String m_ResultFilePrefix = "JE2";
|
||||
protected String m_Name = "not defined";
|
||||
protected String m_InfoString = "";
|
||||
private boolean m_useStatPlot = true;
|
||||
private boolean showAdditionalProblemInfo = false;
|
||||
private double m_ConvergenceRateThreshold=0.001;
|
||||
|
||||
/**
|
||||
* Return a list of String arrays describing the selected plot options, e.g. {"Best"} or {"Best", "Worst"}.
|
||||
* For now, only one array is returned.
|
||||
*
|
||||
* @return a list of String arrays describing the selected plot options
|
||||
*/
|
||||
public ArrayList<String[]> getPlotDescriptions() {
|
||||
ArrayList<String[]> desc = new ArrayList<String[]>();
|
||||
switch (getPlotData().getSelectedTagID()) {
|
||||
case StatsParameter.PLOT_BEST_AND_WORST:
|
||||
desc.add(new String[] {"Best", "Worst"});
|
||||
break;
|
||||
case StatsParameter.PLOT_BEST:
|
||||
desc.add(new String[] {"Best"});
|
||||
break;
|
||||
case StatsParameter.PLOT_WORST:
|
||||
desc.add(new String[] {"Worst"});
|
||||
break;
|
||||
case StatsParameter.PLOT_BEST_AND_MEASURES:
|
||||
desc.add(new String[] {"Best", "AvgDist", "MaxDist"});
|
||||
break;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void saveInstance() {
|
||||
Serializer.storeObject("Statistics.ser", this);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static StatsParameter getInstance() {
|
||||
StatsParameter Instance = (StatsParameter) Serializer.loadObject("Statistics.ser");
|
||||
if (Instance == null)
|
||||
Instance = new StatsParameter();
|
||||
return Instance;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private StatsParameter(StatsParameter Source) {
|
||||
m_ConvergenceRateThreshold = Source.m_ConvergenceRateThreshold;
|
||||
m_useStatPlot = Source.m_useStatPlot;
|
||||
m_Textoutput = Source.m_Textoutput;
|
||||
m_Plotoutput = Source.m_Plotoutput;
|
||||
m_PlotFitness = Source.m_PlotFitness;
|
||||
m_MultiRuns = Source.m_MultiRuns;
|
||||
m_ResultFilePrefix = Source.m_ResultFilePrefix;
|
||||
verboK = Source.verboK;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public StatsParameter() {
|
||||
m_Name = "Statistics";
|
||||
outputVerbosity.setSelectedTag(2);
|
||||
outputTo.setSelectedTag(1);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Object getClone() {
|
||||
return new StatsParameter(this);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String toString() {
|
||||
String ret = "\r\nStatParameter:\r\nm_MultiRuns=" + m_MultiRuns +
|
||||
"\r\nm_Textoutput=" + m_Textoutput +
|
||||
"\r\nm_Plotoutput=" + m_Plotoutput;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return m_Name;
|
||||
}
|
||||
/**
|
||||
* Return a list of String arrays describing the selected plot options, e.g. {"Best"} or {"Best", "Worst"}.
|
||||
* For now, only one array is returned.
|
||||
*
|
||||
* @return a list of String arrays describing the selected plot options
|
||||
*/
|
||||
public ArrayList<String[]> getPlotDescriptions() {
|
||||
ArrayList<String[]> desc = new ArrayList<String[]>();
|
||||
switch (getPlotData().getSelectedTagID()) {
|
||||
case StatsParameter.PLOT_BEST_AND_WORST:
|
||||
desc.add(new String[] {"Best", "Worst"});
|
||||
break;
|
||||
case StatsParameter.PLOT_BEST:
|
||||
desc.add(new String[] {"Best"});
|
||||
break;
|
||||
case StatsParameter.PLOT_WORST:
|
||||
desc.add(new String[] {"Worst"});
|
||||
break;
|
||||
case StatsParameter.PLOT_BEST_AND_MEASURES:
|
||||
desc.add(new String[] {"Best", "AvgDist", "MaxDist"});
|
||||
break;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
public String globalInfo() {
|
||||
return "Configure statistics and output of the optimization run.";
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void saveInstance() {
|
||||
Serializer.storeObject("Statistics.ser", this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setPlotoutput(int i) {
|
||||
m_Plotoutput = i;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private StatsParameter(StatsParameter Source) {
|
||||
m_ConvergenceRateThreshold = Source.m_ConvergenceRateThreshold;
|
||||
m_useStatPlot = Source.m_useStatPlot;
|
||||
m_Textoutput = Source.m_Textoutput;
|
||||
m_Plotoutput = Source.m_Plotoutput;
|
||||
m_PlotFitness = Source.m_PlotFitness;
|
||||
m_MultiRuns = Source.m_MultiRuns;
|
||||
m_ResultFilePrefix = Source.m_ResultFilePrefix;
|
||||
verboK = Source.verboK;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int GetPlotoutput() {
|
||||
return m_Plotoutput;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public Object getClone() {
|
||||
return new StatsParameter(this);
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String plotFrequencyTipText() {
|
||||
// return "Frequency how often the fitness plot gets an update. plotoutput=1 -> there is a output every generation. plotoutput<0 -> there is no plot output";
|
||||
// }
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getName() {
|
||||
return m_Name;
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String printMeanTipText() {
|
||||
// return "Prints the mean of the fitness plot. Makes only sense when multiRuns > 1;";
|
||||
// }
|
||||
public String globalInfo() {
|
||||
return "Configure statistics and output of the optimization run.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setMultiRuns(int x) {
|
||||
m_MultiRuns = x;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setPlotoutput(int i) {
|
||||
m_Plotoutput = i;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int getMultiRuns() {
|
||||
return m_MultiRuns;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int GetPlotoutput() {
|
||||
return m_Plotoutput;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String multiRunsTipText() {
|
||||
return "Number of independent optimization runs to evaluate.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String GetInfoString() {
|
||||
return m_InfoString;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setInfoString(String s) {
|
||||
m_InfoString = s;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String infoStringTipText() {
|
||||
return "Infostring displayed on fitness graph by prssing the right mouse button.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public boolean GetuseStatPlot() {
|
||||
return m_useStatPlot;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setuseStatPlot(boolean x) {
|
||||
m_useStatPlot = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String useStatPlotTipText() {
|
||||
return "Plotting each fitness graph separate if multiruns > 1.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SelectedTag getPlotData() {
|
||||
return new SelectedTag(m_PlotFitness, TAGS_PLOT_FITNESS);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setPlotData(SelectedTag newMethod) {
|
||||
m_PlotFitness = newMethod.getSelectedTag().getID();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String plotDataTipText() {
|
||||
return "The data to be plotted: best fitness, worst fitness or average/max distance in population.";
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String plotObjectivesTipText() {
|
||||
// return "The individual of which the objectives are plotted.";
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void SetResultFilePrefix(String x) {
|
||||
if (x==null) m_ResultFilePrefix = "";
|
||||
else m_ResultFilePrefix = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getResultFilePrefix() {
|
||||
return m_ResultFilePrefix;
|
||||
}
|
||||
|
||||
public void SetShowTextOutput(boolean show) {
|
||||
// activate if not activated
|
||||
if (show && outputTo.getSelectedTagID() == 0) outputTo.setSelectedTag(2);
|
||||
// deactivate if activated
|
||||
else if (!show && outputTo.getSelectedTagID()>0) outputTo.setSelectedTag(0);
|
||||
}
|
||||
|
||||
public boolean isShowTextOutput() {
|
||||
return outputTo.getSelectedTagID()>0;
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String resultFileNameTipText() {
|
||||
// return "File name for the result file. If empty or 'none', no output file will be created.";
|
||||
// }
|
||||
|
||||
public String convergenceRateThresholdTipText() {
|
||||
return "Provided the optimal fitness is at zero, give the threshold below which it is considered as 'reached'";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
*/
|
||||
public void setConvergenceRateThreshold(double x) {
|
||||
m_ConvergenceRateThreshold = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public double getConvergenceRateThreshold() {
|
||||
return m_ConvergenceRateThreshold;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return the showOutputData
|
||||
// */
|
||||
// *
|
||||
// */
|
||||
// public String plotFrequencyTipText() {
|
||||
// return "Frequency how often the fitness plot gets an update. plotoutput=1 -> there is a output every generation. plotoutput<0 -> there is no plot output";
|
||||
// }
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String printMeanTipText() {
|
||||
// return "Prints the mean of the fitness plot. Makes only sense when multiRuns > 1;";
|
||||
// }
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setMultiRuns(int x) {
|
||||
m_MultiRuns = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int getMultiRuns() {
|
||||
return m_MultiRuns;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String multiRunsTipText() {
|
||||
return "Number of independent optimization runs to evaluate.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String GetInfoString() {
|
||||
return m_InfoString;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setInfoString(String s) {
|
||||
m_InfoString = s;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String infoStringTipText() {
|
||||
return "Infostring displayed on fitness graph by prssing the right mouse button.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public boolean GetuseStatPlot() {
|
||||
return m_useStatPlot;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setuseStatPlot(boolean x) {
|
||||
m_useStatPlot = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String useStatPlotTipText() {
|
||||
return "Plotting each fitness graph separate if multiruns > 1.";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public SelectedTag getPlotData() {
|
||||
return new SelectedTag(m_PlotFitness, TAGS_PLOT_FITNESS);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void setPlotData(SelectedTag newMethod) {
|
||||
m_PlotFitness = newMethod.getSelectedTag().getID();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String plotDataTipText() {
|
||||
return "The data to be plotted: best fitness, worst fitness or average/max distance in population.";
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String plotObjectivesTipText() {
|
||||
// return "The individual of which the objectives are plotted.";
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void SetResultFilePrefix(String x) {
|
||||
if (x==null) m_ResultFilePrefix = "";
|
||||
else m_ResultFilePrefix = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public String getResultFilePrefix() {
|
||||
return m_ResultFilePrefix;
|
||||
}
|
||||
|
||||
public void SetShowTextOutput(boolean show) {
|
||||
// activate if not activated
|
||||
if (show && outputTo.getSelectedTagID() == 0) outputTo.setSelectedTag(2);
|
||||
// deactivate if activated
|
||||
else if (!show && outputTo.getSelectedTagID()>0) outputTo.setSelectedTag(0);
|
||||
}
|
||||
|
||||
public boolean isShowTextOutput() {
|
||||
return outputTo.getSelectedTagID()>0;
|
||||
}
|
||||
|
||||
// /**
|
||||
// *
|
||||
// */
|
||||
// public String resultFileNameTipText() {
|
||||
// return "File name for the result file. If empty or 'none', no output file will be created.";
|
||||
// }
|
||||
|
||||
public String convergenceRateThresholdTipText() {
|
||||
return "Provided the optimal fitness is at zero, give the threshold below which it is considered as 'reached'";
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
*/
|
||||
public void setConvergenceRateThreshold(double x) {
|
||||
m_ConvergenceRateThreshold = x;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public double getConvergenceRateThreshold() {
|
||||
return m_ConvergenceRateThreshold;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @return the showOutputData
|
||||
// */
|
||||
// public boolean isShowTextOutput() {
|
||||
// return showTextOutput;
|
||||
// return showTextOutput;
|
||||
// }
|
||||
//
|
||||
|
||||
// /**
|
||||
// *
|
||||
// * @param showOutputData the showOutputData to set
|
||||
// */
|
||||
// *
|
||||
// * @param showOutputData the showOutputData to set
|
||||
// */
|
||||
// public void setShowTextOutput(boolean bShow) {
|
||||
// this.showTextOutput = bShow;
|
||||
// this.showTextOutput = bShow;
|
||||
// }
|
||||
//
|
||||
|
||||
// public String showTextOutputTipText() {
|
||||
// return "Indicates whether further text output should be printed";
|
||||
// return "Indicates whether further text output should be printed";
|
||||
// }
|
||||
|
||||
public boolean isOutputAdditionalInfo() {
|
||||
@ -350,38 +354,45 @@ public class StatsParameter implements InterfaceStatisticsParameter, Serializabl
|
||||
public void setOutputAdditionalInfo(boolean showAdd) {
|
||||
showAdditionalProblemInfo = showAdd;
|
||||
}
|
||||
|
||||
|
||||
public String outputAdditionalInfoTipText() {
|
||||
return "Activate to output additional problem information per iteration, such as the current solution representation.";
|
||||
}
|
||||
|
||||
|
||||
public void hideHideable() {
|
||||
setOutputVerbosity(getOutputVerbosity());
|
||||
}
|
||||
public void setOutputVerbosity(SelectedTag sTag) {
|
||||
outputVerbosity = sTag;
|
||||
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", sTag.getSelectedTagID() != VERBOSITY_KTH_IT);
|
||||
}
|
||||
public SelectedTag getOutputVerbosity() {
|
||||
return outputVerbosity;
|
||||
}
|
||||
|
||||
public void setOutputVerbosity(SelectedTag sTag) {
|
||||
outputVerbosity = sTag;
|
||||
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", sTag.getSelectedTagID() != VERBOSITY_KTH_IT);
|
||||
}
|
||||
|
||||
public void setOutputVerbosity(int i) {
|
||||
outputVerbosity.setSelectedTag(i);
|
||||
GenericObjectEditor.setHideProperty(this.getClass(), "outputVerbosityK", outputVerbosity.getSelectedTagID() != VERBOSITY_KTH_IT);
|
||||
}
|
||||
|
||||
public SelectedTag getOutputVerbosity() {
|
||||
return outputVerbosity;
|
||||
}
|
||||
|
||||
public String outputVerbosityTipText() {
|
||||
return "Set the data output level.";
|
||||
}
|
||||
|
||||
public int getOutputVerbosityK() {
|
||||
return verboK;
|
||||
}
|
||||
|
||||
public void setOutputVerbosityK(int k) {
|
||||
verboK = k;
|
||||
}
|
||||
|
||||
public String outputVerbosityKTipText() {
|
||||
return "Set the interval of data output for intermediate verbosity (in generations).";
|
||||
}
|
||||
|
||||
public String outputVerbosityTipText() {
|
||||
return "Set the data output level.";
|
||||
}
|
||||
|
||||
public int getOutputVerbosityK() {
|
||||
return verboK;
|
||||
}
|
||||
|
||||
public void setOutputVerbosityK(int k) {
|
||||
verboK = k;
|
||||
}
|
||||
|
||||
public String outputVerbosityKTipText() {
|
||||
return "Set the interval of data output for intermediate verbosity (in generations).";
|
||||
}
|
||||
|
||||
public SelectedTag getOutputTo() {
|
||||
return outputTo;
|
||||
}
|
||||
@ -389,9 +400,13 @@ public class StatsParameter implements InterfaceStatisticsParameter, Serializabl
|
||||
public void setOutputTo(SelectedTag tag) {
|
||||
outputTo = tag;
|
||||
}
|
||||
|
||||
|
||||
public void setOutputTo(int i) {
|
||||
outputTo.setSelectedTag(i);
|
||||
}
|
||||
|
||||
public String outputToTipText() {
|
||||
return "Set the output destination; to deactivate output, set verbosity to none.";
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,12 +1,18 @@
|
||||
package eva2.tools;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Simple pair structure of two types, Scheme style, but typed.
|
||||
*
|
||||
* @author mkron
|
||||
*
|
||||
*/
|
||||
public class Pair<S, T> {
|
||||
public class Pair<S, T> implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3620465393975181451L;
|
||||
public S head;
|
||||
public T tail;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user