Using the Real-time Optimization Progress Plot#

The real-time optimization progress plot feature allows the user to see, in real-time, the progress of an optimization run by plotting design variables, constraints, and the objective.

There two different ways that the plot can be generated.

Running the plot as part of an optimization run#

Likely the most common way users will use this feature is to run the optimization script is using the opendmao rtplot subcommand.

openmdao rtplot path_to_script.py

This will run the optimization script and also automatically launch the plotting app in a browser window at the appropriate time during the optimization run.

The plot will then be periodically be updated as the results of driver iterations complete.

Important

Plotting of the driver iterations will only work if the script has a case recorder attached to the Driver.

Running the plot separate from an optimization run#

This is used when you want to directly point the plotting application at a case recorder file that contains driver iteration information.

For example, let’s say you have an optimization script named optimize_system.py. In that script, a case recorder is attached to the Driver like this:

prob.driver.add_recorder(SqliteRecorder("system_driver_recording.sql"))

if you run that script:

python optimize_system.py

The result will be a case recorder file in

optimize_system_out/system_driver_recording.sql

Then to see a plot of the optimization progress, or see the results after the script is complete:

openmdao realtime_opt_plot optimize_system_out/system_driver_recording.sql

Real-time Optimization Progress Plot User Interface#

The plot is very easy to use. Here is an example of what it can look like

real_time_optimization_progress_plot

Initially, only the objective is plotted. Additional variables can be plotted by clicking on the button containing their name in the list on the right. In the example above all of them have already been selected and plotted.

The objective axis is always on the left. Additional axes are created on the right as the user selects other variables to plot. The colors of the line, button, and axis label match.

The variables buttons also include information about the units and, if the variable is a vector, the shape of the vector.

For a design variable that is a vector, like z in the plot, the plot shows the range of all the values in the vector, with a solid fill between the min and the max values.

For constraints, if they are vectors, the plot shows the worst case constraint among the values of the vector, using the infinity norm function, which returns the maximum absolute value among all elements in the vector.

The optimization plot is created by running a small, local server using the Bokeh plotting library. To stop the server, the user can click on the Quit Application button in the upper right of the plot page.