-
Notifications
You must be signed in to change notification settings - Fork 25
Result export
martinssonj edited this page Oct 8, 2012
·
2 revisions
This example is an extension of the relative parameter definition example. Say, the result of a calculation should be exported in order to be plotted, or analyzed statistically. The export can easily be handled, using InPUT. This example shows how a parameterized calculation is being repeated 100 times and exported to an output result space.
IDesignSpace ds = new DesignSpace("relativeSpace.xml");
Object[][] results = new Object[10][100];
IDesign design;
for (int i = 0; i < results.length; i++) {
for (int j = 0; j < results[i].length; j++) {
esign = ds.nextDesign("someId"); //Generating random values
double a = design.getValue("a");
double b = design.getValue("b");
results[i][j] = (a / b) - 1; //Calculation
System.out.println(results[i][j]);
}
}
Creating a new DesignSpace according to the array of results Creating a Design from the DesignSpace and fill with the results from the calculations
IDesignSpace resultSpace = new DesignSpace("resultSpace.xml");
IDesign resultDesign = resultSpace.nextEmptyDesign("someResult");
resultDesign.setValue("y", results);
resultDesign.export(new XMLFileExporter("randomDesignResults.xml"));//Exporting results to a XML-file
Examplecode can be found at se.miun.itm.input.example.result.ResultExample.java.