Doubts in process and results of dynamic optimization

63 views
Skip to first unread message

Omar Gutierrez Campana

unread,
Sep 15, 2021, 3:23:28 PM9/15/21
to apmonitor

Dear Professor Hedengren and developers, I hope you are doing good, I am new to using Python and even more so to using Gekko, I am very interested about the topic of optimization because it's a part of my master's project and more specifically optimization of a mass damper, where my inputs are random loads recorded previously at each time step, which will not change over the entire horizon. And the thing is, I want to optimize the combination of mass and length of the damper that minimize the maximum amplitude of displacement (negative or positive) of the main structure, the combination mass and length must not change along the horizon.

During the process, I had some problems regarding this, and I would like you to clarify and help me with the following questions:

1.       When my record is very large, for example 21000 data (time steps of 0.005sec), the optimizer does not calculate or takes time to calculate the number of variables, equations and others, I have to stop it, I don't know if I stop or have to wait longer.

2.      I understand that m.options.NODES is the number of points interpolated between each step of  time, but when I reduce to 2  my results improve, but they get away from the solution by integration of Runge Kutta of 4th order, I understand that Gekko solves by orthogonal colocation of finite elements, so maybe I'm misinterpreting that improvement of results.

3.      To minimize the maximum displacement of my main structure, I tried with two different goals, the first one to directly minimize my main displacement q1 through the expression (1000 * q1 ** 2) and the second way through minimizing the integral under the curve of q1, using the expression  for which I create an auxiliary variable x1=0.5*integral(q1**2)dt, with the first form my results are better, which I did not expect, so can you please suggest me some other way to minimize my goal?, which I will greatly appreciate.

4.      I also did the optimization with the Excel solver and I am getting some  improvement in the results, the difference is very little, but the truth is that I would like my results in Gekko to be better, so I thought that maybe I am configuring something wrong or I am not understanding well how Gekko is working.

With much respect I ask you please if you can check my code, to know if I am configuring correctly the commands, as the model should act, or am I wrong somewhere.

Finally, I would ask you please to authorize me to send you my code and input record, I don’t found the way to attach it here, I would like to upload it to the stackoverflow but as it is part of my Master's project and it is not finished yet, it is not possible for me, I gladly commit to upload it as soon as my work is finished.

Thank you very much and I look forward to your response.

Omar.

Figure_1.pngFigure_2.png

John Hedengren

unread,
Sep 15, 2021, 3:34:26 PM9/15/21
to APM Google Groups
Omar,

Thanks for sharing the highlights of your project with us. I personally receive many requests each week to help with specifics of projects. Unfortunately, I don't have time to give each one the attention it deserves. I can share general strategies and resources that may help you with the details.
  • Is there a simplified version of your project that you can share on StackOverflow? It is best to reduce the problem down to a simple problem that shows the issue.
  • There are additional details on Orthogonal Collocation (and how to replicate it in another environment, such as Excel): https://apmonitor.com/do/index.php/Main/OrthogonalCollocation
  • Try subsampling the data with data = data[::100] (to use every 100th) point and then data=data[::20] (to use every 20th point), etc. You'll see a trend on how long it takes for the solver to complete the problem and help you extrapolate how long it should take.
  • Another potential for minimizing q1 is to set it as a CV and then set upper and lower bounds (q1.SPHI = 1; q2.SPLO=-1) with an adjustable penalty for violating the limits (q1.WSPLO=100; q1.WSPHI=100). There is more information on setting up CVs here: https://apmonitor.com/do/index.php/Main/ControllerObjective
I hope these suggestions help.

Best regards,
John Hedengren

--
--
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/7eb06cea-c770-4cb3-af0b-36749ad9cc01n%40googlegroups.com.


--
Best regards,

John Hedengren
GEKKO Optimization Suite

Omar Gutierrez Campana

unread,
Sep 16, 2021, 11:56:54 AM9/16/21
to apmo...@googlegroups.com
Dear Professor Hedengren, thank you very much for your recommendations, I will take them into account and try to improve my goals. I wish all the best for you and I thank you very much for the development of Gekko, it is an impressive tool, thank you very much. 

You received this message because you are subscribed to a topic in the Google Groups "apmonitor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/apmonitor/ZF4QfQcz6A8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to apmonitor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/apmonitor/CAGNFaLEsYsS441vWK6ON71dg_X4FpUgMUAV93SRqyFG60oDU5w%40mail.gmail.com.


--
Omar Gutierrez Campana 
Mestrando em Engenharia Civil - Estruturas EPUSP 
cel. +51 994610663 (Perú)
WhatsApp  +51 994610663
Reply all
Reply to author
Forward
0 new messages