karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 2-28-2010 at 18:36 |
|
|
Optimize for particular value at a specific time
Greetings!
Please see the sample model I made; how can I optimize parameters to fulfill a value constraint and also a time constraint? I would like the
population to be near 300 by time 20 (months).
Thanks!
Karan
Attachment: Population_Optimize.zip (1.99kb)
This file has been downloaded 18 times
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 2-28-2010 at 20:47 |
|
|
I presume one way would be too end the simulation at the time of interest and values would be optimized accordingly.
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 2-28-2010 at 22:02 |
|
|
optimize
Hi Karan
You are right. You must put the final time equal 20 and optimize the population. But to optimize you must minimize the square of the difference
between the desired population and the population at the final time. You do not have to integrate the square values. You must calculate a payoff that
is equal to zero during the simulation and equal to the square at the end of the simulation and put that payoff in the vpd file with a weight of -1.
Look for 'payoff computation' in the Vensim help. The calculation of the payoff is explained.
Regards.
JJ
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-1-2010 at 07:44 |
|
|
Thanks JJ!
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 3-1-2010 at 08:42 |
|
|
optimize
Hi Karan
Obviously the interval of possible nutrition is not wide enough.
Joined a model where you can have a final time later than 20 and does the job. I was obliged to modify the lookup to make it compatible to the
extension of the interval of possible nutrition. Of course this is pure math and may not correspond to anything reality.
Regards.
JJ
Attachment: optimizelookup2.zip (6.62kb)
This file has been downloaded 16 times
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-1-2010 at 10:17 |
|
|
Thanks a lot JJ, yes it was just a trial to see if I could get fulfill a time constraint as well. I was just reviewing Geoff Coyle's book (the
section on optimizing) he defines the objective function as a level of a penalty, e.g. pen.k = pen.j +dt*(Desired Population - Population)^2: pen0 =
0. Then minimize the penalty. Would this not work?
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 3-1-2010 at 10:31 |
|
|
Optîmize
Hi Karan
I do not see any contradiction with Coyle's objective function.
Your objective is that at time 20 the population is equal to 300. One has then to define a payoff that is equal to 0 everywhere but when time = 20,
because Vensim integrates automatically the defined payoff in the vpd file. See the 'payoff computation' explanation in the Vensim help.
I have not Coyle's book with me at the time. See my u to U message.
Regards.
JJ
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-1-2010 at 11:07 |
|
|
Aha! JJ - Thank you!
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 3-1-2010 at 14:31 |
|
|
population
Hi Karan
I think that the specifications of your problem you start from are ideal. It is extremely simple which is very good and you can still spend quite a
lot of time, analyzing it and trying to test already at this level, the level of implementability which is fundamental if you want to build a useful
model later on. You can run sensibility analysis with the parameters, desired population, desired time, nutrition, lookup effect that should be
replaced by an algebraic formula to make sensibility analysis easier. Try all sorts of optimization. Build as many as possible reality checks (takes a
lot of time to be expert with it and preferable to test with very simple models) etc...
Contrary to what is commonly taught I have experienced that it is not necessary to include in a model, all the significant factors, nor extended
boundaries to be useful. Simplicity and undestandability is much more important than closeness to the reality even if the potential policies found at
this stage are not concretely implementable. But it should at least help to get a better overall view of the problem that will help greatly when
adding progressively later on more material to the model.
Regards.
JJ
|
|
|
tomfid
Senior Member
  
Posts: 171
Registered: 5-24-2006
Location: Montana, USA
Member Is Offline
Mood: Baffled
|
posted on 3-2-2010 at 22:51 |
|
|
[quote]pen.k = pen.j +dt*(Desired Population - Population)^2: pen0 = 0. [/quote]
You don't need to perform the integration step in Coyle's formula, because Vensim integrates payoffs for you. The equivalent would be:
*C
population|desired population/weight
If you make your weight something like PULSE( target_time, target_width) with target_time = 20, you can evaluate the fit near your desired time. Then
you don't have to stop the model at that point.
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-3-2010 at 07:42 |
|
|
Thanks Tom! I'm going to try it out. I presume the logic behind it is that, as the weight is multiplied to the payoff at each time step, the pulse
function forces the value of the payoff to be "x" at a particular time and zero elsewhere, which forces the optimizer to (if so desired) to minimize
the only non-zero in its calculation.
[Edited on 3-3-2010 by karankhosla]
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 3-3-2010 at 09:31 |
|
|
optimize
One can do the same with an interval of fitness with a small change on the previous model sent.
With an interval of two months lasting 5 months, one gets a value of nutrition of 13.51 with the interval and 13.58 with no interval.
Regards.
JJ
Attachment: population_optimize_3.mdl (3.97kb)
This file has been downloaded 15 times
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-3-2010 at 10:27 |
|
|
JJ That works very well too. Thank you.
|
|
|
LAUJJL
Senior Member
  
Posts: 696
Registered: 5-23-2003
Location: STRASBOURG FRANCE
Member Is Offline
Mood: good
|
posted on 3-3-2010 at 10:37 |
|
|
optimize
You can too try to keep the maximum difference within the fitness interval minimal.
It gives the following model that proves that there are many ways to skin a cat giving the same result than the optimize_2 model.
Regards.
JJ
Attachment: population_optimize_4.mdl (4.3kb)
This file has been downloaded 16 times
|
|
|
tomfid
Senior Member
  
Posts: 171
Registered: 5-24-2006
Location: Montana, USA
Member Is Offline
Mood: Baffled
|
posted on 3-10-2010 at 00:14 |
|
|
[quote][i]Originally posted by karankhosla[/i]
Thanks Tom! I'm going to try it out. I presume the logic behind it is that, as the weight is multiplied to the payoff at each time step, the pulse
function forces the value of the payoff to be "x" at a particular time and zero elsewhere, which forces the optimizer to (if so desired) to minimize
the only non-zero in its calculation.
[/quote]
That's right. It's also possible to use IF THEN ELSE and SAMPLE IF TRUE for similar purposes.
One caveat: using IF THEN ELSE to test for Time = desired time can fail unexpectedly, because of round off error in the accumulation of time steps.
That's why I used PULSE (which has logic to test for whether the next time interval includes the desired time) rather than IF THEN.
|
|
|
karankhosla
Senior Member
  
Posts: 77
Registered: 11-26-2008
Member Is Offline
Mood: No Mood
|
posted on 3-10-2010 at 17:31 |
|
|
Thanks Tom.
|
|
|