Confusion about link betweek Gekko and APMonitor

103 views
Skip to first unread message

Sarah Maria Oud

unread,
Nov 24, 2020, 10:37:47 AM11/24/20
to apmonitor
I have currently worked out how to use Gekko purely to write and solve a set of N dynamic ODE's. But this takes very long. 

My questions are:

-What is the differences and similarities between GEKKO and APMonitor.
-I have seen that APM can be used by uploading the model (manually?) to the website by .apm, and since to create my model and stuff i have to use forloops and other functions which i do not know if i can directly write into an .apm file.
-Also Is there any way to run on the APM server? if it is a server. through python directly. 
would that be faster.
-Last question, how to do speed up the runs, currently for my most simple system it takes ~30 min but i do get the correct results.  Is there a way to tell it to parallelize when it can.

Thank you!
Sara

John Hedengren

unread,
Nov 24, 2020, 11:02:30 AM11/24/20
to apmo...@googlegroups.com

Sara,

 

You can often improve the simulation time by using IMODE=7 (Sequential solution) instead of IMODE=4 (Simultaneous solution). Here are some examples on solving with Gekko:

 

Solve Differential Equations with GEKKO (apmonitor.com)

 

I also recommend that you set disp=False to avoid the extra time for printing to the console when you solve with m.solve(disp=False). Gekko uses APMonitor as the solution engine. It is a newer interface to facilitate easier model construction and visualization of results. There are side-by-side comparisons of code for Python and Matlab in Gekko and APMonitor here: Formulation Strategies (apmonitor.com). Because they both use the same engine, there is typically little difference in performance. You can run without an internet connection in Gekko by using remote=False when you declare your model (m=GEKKO(remote=False)) or you can set up your own server in Windows or Linux: APMonitor Server for Windows and APMonitor Server for Linux. The easiest route to solve locally is to use Gekko either in Python GEKKO Optimization Suite — GEKKO 0.2.8 documentation or Matlab Call Python from MATLAB (apmonitor.com).

 

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/fecc0138-e5fe-40f8-a69d-37973ee7b850n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages