Illegal bounds on vector argument computing error

Use this forum to post Vensim related questions.
Post Reply
nzligul
Junior Member
Posts: 14
Joined: Thu Oct 27, 2022 12:10 pm
Vensim version: DSS

Illegal bounds on vector argument computing error

Post by nzligul »

Hello,

I am building a model that includes allocating the available supply based on the value (demand*price) of different markets. I use the ALLOCATION BY PRIORITY function, however, I receive two errors (1) "Illegal bounds on vector argument computing error" and (2)"Floating point error computing" for the same variable which tries to allocate by priority. My formulation is as below:

sales by market[Market, Product]=ALLOCATE BY PRIORITY(market demands[Market, Product], market priority[Market, Product], ELMCOUNT(Market), priority width, maximum shipment[Product])

Basically, I have different products and markets. For each product, my model should allocate the available supply based on market value (this is my priority). Other formulations are:
market priority[Market, Product]=value by market[Market, Product]/SUM(value by market[Market!, Product])
priority width = 1
maximum shipment[Product]= Inventory[Product]/shipment delay


In Vensim Help it states for ALLOCATE BY PRIORITY that " It works only when the left hand side, request and priority all have the same final subscript. " In my case, these subscripts are all [Market, Product]. Can you please help me to understand the problem?
Kind regards,
Nazli
Administrator
Super Administrator
Posts: 4844
Joined: Wed Mar 05, 2003 3:10 am

Re: Illegal bounds on vector argument computing error

Post by Administrator »

Can you upload the model? It's very difficult to offer any advice with just a couple of equations.

It may be that you need to re-order the subscript ranges to do what you need. This is just a guess though.
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
nzligul
Junior Member
Posts: 14
Joined: Thu Oct 27, 2022 12:10 pm
Vensim version: DSS

Re: Illegal bounds on vector argument computing error

Post by nzligul »

Hello,

My model is attached. Thank you.

Kind regards,
Nazli
Attachments
Pig Product Sales.mdl
(79.94 KiB) Downloaded 311 times
Kind regards,
Nazli
Administrator
Super Administrator
Posts: 4844
Joined: Wed Mar 05, 2003 3:10 am

Re: Illegal bounds on vector argument computing error

Post by Administrator »

Am I right in saying that you want to allocate "max shipment for spot sales" across the 5 markets?
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
nzligul
Junior Member
Posts: 14
Joined: Thu Oct 27, 2022 12:10 pm
Vensim version: DSS

Re: Illegal bounds on vector argument computing error

Post by nzligul »

Hello,

Yes, I want to allocate "max shipment for spot sales" based on the market value for each product. I have 5 different products and 5 markets. However, not all products are allocated to all 5 markets. For example, a product might be allocated to only 3 markets because the other 2 markets have zero demand (which results in a market value and priority of 0).
Kind regards,
Nazli
Administrator
Super Administrator
Posts: 4844
Joined: Wed Mar 05, 2003 3:10 am

Re: Illegal bounds on vector argument computing error

Post by Administrator »

I've made a few changes to the ordering of the subscripts that means now it hopefully works for you.

I'll try and explain the problem (it's tricky though).

ALLOCATE BY PRIORITY is a "vector" function, it expects to complete all elements of the variable at the same time. For example,

allocation[vec] = allocate......

All elements of "vec" are computed at the same time. So if you are allocating products to markets, markets needs to be the subscript element that is completed. So this works,
allocation[product,market] = allocate...
but this would fail as Vensim is trying to fill in the "product" vector, not the market one.
allocation[market,product] = allocate...

I hope this makes sense. It's important to get the subscript order the right way round when using the allocation functions.
Attachments
Pig Product Sales modified.mdl
(78.62 KiB) Downloaded 302 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/magazine-27509559
nzligul
Junior Member
Posts: 14
Joined: Thu Oct 27, 2022 12:10 pm
Vensim version: DSS

Re: Illegal bounds on vector argument computing error

Post by nzligul »

Thank you very much! I see that the order of the subscript matters. Now, my problem is solved.
Kind regards,
Nazli
Post Reply