Potential bug in constant elasticity priority profile
Posted: Wed Jun 29, 2022 8:38 am
Hi Vensim developers and users,
I may have found a bug in the implementation of constant elasticity priority profile functions in Vensim.
I have been working with the ALLOCATE AVAILABLE function. I have seen that when the priority profile is a constant elasticity function (numeric value 5), there could be some discontinuities. The example below:
Produces the following output: This happens also when the constant elasticity function is mixed with other profiles:
I suppose that this happens because the image of this profile function, against the others, is not totally contained in the range [0, request] when pwidth != ppriority (i.e. image(priority_func(x)) != [0, request]);
This could easily be solved with a transposition for x and a redefinition for the second equation:
I suppose that a similar problem may happen with the constant elasticity supply function when using the many-to-many allocation.
I hope my explanation was clear.
Cheers,
Eneko
I may have found a bug in the implementation of constant elasticity priority profile functions in Vensim.
I have been working with the ALLOCATE AVAILABLE function. I have seen that when the priority profile is a constant elasticity function (numeric value 5), there could be some discontinuities. The example below:
Code: Select all
allocation[branch]=
ALLOCATE AVAILABLE(demand[branch], priority[branch,ptype], available)
~
~ |
available=
20*Time
~
~ |
branch:
Boston, Dayton, Fresno
~
~ |
demand[branch]=
500, 300, 750
~
~ |
pprofile:
ptype, ppriority, pwidth, pextra
~
~ |
priority[branch,pprofile]=
5,5,2,1;
5,7,4,2;
5,3,4,3;
~
~ |
Produces the following output: This happens also when the constant elasticity function is mixed with other profiles:
Code: Select all
allocation 0[branch]=
ALLOCATE AVAILABLE(demand[branch], priority 0[branch,ptype], available)
~
~ |
priority 0[branch,pprofile]=
3,5,1,0;
3,7,2,0;
5,3,2,3;
~
~ |
q(x) = q0 * (x/ppriority)^(-pextra) if x > pwidth
q(x) = q0 * (pwidth/ppriority)^(-pextra)if x <= pwidth
This could easily be solved with a transposition for x and a redefinition for the second equation:
See some examples for both definitions below:q(x) = q0 * ((x-pwidth+ppriority)/ppriority)^(-pextra) if x > pwidth
q(x) = q0 if x <= pwidth
I suppose that a similar problem may happen with the constant elasticity supply function when using the many-to-many allocation.
I hope my explanation was clear.
Cheers,
Eneko