Ehtisham,
Your objective is correct if you are defining all of your time points but you would likely need to define your objective as m.Minimize((pgs[i]-pref[i])**2). If you let Gekko do the time discretization for you then you wouldn’t need the list comprehension:
m.Minimize((pgs-pref)**2)
Here are some other examples:
https://apmonitor.com/do/index.php/Main/DynamicEstimation
In these cases, you only need to define the variable once and Gekko takes care of all the time points.
-John Hedengren
From: apmo...@googlegroups.com <apmo...@googlegroups.com>
On Behalf Of Ehtisham Asghar
Sent: Friday, June 4, 2021 10:13 PM
To: apmonitor <apmo...@googlegroups.com>
Subject: [APM] Objective Function modeling
Hi all,
I am working on an optimization problem, in which objective is to minimize the change between a decision variable and a constant value over the span of 24 hr.
In above picture, I wanted pgs (decision variable) be remain close to the value of pref in each time slot. Means I want to minimize the difference between pgs and pref.
Can anybody tell me that objective function is defined right or not?
Regards,
Ehtisham
--
--
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/af6f69a4-b891-4328-b2df-c9cbbeeb0a37n%40googlegroups.com.
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/XLAflNV0eCI/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/BYAPR08MB4600392508DFEF0DABF288A8EE3A9%40BYAPR08MB4600.namprd08.prod.outlook.com.