is it possible to use neural network prediction model in Adaptive MPC ?

11 views (last 30 days)
In the recent MATLAB release, it is possible to use a neural network prediction model instead of a system model to obtain prediction matrices over a prediction horizon for NonLinear mpc . I am wondering whether it would be possible to use the same for an adaptive MPC case.

Accepted Answer

Emmanouil Tzorakoleftherakis
You should be able to do that, but we don't have an example to show the workflow unfortunately. You would first need to use automatic differentiation to get the A,B,C,D matrices using this command.
Then you would need to take the generated m-file and place it in a MATLAB Fcn block. An example of the latter is shown here.
Hope this helps
  2 Comments
Naveen kumar koritala
Naveen kumar koritala on 22 Nov 2023
Edited: Naveen kumar koritala on 22 Nov 2023
"the generate jacobain function" can only used for multi stage mpc. this function dont generate A,B,C,D matrices. can you please explain more clearly on how to get A,B,C,D matrices.
can i use generatematlabfunction? it will generate "state fcn" and "state fcn jacobian" functions from the estimated neural network model and "state fcn jacobian" can generate A,B,C,D matrices given state and input values. my doubt here is do i have to generate A,B,C,D matrices using "state fcn jacobian" at every time step during simulation of Adaptive MPC in matlab Fcn block ?
Emmanouil Tzorakoleftherakis
Edited: Emmanouil Tzorakoleftherakis on 22 Nov 2023
Please take a look at the links I provided more carefully. generateJacobianFunction (as the name implies) provides Jacobians. If you pass your dynamics as an argument, output will be a function that outputs Jx and Ju, aka A and B matrices. You can certainly use this function with multi-stage MPC, but at the end of the day it's just a function. You can tweak its signature and use it with adaptive MPC as well.
On a related note, generatematlabfunction could also potentially be used to calculate A and B, but it does not consider any MPC-specific circumstances, like for example having input disturbances in your prediction model. generatematlabfunction would not provide the correct matrices in scenarios like these. That said, you can use the generated 'state fcn' as input to 'generateJacobianFunction'. So the workflow would be:
  1. generatematlabfunction to get 'state fcn'
  2. use 'state fcn' as argument in 'generateJacobianFunction' to get linearization (if your MPC does not have disturbances, you can also potentially use the generated state fcn jacobian' from step 1 instead of this step)
  3. Tweak linearization function and place it in MATLAB Fcn block to use with adaptive MPC
To your last question, you don't need to call generateJacobianFunction at every time step, as the generation function is an analytical expression that depends on x and u. You can leverage this to get your linear system approximation as needed (for adaptive MPC this is required at every step).
Hope this helps

Sign in to comment.

More Answers (0)

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!