Page 1 of 1

Illegal bounds on vector argument computing error

Posted: Mon Jan 27, 2025 10:56 pm
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?

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 8:20 am
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.

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 8:37 am
by nzligul
Hello,

My model is attached. Thank you.

Kind regards,
Nazli

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 8:43 am
by Administrator
Am I right in saying that you want to allocate "max shipment for spot sales" across the 5 markets?

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 8:55 am
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).

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 8:56 am
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.

Re: Illegal bounds on vector argument computing error

Posted: Tue Jan 28, 2025 12:10 pm
by nzligul
Thank you very much! I see that the order of the subscript matters. Now, my problem is solved.