Dakota/Matlab black box interface quick example for rosenbrock test function
Brian M. Adams
11/17/2005; updated 5/11/2009 to include Windows example

FILES: dakota_matlab_rosenbrock.in	sample Dakota input file
       dakota_matlab_rosenbrock.out	sample Dakota output

       matlab_rosen_bb_simulator.sh     analysis driver script called by Dakota
    OR matlab_rosen_bb_simulator.vbs

       matlab_rosen_wrapper.m           matlab wrapper called by script
       rosenbrock.m                     actual analysis driver (your program)
	  
EXECUTION:

This example presumes the Matlab executable is on the path.  If not,
you'll need to modify the matlab_rosen_bb_simulator.* to include the
explicit path to it.

To run the example (minimize rosenbrock function using CONMIN's FRCG alg.):

	dakota -i dakota_matlab_rosenbrock.in
	

Windows Example Step-by-Step:

1. Download and install Dakota for Windows from https://dakota.sandia.gov.
   These instructions assume you have installed to c:\dakota.

2. Unzip the attached Matlab example in a location of your choosing.
I'll assume C:\matlab_blackbox for convenience.

3. Open a Command Prompt.  Set the PATH to find Dakota:
	set PATH=C:\dakota\bin;%PATH%
  If this worked, typing 'dakota -v' should give you version information.

4. Start the Matlab automation server (you may need to make sure
Matlab is on your Windows PATH by default or add it locally in the
command window) and wait for the command window to appear (minimized):
  	matlab /automation

5. Edit dakota_matlab_rosenbrock.in for Windows.
   Locate these lines:

    # Use this line for Linux
          analysis_driver = 'matlab_rosen_bb_simulator.sh'	
  
    # OR use this line for Windows
      ## analysis_driver = 'cscript matlab_rosen_bb_simulator.vbs'	

   Add a # to the beginning of the line for the analysis_driver ending in 
   .sh in order to comment it out. Remove the ## from the line for the .vbs
   driver to uncomment it.

6. Run dakota on the sample problem:
	dakota dakota_matlab_rosenbrock.in

What's going on:
*. Dakota is repeatedly invoking 'cscript runmat.vbs' for function evaluations

*. This VBS script instructs Matlab to evaluate the
matlab_rosen_wrapper.m, which unpacks the Dakota parameters files and
invokes rosenbrock.m, which is a stand-in for your Matlab objective
function.

*. The wrapper then writes the results file for return to Dakota.


Linux/OS X Example Step-by-Step:

1. Download and install Dakota for Linux or OS X from https://dakota.sandia.gov.

2. Run dakota on the sample problem:
	dakota dakota_matlab_rosenbrock.in

What's going on:
*. Dakota is repeatedly invoking 'matlab_rosen_bb_simulator.sh' for function evaluations

*. This shell script instructs Matlab to evaluate the
matlab_rosen_wrapper.m, which unpacks the Dakota parameters files and
invokes rosenbrock.m, which is a stand-in for your Matlab objective
function.

*. The wrapper then writes the results file for return to Dakota.




TO DO:

- Include constraints, gradients, Hessians (if you have analytic
derivatives, you can return them to Dakota, though this example
doesn't demonstrate that).
