(reoptimizer_problem_example_problem)= # Sizing of a hollow bar example problem In order to give a more detailed example of the usage of both local and global solvers, the hollow bar problem is introduced. It consists in finding the lengths of the internal and external sides of a hollow bar with a square section, minimising its weight (*i.e.* its section) and its deformation by an external force applied at its centre. The two lengths are normalised so that they evolved in a 0 to 1 range and the pipe can be sketched as done in {numref}`reoptimizer_uranie_vizir_barre`. {{ "```{" "figure" "} " + parent_dir + "/usermanual/reoptimizer/figures/uranie_vizir_barre.png\n" ":align: center\n" ":name: reoptimizer_uranie_vizir_barre\n" + figure_scale + "\n" "\n" "Hollow Bar\n" "```" }} The problem has then three variables: - $f_1(x,y) = x - y$ which is called the thickness. - $f_2(x,y) = x^2 - y^2 $ which is called the section. - $f_3(x,y) = (x^4 - y^4)^{-1}$ which is called the distortion and three natural constraints: - 0 < $x$ < 1. - 0 < $y$ < 1. - $x$ > $y$ In the following sections the idea will be to study (if possible) the minimisation of the section of the bar and the distortion, keeping a minimum thickness of about 0.4. This threshold is chosen so that the bar can sustain its own weight. The examples will use an external code to compute the three previously-introduced variables once both the internal and external lengths are provided. The code is written in python as following: {{ "```{literalinclude} " + parent_dir + "/roottest/uranie/references/reoptimizer/bar.py" + "\n" + ":language: python\n" + "```" }} In both examples, the same tip is used: the *bar.py* file is used to perform the computation (as the code is defined by `python bar.py > output.dat`) but it is also defined as the input file for the `TCode`. Thanks to this, the file is copied to every temporary working directory (so no need to change the `$PYTHONPATH` environment variable) and no extra file is needed to define the inputs. The output is directly stored as an ASCII file compatible with the usual {{salome}} table format so that it can easily be read and convert as a {{tds}}