--- myst: substitutions: macro: python: 1-5,13-57,60-73,77-103,106-126 cpp: 1-4,8-39,43-54,57-104,110 bloc1: python: 14-19 cpp: 8-13 bloc2: python: 21,25-38 cpp: 15,19-32 bloc3: python: 51-54 cpp: 48-51 bloc4: python: 56-57,60-67 cpp: 53-54,57-64 dedent: python: ":dedent: \n" cpp: "" --- (use_cases_macro_reoptimizer_bar_code_vizir)= # Macro "**reoptimizeHollowBarCodevizir.{{extension}}**" ## Objective The objective of the macro is to optimize the section and distortion of the hollow bar defined in [](#reoptimizer_problem_example_problem) using the evolutionary solvers. This can be done with different solvers, the one chosen here being the `TVizirGenetic` one. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeVizir." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} The variables are defined as follow: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeVizir." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + "```" }} where the first two are the input ones while the last ones are computed using the provided code (as explained in [](#reoptimizer_problem_example_problem)). This code is configured through these lines {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeVizir." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} The usual {{Relaun}} construction is followed, using a `TSequentialRun` runner and the solver is chosen in these lines {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeVizir." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc3[language] + "\n" + dedent[language] + "```" }} Combining the runner, solver and dataserver, the master object is created and the objective and constraint are defined. This is done in: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeVizir." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc4[language] + "\n" + dedent[language] + "```" }} Finally the optimisation is launched and the rest of code is providing the graphical result shown in next section. ## Graph {{ "```{figure} " + parent_dir + "/roottest/build/uranie/doc/reoptimizer/use_cases/" + language + "/bar_code_vizir/reoptimizeHollowBarCodeVizir.png\n" + ":align: center\n" + ":name: use_cases_reoptimizeHollowBarCodeVizir\n" + figure_scale + "\n" + "\n" + "Graph of the macro **\"reoptimizeHollowBarCodeVizir." + extension + "\"**" + "\n" + "```" }}