--- myst: substitutions: macro: python: 1-5,14-26,30-33,36-51,54-63,66-70 cpp: 4-20,24-27,30-41,44-52,55-59,62 bloc1: python: 60-63,66 cpp: 50-52,55 --- (use_cases_macro_sampler_maxi_min_lhs)= # Macro "**samplingMaxiMinLHSFromLHSGrid.{{extension}}**" ## Objective This macro shows the usage of the `TMaxiMinLHS` class in the case where it is used with an already provided LHS grid. The class itself can generate a LHS grid from scratch (on which the simulated annealing algorithm will be applied to get a maximin grid) but the idea for this macro is to do this procedure in two steps to be able to compare the original LHS grid and the results of the optimisation. The orginal {{doe}} is done with two uniformly-distributed variables. The resulting {{doe}} presented is presented side-by-side with the original one and the mindist criterion calculated is displayed on top of both grid, for illustration purpose. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/sampler/use_cases/" + language + "/samplingMaxiMinLHSFromLHSGrid." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} The macro very much looks like any other {{doe}} generating macro above: the dataserver is created and the problem is defined along with the input variables. A LHS grid is generated through the use of `TSampling` and display in the first part of the canvas, calling a generic function `niceplot` defined on top of this macro. The new part comes with the following lines: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/sampler/use_cases/" + language + "/samplingMaxiMinLHSFromLHSGrid." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} The construction line of a `TMaxiMinLHS` is a bit different from the usual `TSampling` object: on top of a pointer to the dataserver, it requires the size of the grid to be generated and the main characteristic of the simulated annealing method to be used for the optimisation of the mindist criteria. A more complete discussion is done on this subject in {{metho}} ## Graph {{ "```{figure} " + parent_dir + "/roottest/build/uranie/doc/sampler/use_cases/" + language + "/maxi_min_lhs/samplingMaxiMinLHSFromLHSGrid.png\n" + ":align: center\n" + ":name: use_cases_samplingMaxiMinLHSFromLHSGrid\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"samplingMaxiMinLHSFromLHSGrid." + extension + "\"**" + "\n" + "```" }}