So I want to use Neural Network as my learned dynamic model function for MPC control in Python. I have not found any example/documention of doing this with open-source optimization packages like CASADI , GEKKO , do-mpc ? does any one have some reference/suggestion for achieving this? THANKS
Edit 01 a) I have tried CASADI + tensorflow model CASADI have a blog of how to use tensorflow model with CASADI. I am entirely not sure if I have done the implementation correctly as obviously I am not getting expected results. b) Upon looking on Internet there is "mpc. Pytorch" library which is a mpc toolbox which provides nn models as well. Not sure of its capability C) do-mpc which is based on CASADI is planning to integrate NN model. d) AS mentioned by @john gekko has the capability to use NN in mpc.
does any one know any other ways?
Here is an example with a Neural Network and MPC: TCLab G - Nonlinear MPC. A potentially better way is to use an LSTM to emulate control (PID or MPC) as shown in a series of articles in Towards Data Science or this course exercise on emulating a PID or MPC. This approach is also the basis for many explicit MPC publications that use methods for storage and retrieval of the solutions. I published an article on this method that includes a case study with ISAT and a Neural Network.
Hedengren, J. D. and Edgar, T. F., Approximate Nonlinear Model Predictive Control with In Situ Adaptive Tabulation, Computers and Chemical Engineering, Volume 32, pp. 706-714, 2008. Preprint
Using a storage and retrieval approach, you don't need to solve the MPC application each cycle, only use the machine learned prediction that is trained based on prior MPC moves.