The Rosenbrock function:
is used to test optimization problems. It's used in several examples in the Dakota documentation. Here, we'll perform a vector parameter study to attempt to find a minimum in the Rosenbrock function.
Start by importing the Dakota class. (Be sure you've first installed this package using the instructions in the README.)
In [ ]:
from dakotathon import Dakota
Create a Dakota instance to perform a vector parameter study on the Rosenbrock function.
In [ ]:
d = Dakota(method='vector_parameter_study', analysis_driver='rosenbrock')
Give labels to the variables of the Rosenbrock function, and define the initial point of the vector.
In [ ]:
d.variables.descriptors = ('x1', 'x2')
d.variables.initial_point = (-0.3, 0.2)
Define final point of the vector, as well as how many steps to take.
In [ ]:
d.method.final_point = (1.1, 1.3)
d.method.n_steps = 10
Set a name for the response variable from Dakota.
In [ ]:
d.responses.response_descriptors = 'y1'
Call the setup method to create files needed by Dakota, then run the experiment.
In [ ]:
d.setup()
d.run()
Check the output; in particular, the dakota.dat file.
In [ ]:
%cat dakota.dat