# Vensim Help

 Navigation: Reference Guide > Functions > Allocation Functions ALLOCATE BY PRIORITY(request,priority,size,width,supply) ALLOCATE resource BY PRIORITY

This function is used to allocate a scarce supply to a number or requests based on the priority of those requests.  It works only when the left hand side, request and priority all have the same final subscript.  If supply is bigger than the sum of request over size elements then the requests are fulfilled (none are overfilled).  If supply is smaller then rationing occurs.  The way in which the rationing works is determined by the relative priorities and the width parameter.  The Allocation section in this manual details the algorithm used for this function.

request, priority

The first two arguments must be vectors (of length size).  That is, the (last) Subscript of request and priority must vary across the different demand elements.  The left hand side variable must also have its last subscript varying across the different demand elements.

IMPORTANT NOTEALLOCATE BY PRIORITY is sensitive to the order of subscripts!  If you have more than one subscript range in the variables you are using, the demand elements must be the last subscript for the left hand side variable, request and priority.

size is the number of elements across which allocation is being made.  Normally this is done using the ELMCOUNT function as in the example.  It can also be a number or a subscript constant.

width specifies how big a gap in priority is required to have the allocation go first to higher priority with only leftovers going to lower priority.   When the distance between any two priorities exceeds width and the higher priority does not receive its full request the lower priority will receive nothing.

supply is the total supply available to fulfill all requests.   If the supply exceeds total requests, all requests are filled, but none are overfilled.  If you wish to conserve material you must compute supply minus total allocations explicitly.

 Units: ALLOCATE BY PRIORITY(units, dimensionless, dimensionless, dimensionless, units) --> units

Example

country : US, CHINA, RUSSIA

 ~ index
 ~ countries over which a scarce resource

are to be allocated   |

desired[country] = 10, 2, 8

 ~ tons / month
 ~ desired amount of scarce resource |

priority[country] = 10, 10, 10

 ~ dimensionless
 ~ priority for receiving the resource; higher number indicates higher priority |

SUPPLY = 10

 ~ tons / month
 ~ available supply of resource |

WIDTH = 1

 ~ dimensionless
 ~ width for each priority rectangle |

delivered[country] = ALLOCATE BY PRIORITY( desired[country],

priority[country],ELMCOUNT(country), WIDTH, SUPPLY )

 ~ tons/month
 ~ amount of supply delivered to a specific country |

In this example, the supply of 10 tons/month is allocated to three countries having a total request for supply equaling 20 tons/month.  Because the priority of each is the same, each country will get the same fraction of their request (50% in the example).  If the priority had been higher for a specific country it would have received a greater than proportional share of the resource.

Availability: DSS and Professional only.

See also: ALLOC P, MARKETP, Allocation

Sample model: ALLOCATE BY PRIORITY.mdl in FunctionExamples