HS-1050: Minimization of External Rosenbrock Function
Learn how to optimize a 2D Rosenbrock function using Compose or Python.
This tutorial defines two input variables, labeled x and y, respectively.
The objective of the optimization is to minimize f(x,y)= 100*(y-x^2)^2 + (1-x)^2. The range for x and y is set to [-2 ; -2], and the start point is [-1 ; -1].
Perform the Study Setup
- Start HyperStudy.
-
Start a new study in the following ways:
- From the menu bar, click .
- On the ribbon, click .
- In the Add Study dialog, enter a study name, select a location for the study, and click OK.
- Go to the Define Models step.
-
Add a Parameterized File model.
-
Click Import Variables.
Two input variables are imported from the .tpl file.
- Go to the Define Input Variables step.
-
Change both input variable's lower, initial and upper bounds to the values
indicated in Figure 2.
Perform Nominal Run
- Go to the Test Models step.
-
Click Run Definition.
An approaches/setup_1-def/ directory is created inside the study Directory. The approaches/setup_1-def/run__00001/m_1 directory contains the input file, which is the result of the nominal run.
Create and Evaluate Output Responses
In this step you will create one output responses.
- Go to the Define Output Responses step.
- From the Directory, drag-and-drop the rosenbrock.res file, located in the approaches/setup_1-def/run__00001/m_1 directory, into the work area.
- In the File Assistant dialog, set the Reading technology to Altair® HyperWorks® and click Next.
- Select Single Item in a Time Series, then click Next.
-
Define the following options, and then click Next.
- Set Type to Unknown.
- Set Request to Block 1.
- Set Component to Column 1.
- Optional: Enter labels for the data source and output response.
-
Set Expression to First Element.
The expression changes to m_1_ds_1[0].
-
Click Finish.
Output response 1 is added to the work area.
-
Click Evaluate.
The value for expression m_1_ds_1[0] should be 404.0.
Run Optimization
-
Add an Optimization.
- In the Explorer, right-click and select Add from the context menu.
- In the Add dialog, select Optimization.
- For Definition from, select Setup and click OK.
- Go to the step.
- Click the Objectives/Constraints - Goals tab.
-
Add an objective to Response 1.
- Click Add Goal.
- In the Type column, select Minimize.
- Go to the step.
-
In the work area, set the Mode to Adaptive
Response Surface Method (ARSM).
Note: Only the methods that are valid for the problem formulation are enabled.
- Click Apply.
- Go to the Evaluate step.
- Click Evaluate Tasks.
- Optional:
Click the Iteration Plot tab to monitor the progress of
the optimization.
The iteration history shows a significant reduction in the objective value. The Rosenbrock function has a global minimum that is difficult for any optimizer to find due to its flatness in the area of the true optimum, and ARSM has not found the theoretical solution at (x,y)=(1,1).