# Summary
Find the values of model variables that minimize the response of an
analytical model when variables are bounded and derivatives of the
response are not available.
 
### Run Dakota
    $ dakota -i dakota_opt_apps_bounds.in -o dakota_opt_apps_bounds.out
 
# What problem does this solve?
The goal is to find the variable values that yield the minimum value
of an analytical model known as Rosenbrock's function.  The model has
two continuous variables that are bounded above and below, and
derivatives of the function are not available.
 
## Math Equation
Mathematically, the problem described above is defined as follows:

_minimize:_ $` \qquad \qquad f(x_1,x_2)=100(x_2-x_1^2)^2+(1-x_1)^2 `$

_subject to:_ $` \qquad \qquad -2 \le x_1 \le 2 `$

$` \qquad \qquad \qquad \qquad -2 \le x_2 \le 2 `$

# What method will we use?
This example employs Asynchronous Parallel Pattern Search, which is a
derivative-free optimization method.  The reason for using this method
here is the fact that derivatives of the function are not available.
Other scenarios in which this method is a good choice include when the
response is discontinuous, non-smooth, or noisy.  The essence of how
Asynchronous Parallel Pattern Search works entails constructing a
stencil in the coordinate directions around the user-specified initial
variable values and iteratively moving that stencil through space
until finding and zooming in on the minimum response value.  While not
demonstrated in this example, this approach naturally lends itself to
taking advantage of Dakota ability to perform evaluations
concurrently.
 
## Analysis Driver
The analysis driver for this example is one of Dakota's built-in
functions.  As such, a separate driver is not provided.  However, to
briefly summarize, the driver 1) takes in variable values generated by
Dakota, 2) computes the value of the mathematical function defined
above using those values, and 3) provides the resulting response value
back to Dakota.

### Inputs

The rosenbrock function has two inputs.

### Outputs

The rosenbrock function has one output.



# Interpret the results

The output generated by Dakota can be found in
`dakota_opt_apps_bounds.out` and `dakota_opt_apps_bounds.dat`.  The 
former is specified in the command to run Dakota and captures output that
would be printed to the screen if not directed to an output file on
the command line.  The latter is specified in the Dakota input file
and contains a list of variable values with corresponding response
values.  This format is convenient for ingestion into other tools for
plotting (e.g., Excel, MATLAB, etc.)
 
## Screen Output
The output below appears at the end of dakota\_opt\_apps\_bounds.out (or
screen output if it hasn't been redirected on the command line).  It
includes the final variable values and corresponding response value.
```
<<<<< Function evaluation summary: 2000 total (2000 new, 0 duplicate)
<<<<< Best parameters          =
                      9.0502929688e-01 x1
                      8.1860351562e-01 x2
<<<<< Best objective function  =
                      9.0419506706e-03
<<<<< Best evaluation ID: 2000


<<<<< Iterator asynch_pattern_search completed.
<<<<< Environment execution completed.
DAKOTA execution time in seconds:
  Total CPU        =       1.33 [parent =    1.33629, child =  -0.006294]
  Total wall clock =    1.57401
```

The image below shows an example of how data in
dakota\_opt\_apps\_bounds.dat can be viewed.  It shows the histories of
the variable and response values over the course of the optimization.
Note on the leftmost plot that the response values reach an asymptote.
This serves as visual evidence that the optimization method has
reached a solution.  This particular image was generated using
simplistic legacy Dakota graphics, but similar plots can be generated
in other tools, including the Dakota GUI.

![Optimization Trajectory](dak_graphics_ps_opt.png)

---
