pub fn create_output(
    description: &ConfigurationValue,
    environment: &mut OutputEnvironment<'_>
) -> Result<(), Error>
Expand description

Creates some output using an output description object as guide.

Comma separated values

Creates a .csv with the given fields as columns.

CSV
{
	//The fields to be included as columns of the CSV file.
	fields: [=configuration.traffic.pattern.legend_name,=configuration.traffic.load,=configuration.legend_name,=result.accepted_load],
	//the name of the field to be generated
	filename: "results.csv",
}

Plots of data

See the reference of Plotkind for detailed information.

Plots
{
	//The file will contain a figure for each value of the selector. Each figure receives the filtered data.
	//In this example each traffic pattern get its own figure.
	selector: =configuration.traffic.pattern.legend_name,
	//A list of [Plotkind]s with the information of what to draw in each figure.
	//This example contains a simple chart plot, with a point for each value of `offered_load`, using that same value as abscissas (a.k.a. x axis) and the value of `accepted_load` in ordinates (a.k.a. y axis). These values are averaged respect to the other parameters, such as `random_seed`.
	kind: [Plotkind{
		parameter: =configuration.traffic.load,
		abscissas: =configuration.traffic.load,
		label_abscissas: "offered load",
		ordinates: =result.accepted_load,
		label_ordinates: "accepted load",
		min_ordinate: 0.0,
		max_ordinate: 1.0,
	}],
	//The value to use for both legend and lines to draw.
	//In this example each combination of routing and base configuration gets a line.
	legend: [=configuration.routing.legend_name,=configuration.legend_name],
	//Prefix to use in texmporal files and similar. Must contain only simple characters and should be unique.
	prefix: "throughput",
	//The backend to actually draw the data. Only `Tikz` is supported. To execute the output action with this backend it is required a latex installation including the `pgfplots` latex package, which may be located at the `texlive-pictures` package of some linux distributions. Its temporal files are stored into a `tikz_tmp` directory, which may be inspected in case of errors.
	backend: Tikz
	{
		//A generated file with latex code to generate the plots. Prepared to be inserted into another document; it is not an standalone file.
		tex_filename: "throughput.tex",
		//A pdf generated with the plots. Its source is actually in the `tikz_tmp` directory, which has some additional preambles than `tex_filename`.
		pdf_filename: "throughput.pdf",
	},
},

Preprocessing of data

A PreprocessArgMax process the results and creates a file containing an array with the maximum values of some expression together the value of an auxiliary expression. The generated file is binary file containing a ConfigurationValue::Array with as many elements as experiments and in the ith entry contains PreprocessedArgMax{argument:computed_argument_value,maximum_value:computed_maximum_value}.

//This example find where accepted load is maximum.
PreprocessArgMax
{
	//The file to be generated
	filename: "peak.cfg",
	//We apply the maximum to each subset of the data with same value of the `selector`.
	selector: [ =configuration.traffic.pattern.legend_name, =configuration.routing.legend_name , =configuration.legend_name ],
	//The target expression to be maximized
	target: =result.accepted_load,
	//The auxiliary expression. Its value associated to the same entry that maximized the `target` value is stored.
	argument: =configuration.traffic.load,
},

The generated file can be used by following output description. The expression FileExpression evaluates an expression into a file and with at{container:file_data,position:index} we access the corresponding record, as index is a variable with the experiment number.

For example, to use this peak.cfg.

Plots
{
	//Note the selector is a bit different, as the preprocessing included also the legend of this plot.
	selector: [=configuration.traffic.pattern.legend_name,],
	kind: [Plotkind{
		parameter: =configuration.traffic.load,
		abscissas: =configuration.traffic.load,
		// --- get greatest worst server with average close to peak.
		// we read the stored value and compare it with the accepted load plus an epsilon.
		ordinates: =if{
			condition: lt{
				first:FileExpression
				{
					filename: "peak.cfg",
					expression:at{container:file_data,position:index}
				}.maximum_value,
				second:add{first:result.accepted_load, second:0.02}
			},
			true_expression: result.server_percentile0.accepted_load,
			false_expression: 0,
		},
		label_abscissas: "offered load",
		label_ordinates: "conditional load",
	}],
	legend: [=configuration.routing.legend_name,=configuration.legend_name],
	prefix: "salud",
	backend: Tikz
	{
		tex_filename: "salud.tex",
		pdf_filename: "salud.pdf",
	},
},