Subscript combinations as a variable

Use this forum to post Vensim related questions.
Post Reply
vpereira
Junior Member
Posts: 4
Joined: Mon Aug 11, 2014 6:39 pm
Vensim version: DSS

Subscript combinations as a variable

Post by vpereira »

Hello,

I am using Vensim 6.3 DSS, 32-bit, single-point precision. I am working on a large model involving several subscripts, which, due to custom functions involving matrix manipulations, is running really slow. I am interested in using the "Except" feature to avoid subscript combinations that are not possible, thus reducing the size of the matrices involved, and, hopefully, speeding up the model.

However, subscript combinations that are not possible change from simulation to simulation, so I don't want to hard code them into each equation. Instead, I would prefer to create a variable with the subscript combinations that are not possible and hard code this variable into the "except" box of all other variables in the model. is there a way to accomplish that? Thanks for the help!
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Subscript combinations as a variable

Post by tomfid »

EXCEPT statements are fixed. For some purposes, VECTOR SELECT might work for you (it doesn't execute elements that are 0 in the select statement). Or you might be able to use GET XLS SUBS.
Administrator
Super Administrator
Posts: 4592
Joined: Wed Mar 05, 2003 3:10 am

Re: Subscript combinations as a variable

Post by Administrator »

I cannot think of a way to do it.

Are you compiling your model? That can give a very big improvement in run speed.
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/magazine-27509559
vpereira
Junior Member
Posts: 4
Joined: Mon Aug 11, 2014 6:39 pm
Vensim version: DSS

Re: Subscript combinations as a variable

Post by vpereira »

Thanks for the quick replies. Based on your answers, it doesn't appear that there is an easy way of accomplishing what I need. I think that the best approach is for me to combine all subscripts into a single one. For instance, instead of having 3 subscripts Sub1: A,B,C; Sub2: D,E,F; and Sub3: G,H,I, and finding a way to tell Vensim which of those 3-letter combinations is not possible, having a single subscript, say Sub, with the only possible compinations, say A-D-G and C-D-I, for example. I will have to move some of the computations outside of the model, but it should be possible.

I am not compiling the model at this point, though that is the long-term plan. The problem, however, is in the custom functions which run out the compiled DLL file anyway. The large number of subscripts translate into large matrices, which, in turn, take a very long time to manipulate.
tomfid
Administrator
Posts: 3811
Joined: Wed May 24, 2006 4:54 am

Re: Subscript combinations as a variable

Post by tomfid »

Just in case you haven't discovered it, you can build up subscripts hierarchically, which might make the 1-dimension idea easier:

Code: Select all

thingsthatfly : airplane, helicopter
thingsthatroll : car, truck
transportmode: thingsthatfly, thingsthatroll
Post Reply