# Vensim Help

 Many-to-many Allocation

The many-to-many allocation problem takes the demand preferences of one or more consumers and the supply preferences of one or more providers and matches these.  We will discuss this as finding the price at which the supply, summed across all providers, equals the demand, summed across all consumers.  If you are working with true supply and demand curves that price is the standard market clearing price. If you are working with something else, such as matching of capacity and demand based on service quality, you may need to put a different interpretation on the resulting solution.

To solve the many-to-many allocation problem we first find the price that clears the market with the FIND MARKET PRICE function.  Once this is done we compute the amount supplied by the different providers using the SUPPLY AT PRICE function and the amount demanded by the different consumers using the DEMAND AT PRICE function.

supplier : s1,s2

demander : d1,d2,d3

pprofile : ptype, ppriority, pwidth, pextra

demand satiation[demander] = 500,300

Units: Widget/Month

Supply capacity[supplier] = 200,300,450

Units: Widget/Month

demand curve[d1,pprofile] = 3,5,2,0

demand curve[d2,pprofile] = 3,7,4,0

Units: \$/Widget

supply curve[s1,pprofile] = 3,1,2,0

supply curve[s2,pprofile] = 3,3,4,0

supply curve[s3,pprofile] = 3,5,4,0

Units: \$/widget

 market price = FIND MARKET PRICE(
 demand satiation[d1],demand curve[d1,ptype],
 supply capacity[s1],supply curve[s1,ptype])

Units: \$/Widget

 amount supplied[supplier] = SUPPLY AT PRICE(
 supply capacity[supplier],
 supply curve[supplier,ptype],
 market price)

Units: Widget/Month

 amount demanded[demander] = DEMAND AT PRICE(
 demand satiation[demander],
 demand curve[demander,ptype],
 market price)

Units: Widget/Month

The FIND MARKET PRICE function takes everything in and determines the price at which supply and demand will balance.  Note that the variable market price is not subscripted, and that only Subscript Constants (always the first element) appear on the right.  The DEMAND AT PRICE and SUPPLY AT PRICE functions, on the other hand, use the subscript range demander/supplier but the subscript constant ptype – just as the ALLOCATE AVAILABLE function did.

Just as for the ALLOCATE AVAILABLE function it is possible to have more subscripts, but these must come before the demander and supplier subscripts.  For example we might have market price[product] and then we would need demand satiation[product, demander], demand curve[product, demander,ptype] and so on.

Normally the FIND MARKET PRICE function will be able to find an internal solution at which demand and supply match.  If, however, any of the supply or demand curves are of type 0, then this may not be the case.  If no balance is found the function will return a very low (excess supply) or very high (excess demand) price.  If you are using some fixed demands or supplies you should check for this and use an ALLOCATE AVAILABLE function to deal with problems of misbalance.

One-to-many with FIND MARKET PRICE

In the above example there were 2 demanders and 3 suppliers.  If you only have 1 demander or supplier you can still use the FIND MARKET PRICE function.  You will need to create a subscript for the one agent such as

demander : d1

The rest works the same.