|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Objectorg.moeaframework.analysis.sensitivity.ResultFileWriter
public class ResultFileWriter
Writes result files. A result file contains one or more entries consisting
of a non-dominated population and optional properties. Entries are separated
by one or more consecutive lines starting with the # character. Text
contained on these lines after the # character are ignored.
An entry contains two pieces of data: 1) properties which are defined on
lines starting with // in the same format as Properties; and
2) lines containing a sequence of floating-point numbers listing, in order,
the real-valued decision variables and objectives. Each decision variable is
separated by one or more whitespace characters. Decision variables that can
not be encoded appear as -. The writer will attempt to output the
data in a human-readable format, but falls back on Base64 encoded serialized
objects to store serializable variables.
Complete entries are always terminated by a line starting with the #
character. Incomplete entries, such as those with the incorrect number of
decision variables or objectives, are automatically removed.
This writer will append the results to the file, if a previous file exists.
By reading the previous file with a ResultFileReader, this writer will
being appending after the last valid entry. Query the
getNumberOfEntries() method to determine how many valid entries are
contained in the file.
ResultFileReader| Field Summary | |
|---|---|
protected static String |
ENCODING_WARNING
The message displayed when an unsupported decision variable type is encountered. |
protected static String |
EXISTING_FILE
The message displayed when an unclean file exists from a previous run. |
protected static String |
NO_VARIABLES_WARNING
The message displayed when excluding the decision variables when saving a result file. |
| Constructor Summary | |
|---|---|
ResultFileWriter(Problem problem,
File file)
Equivalent to ResultWriter(problem, file, true). |
|
ResultFileWriter(Problem problem,
File file,
boolean includeVariables)
Constructs an output writer for writing the decision variables and objectives of a sequence of non-dominated populations to a file. |
|
| Method Summary | |
|---|---|
void |
append(ResultEntry entry)
Appends the decision variables, objectives and optional properties to the output file. |
void |
close()
Closes this stream and releases any system resources associated with it. |
String |
encode(Variable variable)
Encodes the decision variable into a string representation that can be safely written to a result file. |
int |
getNumberOfEntries()
Returns the number of entries written to the result file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final String ENCODING_WARNING
protected static final String NO_VARIABLES_WARNING
protected static final String EXISTING_FILE
| Constructor Detail |
|---|
public ResultFileWriter(Problem problem,
File file)
throws IOException
ResultWriter(problem, file, true).
problem - the problemfile - the file to which the results are stored
IOException
public ResultFileWriter(Problem problem,
File file,
boolean includeVariables)
throws IOException
getNumberOfEntries() returns the number of valid entries. This allows
resuming evaluation at the last valid result.
It is recommended to avoid setting includeVariables to false. Any computations requiring decision variables may result in
unexpected and hard to trace errors.
problem - the problemfile - the file to which the results are storedincludeVariables - true if this writer should save the
decision variables; false otherwise.
IOException| Method Detail |
|---|
public int getNumberOfEntries()
getNumberOfEntries in interface OutputWriter
public void append(ResultEntry entry)
throws IOException
append in interface OutputWriterentry - the entry to write
IOException - if an I/O error occurredpublic void close()
java.io.Closeable
close in interface Closeablepublic String encode(Variable variable)
"-" will be returned and a warning
message printed.
variable - the decision variable to encode
|
MOEA Framework 2.5 API Specification |
|||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||