Solution object from AbstractStatistics is now a data array.
This commit is contained in:
parent
140b56cee2
commit
9ab769275c
@ -911,6 +911,30 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
|||||||
return getDefaultDataString(individual, ",");
|
return getDefaultDataString(individual, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method returns the default data object of an individual containing the
|
||||||
|
* individuals solution representation.
|
||||||
|
*
|
||||||
|
* @param individual
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Object getDefaultDataObject(IndividualInterface individual) {
|
||||||
|
if (individual instanceof InterfaceDataTypeBinary) {
|
||||||
|
return ((InterfaceDataTypeBinary)individual).getBinaryData().clone();
|
||||||
|
} else if (individual instanceof InterfaceDataTypeInteger) {
|
||||||
|
return ((InterfaceDataTypeInteger)individual).getIntegerData().clone();
|
||||||
|
} else if (individual instanceof InterfaceDataTypeDouble) {
|
||||||
|
return ((InterfaceDataTypeDouble)individual).getDoubleData().clone();
|
||||||
|
} else if (individual instanceof InterfaceDataTypePermutation) {
|
||||||
|
return ((InterfaceDataTypePermutation)individual).getPermutationData()[0].clone();
|
||||||
|
} else if (individual instanceof InterfaceDataTypeProgram) {
|
||||||
|
return ((InterfaceDataTypeProgram)individual).getProgramDataWithoutUpdate().clone();
|
||||||
|
} else {
|
||||||
|
System.err.println("error in AbstractEAIndividual.getDefaultDataObject: type " + individual.getClass() + " not implemented");
|
||||||
|
return individual;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method creates a default String representation for a number Individual interfaces
|
* This method creates a default String representation for a number Individual interfaces
|
||||||
* containing the genotype.
|
* containing the genotype.
|
||||||
|
@ -265,7 +265,9 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
|||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
public Object[] getAdditionalFileStringValue(PopulationInterface pop) {
|
public Object[] getAdditionalFileStringValue(PopulationInterface pop) {
|
||||||
String solStr = AbstractEAIndividual.getDefaultDataString(pop.getBestIndividual());
|
Object solObj;
|
||||||
|
// solObj = AbstractEAIndividual.getDefaultDataString(pop.getBestIndividual());
|
||||||
|
solObj = AbstractEAIndividual.getDefaultDataObject(pop.getBestIndividual());
|
||||||
if (this instanceof InterfaceInterestingHistogram) {
|
if (this instanceof InterfaceInterestingHistogram) {
|
||||||
int fitCrit=0;
|
int fitCrit=0;
|
||||||
SolutionHistogram hist = ((InterfaceInterestingHistogram)this).getHistogram();
|
SolutionHistogram hist = ((InterfaceInterestingHistogram)this).getHistogram();
|
||||||
@ -277,8 +279,8 @@ implements InterfaceOptimizationProblem /*, InterfaceParamControllable*/, Serial
|
|||||||
}
|
}
|
||||||
Population sols = PostProcess.clusterBestUpdateHistogram((Population)maybeFiltered, this, hist, fitCrit, getDefaultAccuracy());
|
Population sols = PostProcess.clusterBestUpdateHistogram((Population)maybeFiltered, this, hist, fitCrit, getDefaultAccuracy());
|
||||||
}
|
}
|
||||||
return new Object[]{solStr, hist, hist.getScore()};
|
return new Object[]{solObj, hist, hist.getScore()};
|
||||||
} else return new Object[]{solStr};
|
} else return new Object[]{solObj};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,6 +36,9 @@ import eva2.tools.math.Mathematics;
|
|||||||
* list of Objects assembled in the getOutputValues method. This allows all simple data types which are
|
* list of Objects assembled in the getOutputValues method. This allows all simple data types which are
|
||||||
* provided by the external informer instances to be handled uniformly to the internally collected data, and
|
* provided by the external informer instances to be handled uniformly to the internally collected data, and
|
||||||
* thus they can be plotted and text-dumped in the same manner.
|
* thus they can be plotted and text-dumped in the same manner.
|
||||||
|
* Basic fields are identified by the enum GraphSelectionEnum and are available independently of additional
|
||||||
|
* informer instances.
|
||||||
|
*
|
||||||
* Depending on the field selection state and the informers, the list of data fields is dynamically altered,
|
* Depending on the field selection state and the informers, the list of data fields is dynamically altered,
|
||||||
* however changes during a multi-run are ignored, since the potential of inconsistencies is too high.
|
* however changes during a multi-run are ignored, since the potential of inconsistencies is too high.
|
||||||
*
|
*
|
||||||
@ -641,12 +644,12 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
List<String> metaStrings = getOutputMetaInfo(informerList);
|
List<String> metaStrings = getOutputMetaInfo(informerList);
|
||||||
return metaStrings.toArray( new String[metaStrings.size()]);
|
return metaStrings.toArray( new String[metaStrings.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect the names of data fields which are collected internally.This must correspond to the
|
* Collect the names of data fields which are collected internally.This must correspond to the
|
||||||
* method {@link #getSimpleOutputValues()}.
|
* method {@link #getSimpleOutputValues()}.
|
||||||
*
|
* Basic fields are identified by the enum GraphSelectionEnum and are available independently of additional
|
||||||
|
* informer instances.
|
||||||
* @see #getSimpleOutputValues()
|
* @see #getSimpleOutputValues()
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -665,6 +668,7 @@ public abstract class AbstractStatistics implements InterfaceTextListener, Inter
|
|||||||
/**
|
/**
|
||||||
* Collect the info strings of data fields collected internally. This must correspond to
|
* Collect the info strings of data fields collected internally. This must correspond to
|
||||||
* the method {@link #getSimpleOutputValues()}.
|
* the method {@link #getSimpleOutputValues()}.
|
||||||
|
* Basic meta info is defined by the enum GraphSelectionEnum.
|
||||||
*
|
*
|
||||||
* @see #getSimpleOutputValues()
|
* @see #getSimpleOutputValues()
|
||||||
* @return
|
* @return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user