8.3.3.4. Output file

Output file formats supported by TCodeEval include:

  • TFlatResult, Output file is made up of an header characterised by # as first line character, and a line of floats separated by spaces. By default, it is constructed as the DataServer one (from Launcher module). One can consider using a flat output file written over several lines (so constructed as a TOutputFileRow) but one needs to be very careful about the fact that all attributes might not have the same number of entries (when dealing with vectors for instance). This is discussed in the third item of Creation of input files without model files and in Objective. To do this a specific method has to be called isMultiLine(string separ) which says to the class that the results are written over many lines, and every field is separated by the string separ.

  • TKeyResult, Value can be found on line composed with the key, a separator, the value and eventually a ; character. A separator is composed with space, tab, = and : characters.

  • TLineResult. All the values of a given TAttribute are written on a specific line. Changing attribute means changing line. It is the equivalent of the Column format (from the Launcher module).

TXmlResult is not provided in this version

In a similar way of TInputFile, one should use the addOutput to declare parameters, the argument being the pointer to the attribute under consideration for all these formats, pairing with the corresponding key when dealing with a TKeyResult object. This step can be gathered in a single operation, as for the input file, using the setOutputs method. Here is an example for the ongoing use-case.

# Input File Flat format case
fout = Relauncher.TFlatResult("_output_rosenbrock_with_values_rows.dat")
fout.addOutput(ros)

# Or Input File Key format case
kout = Relauncher.TKeyResult("_output_rosenbrock_with_keys.dat")
kout.addOutput(ros, "ros")

Finally, use the addOutputFile method of TCodeEval to declare it:

# Add output file to the TCodeEval
code.addOutputFile(fout)  # put kout instead for key