--- myst: substitutions: macro: python: 1-81 cpp: 1-4,7-78,81 bloc1: python: 64-70 cpp: 63-67 bloc2: python: "35" cpp: "34" console: python: 2-18 cpp: 4-20 dedent: python: ":dedent: \n" cpp: "" --- # Macro "**reoptimizeHollowBarCodeMultiStart.{{extension}}**" ## Objective The objective of the macro is to optimize the section of the hollow bar defined in [](#reoptimizer_problem_example_problem) using the NLopt solvers (reducing it to a single-criterion optimisation as already explained in [](#reoptimizer_local_solver). It is largely based on the previous macro, the main change being the fact that we allow different starting points. ## Macro {{uranie}} {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeMultiStart." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + macro[language] + "\n" + "```" }} As stated previously, the purpose of this macro is to use different starting points for optimisation fully based on the macro shown in [](#use_cases_macro_reoptimizer_bar_code). The only difference is highlighted here: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeMultiStart." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc1[language] + "\n" + dedent[language] + "```" }} The results of this is that optimisation is performed three times, using the three starting points provided. Here it is done sequentially, but obviously, the main idea is that it is a convenient way to parallelise these optimisation. This could be done for instance, simply by changing the runner line from {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeMultiStart." + extension + "\n" + ":language: " + language + "\n" + ":lines: " + bloc2[language] + "\n" + "```" }} to, for instance in our case with 3 starting points ````{only} cpp ```cpp TThreadedRun runner(&code,4); ``` ```` ````{only} py ```python runner=Relauncher.TThreadedRun(code,4) ``` ```` ## Console This macro leads to the following result {{ "```{literalinclude} " + parent_dir + "/roottest/build/uranie/doc/reoptimizer/use_cases/" + language + "/reoptimizeHollowBarCodeMultiStart_clean.log\n" + ":language: none\n" + ":lines: " + console[language] + "\n" + "```" }}