How to pick the minimum value from say 6 values?

Use this forum to post Vensim related questions.
Post Reply
krreddi
Member
Posts: 39
Joined: Sat May 16, 2009 9:03 pm

How to pick the minimum value from say 6 values?

Post by krreddi »

I have my model calculating 6 variables dynamically. I want to select the least value of these variables at a particular point of time. I want to know if there is any direct function to do this are we need to put up our own lops?.

Thanks
Krishna.
Administrator
Super Administrator
Posts: 4841
Joined: Wed Mar 05, 2003 3:10 am

Post by Administrator »

You can nest the MIN statements,

MINVALUE = MIN ( val1, MIN ( val2 , val3 ))

Alternatively you can write a macro

:MACRO: MIN6(val1,val2,val3,val4,val5,val6)
MIN6 = min(val1,min(val2,min(val3,min(val4,min(val5,val6)))))
~ val1
~ |

:END OF MACRO:
LAUJJL
Senior Member
Posts: 1477
Joined: Fri May 23, 2003 10:09 am
Vensim version: DSS

minimum value

Post by LAUJJL »

I you have at least the Pro Vensim version you can too put the 6 variables in an array variable with 1 subscript having 6 possible values like value = (v1-v6) then calculate the minimum of the arrays values minimum = vmin(variable[value!]).
Regards.
JJ

[Edited on 2-3-2010 by LAUJJL]
krreddi
Member
Posts: 39
Joined: Sat May 16, 2009 9:03 pm

Post by krreddi »

Thanks for your replies. I am using second option gathering the values in subscripts and using the subscript values.
Post Reply