Menu

#21 Incorrect handling if transition rates not integers

closed
5
2007-05-13
2007-05-13
No

If the rate for a timed or immediate transition is not an integer, the results will not be as expected.

For example, if you have two immediate transitions fed from a place, and the rates are 0.75 and 0.25 (in order to get a 75% / 25% split in firings, you will never have either transition fire in either the simulation module or in animation when using the "fire random" button.

If you have two immediate transitions fed from a place and the rates are 1.1 and 1.9, the result is the same as if you specified rates of 1.0 and 1.0. Only the integer portion of the rate is important.

As a third example, if you set the rates to 750 and 250 or 3 and 1 the ratio of firings will be the same, but the processing time to perform the random firing will be much longer in the case with 750 and 250.

Discussion

  • Dave Patterson

    Dave Patterson - 2007-05-13
    • status: open --> closed
     
  • Dave Patterson

    Dave Patterson - 2007-05-13

    Logged In: YES
    user_id=1609637
    Originator: YES

    The DataLayer class was changed in the fireRandomTransition method so it now handles non-integer rates on transitions. The algorithm no longer creates an ArrayList of Integer objects in proportion to the integer values of the rates of enabled transitions. It calculates the sum of the rates, selects a random value between zero and the sum of the rates, and then finds the transition that corresponds to that value.

    Thus, the computational time will be the same no matter how the rates are specified, and non-integer values are allowed.

     
  • Dave Patterson

    Dave Patterson - 2007-05-13

    Logged In: YES
    user_id=1609637
    Originator: YES

    The DataLayer class was changed in the fireRandomTransition method so it now handles non-integer rates on transitions. The algorithm no longer creates an ArrayList of Integer objects in proportion to the integer values of the rates of enabled transitions. It calculates the sum of the rates, selects a random value between zero and the sum of the rates, and then finds the transition that corresponds to that value.

    Thus, the computational time will be the same no matter how the rates are specified, and non-integer values are allowed.

     

Log in to post a comment.

Auth0 Logo