optimization
optimization
Dear Admins and Users, I reproduced in Vensim the BangBang Control Problem, described here:
https://excelworks.com/manual/ocpex1
The optimization results are quite close to the reference. I would like to define in a more efficient manner the control efforts ui at time points (ui,ti), but not as in the file  u1, u2,..., bounded to the time values by multiple IF THEN ELSE functions.
Please help. I am attaching all the necessary files.
Thanks
https://excelworks.com/manual/ocpex1
The optimization results are quite close to the reference. I would like to define in a more efficient manner the control efforts ui at time points (ui,ti), but not as in the file  u1, u2,..., bounded to the time values by multiple IF THEN ELSE functions.
Please help. I am attaching all the necessary files.
Thanks
 Attachments

 dynopt.zip
 (27.6 KiB) Downloaded 188 times

 Super Administrator
 Posts: 4671
 Joined: Wed Mar 05, 2003 3:10 am
Re: optimization
Sorry, I don't understand your question at all.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
Re: optimization
Maybe the VECTOR LOOKUP function? https://www.vensim.com/documentation/fn ... ookup.html
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: optimization
Maybe, but I'm not sure how to apply it in this case. Аny more detailed hint?tomfid wrote: ↑Sun Jun 25, 2023 5:28 pm Maybe the VECTOR LOOKUP function? https://www.vensim.com/documentation/fn ... ookup.html
Re: optimization
Hi
Are you a researcher or are you working wth optimal control problems applied to real problems with planned implementation?
In the second case, i use mainly dynamic programming methods (ref Bertsekas from MIT) and Vensim is very well adapted.
If you are working on real cases to be implemented, we can exchange experiences.
JJ
Are you a researcher or are you working wth optimal control problems applied to real problems with planned implementation?
In the second case, i use mainly dynamic programming methods (ref Bertsekas from MIT) and Vensim is very well adapted.
If you are working on real cases to be implemented, we can exchange experiences.
JJ
Re: optimization
Dear JJ, For now, I am interested in this field for educational purposes only. I'm hoping to get more indepth information about the optimization, as the Vensim help isn't helping me enough.

 Super Administrator
 Posts: 4671
 Joined: Wed Mar 05, 2003 3:10 am
Re: optimization
I think it would help if you provided a lot more detail on your original question. I don't understand it, so cannot offer any advice at all.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
Re: optimization
Hi
Help yourself and heaven will help you.
I took a look at your model.
Several remarks.
First there are no units in you model: a sign of a complete beginner in Vensim.
Set the stricte unit testing on in the units equivalent window.
Correct units is mandatory.
Secondly!
You should simplifiy your model to make it more understandable.
Why not reduce the u1  u20 to u1  u2 only?
You should use too subscripts to simplify your equations in particular the "u" one.
Doing that may help you find what is wrong and may help too somebody else to help you.
JJ
Help yourself and heaven will help you.
I took a look at your model.
Several remarks.
First there are no units in you model: a sign of a complete beginner in Vensim.
Set the stricte unit testing on in the units equivalent window.
Correct units is mandatory.
Secondly!
You should simplifiy your model to make it more understandable.
Why not reduce the u1  u20 to u1  u2 only?
You should use too subscripts to simplify your equations in particular the "u" one.
Doing that may help you find what is wrong and may help too somebody else to help you.
JJ
Re: optimization
Hello,
I would like to state that my model is functioning correctly and successfully reproduces the example specified in the reference webpage.
Units are not mandatory. On the contrary, only the inexperienced use the units. For the rest, the SI base units (kg, m, s, A, K, mol, cd) are sufficient to define in their mind every other derivative unit and work without errors without using any units. About the meaninglessness of the units in this case, I will point out that if we put the units in the specified objective function, it turns out that we are adding "kilograms to meters".
My question is how to utilize subscripts to define the optimization task in a more rational way. I am sure that the respected admin understood my question from the start. In my opinion, remarks like "I don't understand the question", "cannot offer any advice at all", "heaven will help you" are unsuitable for a SUPPORT forum.
Regarding optimization in Vensim, there is very little information. The help system is poor. In general, there are almost no examples of optimization. Yes, the heaven will help me, but I'm on the Vensim support forum, and SUPPORT means help in this case or some practical and useful advice. Demonstration of superiority over a user is inappropriate.
I'm not a newbie, I've been using the program for a long time for certain things. There are many bugs in the program, I don't even want to report them. Even though I'm a newbie, the answer in the official forum can't be  "heaven will help you". Developers beautify the interface, but do not increase the functionality of the program. For example, the graph settings are so rudimentary that it is not possible to make or export a graph that is suitable for a journal publication.
I don't think I should invest anymore efforts and money in a program where it is not possible to get help for basic things.
Thanks
I would like to state that my model is functioning correctly and successfully reproduces the example specified in the reference webpage.
Units are not mandatory. On the contrary, only the inexperienced use the units. For the rest, the SI base units (kg, m, s, A, K, mol, cd) are sufficient to define in their mind every other derivative unit and work without errors without using any units. About the meaninglessness of the units in this case, I will point out that if we put the units in the specified objective function, it turns out that we are adding "kilograms to meters".
My question is how to utilize subscripts to define the optimization task in a more rational way. I am sure that the respected admin understood my question from the start. In my opinion, remarks like "I don't understand the question", "cannot offer any advice at all", "heaven will help you" are unsuitable for a SUPPORT forum.
Regarding optimization in Vensim, there is very little information. The help system is poor. In general, there are almost no examples of optimization. Yes, the heaven will help me, but I'm on the Vensim support forum, and SUPPORT means help in this case or some practical and useful advice. Demonstration of superiority over a user is inappropriate.
I'm not a newbie, I've been using the program for a long time for certain things. There are many bugs in the program, I don't even want to report them. Even though I'm a newbie, the answer in the official forum can't be  "heaven will help you". Developers beautify the interface, but do not increase the functionality of the program. For example, the graph settings are so rudimentary that it is not possible to make or export a graph that is suitable for a journal publication.
I don't think I should invest anymore efforts and money in a program where it is not possible to get help for basic things.
Thanks

 Super Administrator
 Posts: 4671
 Joined: Wed Mar 05, 2003 3:10 am
