Using Keras RNN model with gekko MPC

156 views
Skip to first unread message

Mikkel Brendstrup

unread,
Sep 30, 2020, 9:06:10 AM9/30/20
to apmonitor
Hi all

After playing around with ARX MPC I wanted to see how it perform against a RNN MPC. I am using apmonitor "TCLab G" and "LSTM Network" literature as basis however I have trouble seeing how to implement the keras model (which is saved in a .h5 file) into GEKKO MPC model. Would therefore be appreciated if I could get a pointer where to look, if it is even possible or even better show a example :) 

regards 
Mikkel B.

John Hedengren

unread,
Sep 30, 2020, 9:20:57 AM9/30/20
to apmo...@googlegroups.com

Mikkel,

 

Gekko doesn’t allow models from other packages. Here are two options:

 

  1. Convert the RNN model to Gekko format. There is an example of a Keras neural network model and Gekko neural network model here: https://apmonitor.com/do/index.php/Main/DeepLearning
  2. Use a shooting method for MPC with an optimizer like scipy.optimize.minimize(). There is an example of this approach at the bottom: https://apmonitor.com/pdc/index.php/Main/ModelPredictiveControl

 

Best regards,

 

John Hedengren | Associate Professor

Department of Chemical Engineering | Brigham Young University
330 Engineering Building | Provo, UT 84602 | john.he...@byu.edu

 

BYU PRISM Group: apm.byu.edu

Machine Learning with GEKKO: machinelearning.byu.edu 

--
--
APMonitor user's group e-mail list.
- To post a message, send email to apmo...@googlegroups.com
- To unsubscribe, send email to apmonitor+...@googlegroups.com
- Visit this group at http://groups.google.com/group/apmonitor
---
You received this message because you are subscribed to the Google Groups "apmonitor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apmonitor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apmonitor/a6915e50-dee4-42d0-a723-346003971e53n%40googlegroups.com.

Mikkel Brendstrup

unread,
Oct 1, 2020, 8:14:45 AM10/1/20
to apmonitor
Hi John,

Thank you for the fast response.

I was fearing that was the case. I will try look at the ANN example and see if I can get good prediction result for the dataset I am using. It might also give me ideas how to implement an lstm in gekko.

best regards,
Mikkel

Reply all
Reply to author
Forward
0 new messages