|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opt4j.core.common.logger.AbstractLogger
org.opt4j.core.common.logger.TsvLogger
public class TsvLogger
The TsvLogger writes all Individuals from the Archive
to the specified file. It can be configured to write the data each
iterationStep iterations or each evaluationStep evaluations.
The file format is TSV (tab separated values), according to the Definition of tab-separated-values (tsv) by IANA.
An infeasible Objective is printed as
Objective| Field Summary | |
|---|---|
protected Archive |
archive
|
| Fields inherited from class org.opt4j.core.common.logger.AbstractLogger |
|---|
evaluationCount, evaluationCountLast, evaluationStep, isFirst, iterationStep |
| Constructor Summary | |
|---|---|
TsvLogger(Archive archive,
java.lang.String filename,
int evaluationStep,
int iterationStep)
Creates an TsvLogger. |
|
| Method Summary | |
|---|---|
protected java.lang.String |
getColumnDelimiter()
The String separating two columns. |
protected java.lang.String |
getCommentDelimiter()
The String starting a line comment. |
protected java.lang.String |
getIndividual(Individual individual)
Creates a String representation of the given Individual. |
protected java.lang.String |
getStatistics(int iteration,
int evaluation,
double time)
Statistics for the given iteration and evaluation. |
protected java.io.PrintWriter |
initWriter(java.lang.String filename)
Initialize the print write from a filename |
void |
logEvent(int iteration,
int evaluation)
Callback method called if the specific number of iterations or evaluations is reached. |
void |
logHeader(java.util.Collection<Objective> objectives)
Writes the header. |
void |
optimizationStarted()
Callback method invoked once the optimization starts. |
void |
optimizationStopped()
Callback method invoked once the optimization stops. |
| Methods inherited from class org.opt4j.core.common.logger.AbstractLogger |
|---|
inidividualStateChanged, iterationComplete, optimizationStarted, optimizationStopped |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final Archive archive
| Constructor Detail |
|---|
@Inject
public TsvLogger(Archive archive,
java.lang.String filename,
int evaluationStep,
int iterationStep)
TsvLogger.
archive - the archivefilename - the filename (using namespace TsvLogger)evaluationStep - the number of evaluations between two logging events (using
namespace TsvLogger)iterationStep - the number of iterations between two logging events (using
namespace TsvLogger)| Method Detail |
|---|
protected java.io.PrintWriter initWriter(java.lang.String filename)
filename - the filename
public void optimizationStarted()
AbstractLogger
optimizationStarted in class AbstractLogger
public void logEvent(int iteration,
int evaluation)
AbstractLogger
logEvent in class AbstractLoggeriteration - the current iteration numberevaluation - the current evaluation numberpublic void optimizationStopped()
AbstractLogger
optimizationStopped in class AbstractLoggerpublic void logHeader(java.util.Collection<Objective> objectives)
AbstractLogger
logHeader in class AbstractLoggerobjectives - a collection of objectivesprotected java.lang.String getColumnDelimiter()
String separating two columns.
The tab character ("\t") is the default, which leads to a tab separated
values file format (TSV).
protected java.lang.String getIndividual(Individual individual)
String representation of the given Individual.
Per default, the Values of all Objectives of the
individual, separated by getColumnDelimiter(), are returned. The
String representation of a Value must not contain the tab
character.
If one of the values of the Objectives is INFEASIBLE,
null is returned.
individual - the individual
nullObjective
protected java.lang.String getStatistics(int iteration,
int evaluation,
double time)
iteration and evaluation.
Per default, the iteration, the number of evaluations and the
optimization run time in milliseconds, separated by
getColumnDelimiter(), are returned.
iteration - the current iterationevaluation - the current number of evaluationstime - the current runtime of the optimization
protected java.lang.String getCommentDelimiter()
String starting a line comment.
Default is the empty String ("") according to the TSV specification.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||