Two tools used in this course are MATLAB and Python. APMonitor is used as a toolbox in MATLAB or as a package within Python to provide support for solution of dynamic simulation, estimation, and control.
There are many tools for simulation and optimization of dynamic systems. There are also many factors to consider when selecting the appropriate tool for a particular task. Some of the considerations for a dynamic optimization tool are size (scaling with number equations and degrees of freedom), speed (use in real-time estimation or control), usability (training requirements and ease of adaptation), extensibility (ability to modify for new or complex systems), support (commercial sustainment or open-source community), and portability (ability to embed on a system or communicate with a particular platform).
The objective of this section is to introduce MATLAB and Python. This is not intended to be a general tutorial but more specifically to cover topics that are relevant for dynamic optimization. Topics of interest for dynamic optimization are listed below.
Introduction to Programming Languages
Many programming languages can be used in this course with examples in both MATLAB and Python programming languages. There are many resources to get started in MATLAB or get started with Python. There are also excellent resources for experienced MATLAB programmers who would like to learn Python such as Numpy for Matlab Users. The following videos give a brief introduction to MATLAB and Python including how to create a first program and debug the application by stepping through each line.
Introduction to Nonlinear Optimization
This course uses principles from nonlinear programming but does not delve into the details of solution strategies. Instead of detailing how a nonlinear programming solver iterates to find a solution, this course focuses on formulating problems and the use of differential constraints in describing and optimizing dynamic systems. For more background on how nonlinear programming solvers work, please see the Course on Optimization.
Contour plots are a powerful tool to visualize a feasible region (all potential solutions) and where the optimal solution is located relative to binding constraints. A two-bar truss optimization problem is solved with MATLAB and Python and visualized with contour plots that show binding constraints, objective values, and trade-offs between the design variables. While this problem is a static design optimization problem (no time-varation), the same methods can be applied to dynamic optimization.
A second example is a Linear Programming (LP) refinery problem where the balance between two crude supplies is optimized. This example shows a contour plot as the solver progresses towards an optimal solution.