Re: optimization
You are correct, they are not mandatory. They do give some confidence to a user that the model passes the most basic of tests though. And you are very wrong when you say only the inexperienced use units. This link demonstrates just how important they are https://www.bbc.co.uk/news/magazine27509559
I really don't understand. I've never heard of the bang bang control problem, and looking at the model, it is not obvious to me what any of the parameters are or what is even being optimised.
I'm sure you appreciate that we do help as many people as we can on the forum. And I'd like to help here too, I really do not know where to start though. If you can describe in more detail what you are trying to do, I'm sure we can help.
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559

 Super Administrator
 Posts: 4671
 Joined: Wed Mar 05, 2003 3:10 am
Re: optimization
I've had an attempt at simplifying things.
First, define "U" as a vector and then use VECTOR LOOKUP (this is what Tom suggested in an earlier post).
I'm only guessing though, I still have no idea what this model is attempting to do.
First, define "U" as a vector and then use VECTOR LOOKUP (this is what Tom suggested in an earlier post).
I'm only guessing though, I still have no idea what this model is attempting to do.
 Attachments

 optim.voc
 (553 Bytes) Downloaded 176 times

 dynopt_IF.mdl
 (7.98 KiB) Downloaded 183 times
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine27509559
Re: optimization
Thanks! That concludes my question. I'm sure many users will be grateful to you.
Even though your post makes my explanation meaningless, I'm posting it.
====
I will try to formulate my question better (please be lenient, English is a foreign language to me).
We have some dynamic system on which a control effort is applied, which transforms the system from one state to another. Whether it's bangbang control or something else  it doesn't matter. This control effort u is a function of time. It is discretized and represented as a set of points (ui, ti), where ui are the variables in the optimization problem that must be determined in order to find the optimum of the objective function. I did this in the simplest and laborious way possible by defining 20 variables u1, u2,...+IF THEN ELSE functions. My question is purely technical  can I represent the optimization variables ui in another way (for example  by subscripts). Can subscripts be used in optimization tasks? From the above answers I understood that through the subscripts and Vector Lookup function the control effort points can be defined. Perhaps the question is elementary for experienced users, but still it is not possible for all of us to be equally smart and know everything. However, this is a SUPPORT forum and maybe it is acceptable to have stupid questions from time to time. Also, I'm sure many people are interested in having more optimization examples posted.
So the final question is, can you use my model to show how to do this using subscripts? If this is very difficult, I would appreciate just some advice.
===
Thanks again
Even though your post makes my explanation meaningless, I'm posting it.
====
I will try to formulate my question better (please be lenient, English is a foreign language to me).
We have some dynamic system on which a control effort is applied, which transforms the system from one state to another. Whether it's bangbang control or something else  it doesn't matter. This control effort u is a function of time. It is discretized and represented as a set of points (ui, ti), where ui are the variables in the optimization problem that must be determined in order to find the optimum of the objective function. I did this in the simplest and laborious way possible by defining 20 variables u1, u2,...+IF THEN ELSE functions. My question is purely technical  can I represent the optimization variables ui in another way (for example  by subscripts). Can subscripts be used in optimization tasks? From the above answers I understood that through the subscripts and Vector Lookup function the control effort points can be defined. Perhaps the question is elementary for experienced users, but still it is not possible for all of us to be equally smart and know everything. However, this is a SUPPORT forum and maybe it is acceptable to have stupid questions from time to time. Also, I'm sure many people are interested in having more optimization examples posted.
So the final question is, can you use my model to show how to do this using subscripts? If this is very difficult, I would appreciate just some advice.
===
Thanks again
Re: optimization
There are a couple other ways to solve this problem, closely related to VECTOR LOOKUP:
https://metasd.com/2018/02/polynomials ... ionrules/
The reason you don't see this done much is that decision rules that are based on a vector of time points are not very general. They solve one instance of a problem, but they aren't necessarily robust to different parameters or initial states of the system. If it's possible to think up a decision rule that is a function of the system states, that's almost always preferable.
That said, I agree that it would be nice to have more examples of this kind of usage in the Help system.
FWIW in commercial practice, we consider units mandatory. https://metasd.com/2023/02/checkunits2023edition/
https://metasd.com/2018/02/polynomials ... ionrules/
The reason you don't see this done much is that decision rules that are based on a vector of time points are not very general. They solve one instance of a problem, but they aren't necessarily robust to different parameters or initial states of the system. If it's possible to think up a decision rule that is a function of the system states, that's almost always preferable.
That said, I agree that it would be nice to have more examples of this kind of usage in the Help system.
FWIW in commercial practice, we consider units mandatory. https://metasd.com/2023/02/checkunits2023edition/
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/