# Rosenbrock

Stefan Kuntsche, Sanam Sabeti Adibpour

The Rosenbrock Function is well suited as testing problem. For two variables it has the form
$f(x,y)=(1-x)^2+c\cdot (y-x^2)^2$

This function will now be used as a learning problem. To do this, the two dimensional optimisation problem in equation (\ref{eq.rosenbrock.one}) is transfered into a two dimensional root finding problem.
$a\cdot(1-x) = 0$
$b\cdot (y-x^2) = 0$

In the following section, a way to solve this problem in MOSAICmodeling is described. It is assumed that you are already logged in to MOSAICmodeling and see the modeling environment in your browser.

###### Creating the Notation

At first it is necessary to create a notation that contains descriptions for all symbols used for the names of the variables, i.e. a, b, x and y. To create the notation do the following

• Select the Notation Editor in the Editor Bar on the top.
• Choose the tab Base Names and use the [add] button to enter the letters one by one, giving a description for each of them.
• Click [save] to open a file selection dialog.
• In the dialog press [New package] and create a new package named ‘example_rosenbrock’ and change into it afterwards.
• Save the notation (e.g. ‘notation_rosenbrock’).
###### Creating the equations
• Make the Equation Editor visible by choosing it in the Editor Bar on the top.
• On the editor you find a field named Notation. Click on [Change] and select the notation you just created in the upcoming dialog.
• Now you have to enter a text into the field Description.
• In the field MosaicLatex you enter the mathematic formula for the equation. Please type the following into the field:
 0=a \cdot (1-x)
• Click on [Render] to create MathML code. The rendered MathML expression is shown in the MathML Preview area at the buttom of the Equation Editor.
• Save the new equation in the package you just created for this example.
• Click [New] to clear the equation editor.
• Create a second equation, loading the same notation and using the latex code
 0 = b\cdot ( y - (x)^{2} )
###### Creating the equation system
• Choose the EQSystem Editor in the Editor Bar on the top.
• First load the notation for this example in the same way it was done in the Equation Editor.
• Activate the tab Connected Elements and click [add].
• In the appearing dialog, click on [Change] next to the upmost field and select the first example for the Rosenbrock example.
• Click [Submit]. The equation should now be listed in the table.
• Add the second equation in the same way.
• Go to the tab “Description” and add an explanatory text for the equation system.
• Save the equation system in the package for this example.

Evaluating the equation system The evaluation of an equation system does two things: Firstly all necessary information is specified so that a complete simulation problem is formulated based on the equation system. Secondly code for the solution of the problem is generated and executed.

• Choose Evaluation Editor in the Editor Bar.
• In the tab Equation System click on [Change] and select the equation system that has been created in the last steps.
• In this example you can directly go to the tab Variable Specification. There you see a list that contains all the variables of the equation system.
• Move the variables a and b over into the list for the Design Variables by selecting them with the mouse and using the [>>] button. You will note that the Degree of Freedom is automatically updated.
• Set the design variables a and b by clicking into the value field.
• Go to the tab “Description” and add an explanatory text for the evaluation.
• Save the evaluation in the package for this example.
• Change to the Evaluation tab. If everything is ok, the [Generate Code] button should be activated. (Otherwise please have a look at the Status of Information in the middle of the editor where you find hints to solve the problem).
• In the drop down list Code Gen select the code generator GSL Hybrid.
• To create the problem solving code press [Generate Code].
• Press [Evaluate] to have the code executed on the server.
• Select the tab Results to have a look at the solution.