Integration#

This section describes the integration of MSolve with Korali.

Approach#

The integration of MSolve into Korali is performed through files. To execute one MSolve simulation, corresponding to a Korali sample, Korali performs the following:

  1. Create a directory unique to the sample.

  2. Create an xml configuration file that contains the parameters values. This file is readable by MSolve and describes the simulation.

  3. Execute MSolve. Msolve produces an xml output file containing the results of the simulations.

  4. Parse the output file and extract the quantities of interest needed by the optimization or sampling process.

Python module#

Here we describe the bridge python module and its functions.

Summary#

integration.bridge.run_msolve(xcoords, ...)

Run an instance of Msolve for given parameters.

integration.bridge.write_config_file(...)

Write an xml configuration file readable by MSolve.

integration.bridge.run_msolve_mock(xcoords, ...)

Run a mock version of msolve.

Interface with MSolve#

integration.bridge.run_msolve(xcoords, ycoords, generation: int, sample_id: int, parameters: list)#

Run an instance of Msolve for given parameters. This function performs the following steps: - Create a directory unique to the sample - Create an xml configuration file readable by Msolve - Run Msolve - Parse the xml file produced by MSolve - Return the parsed results

Parameters:
  • xcoords (list) – x coordinates of the temperature measurements

  • ycoords (list) – y coordinates of the temperature measurements

  • generation (int) – the generation index of the korali experiment (used to create a unique directory)

  • sample_id (int) – the index of the korali sample (used to create a unique directory)

  • parameters (list) – position of the heat source

Returns:

the coordinates and values of the temperature measurements (x, y, T)

Utilities#


integration.bridge.write_config_file(xcoords, ycoords, parameters: list, filename: str)#

Write an xml configuration file readable by MSolve. The configuration describes the problem of a 2D plate heated by a heat source, with temperature measurements at given locations.

Parameters:
  • xcoords (list) – x coordinates of the temperature measurements

  • ycoords (list) – y coordinates of the temperature measurements

  • parameters (list) – position of the heat source

  • filename (str) – name of the configuration file to write


integration.bridge.run_msolve_mock(xcoords, ycoords, generation: int, sample_id: int, parameters: list)#

Run a mock version of msolve. For debugging and testing purpose.