Buckets and Balls Atomic Formalism

From Mobius Wiki
Revision as of 22:15, 4 November 2014 by Kjkeefe (talk | contribs) (Buckets and Balls)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Buckets and Balls

Another formalism supported by Möbius is that of Buckets and Balls. Buckets and Balls provides a method for modeling simple systems for which a SAN might not be necessary.

Buckets and Balls primitives

Buckets and Balls consists of two primitive objects: buckets and transitions. Buckets represent the current state of the system, and transitions represent activities and are used to change the state of the system.


Buckets

Buckets are used to represent the state of the model. In the editor, they are represented graphically as circles. Each bucket can contain a certain number of balls, which are used to indicate system state. All balls in a given bucket are assumed to be homogeneous. Thus only the current number of balls in a given bucket is known; there is no method for distinguishing one ball from another in a given bucket.

The meaning of the state of a given bucket is arbitrary. It could just as easily be jobs in a queue, failures propagating through a system, or an inventory model, for example.


Transitions

Transitions represent events that can change the state of the system. There are two types of transitions available for the Buckets and Balls formalisms: timed and instantaneous. Timed transitions are fired according to their time distribution functions. Transition time distribution functions can be any generally distributed random variables and can be dependent on both variables and the current state of the system. All transitions are represented graphically as lines with arrows indicating the direction of the transition. Timed transitions fire at their generated event times. Instantaneous transitions complete immediately when enabled by the system. It is important to note that only one instantaneous transition may fire from a given bucket at any one time. As there are often many transitions from a single bucket, it is necessary to determine an order for the firings. This order is determined based on the transitions’ weights and ranks. For each rank, all transitions are considered and identified as valid or invalid; the order in which the valid transitions are fired is determined probabilistically. If no valid transitions exist of a given rank, those of a lower rank are considered in the same manner. After a timed transition fires, instantaneous transitions will continue to fire until no more are valid, at which point the model will activate the next timed transition on the event list and proceed as before.

Editor

This section covers the atomic formalism of Buckets and Balls including the creation, editing, and manipulation of atomic models using the Möbius Buckets and Balls editor. Refer to Section 2 for details on how to create and open a Buckets and Balls model.


<figure id="fig:atomic_bucketsballs_editor">

Atomic bucketsballs editor.png


<xr id="fig:atomic_bucketsballs_editor" nolink />: Buckets and Balls editor.
</figure>


As in the SAN model editor, the name of the selected project appears in the top left corner along with the name of the current atomic model. The grid in the center of the interface is the drawing area and is initially blank for a newly created model. Drop-down menus are listed horizontally at the top of the active window and contain tools and options for working with the Buckets and Balls formalism. Some of the menus are common to all model editors in Möbius; please see Section 3.1 for a detailed description of these common editor functions.

Edit

The Buckets and Balls formalism has no unique features in the Edit menu; all functions are the same as those described in Section 3.1.

View

The view menu for the Buckets and Balls formalism is identical to that found in the SAN formalism. Please refer to Section 4.2.4 for more information on the options provided in this menu.

Elements

Elements are Buckets and Balls model primitives. The Elements menu includes the following types of elements:

  • Bucket, which will be represented by a blue circle.
  • Timed Transition, which will be represented by a black line with an attached arrow indicating the direction of the transition.
  • Instantaneous Transition, which will also be represented by a black line with an attached arrow indicating the direction of the transition.

Buckets and Balls model elements can be selected either through the menu item Elements or via the icons below the menu. To place one of these components, simply click on it, move it to the desired location, and place it by clicking the left mouse button. A dialog box will then appear, requesting that you specify the attributes related to the element’s type. As with the SAN model formalism, all names must be unique across the atomic model. All names must also conform to C++ variable naming conventions. For more information on placing transitions, please see the subsection on arcs and lines below.


Buckets

When you are creating or editing a bucket (which you do by right-clicking on the bucket and selecting Edit in the pop-up window), a dialog box similar to the one illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_attribute" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_attribute">

Atomic bucketsballs editor bucket attribute.png


<xr id="fig:atomic_bucketsballs_editor_bucket_attribute" nolink />: Buckets and Balls bucket editor.
</figure>


  • The Name text box allows you to modify the name of the bucket, provided the new name is still unique in the current model.
  • The Ball(s) section of the dialog contains a radio button to allow you to select either a constant or variable to represent the number of balls in this bucket.
– If Constant is selected, you must enter a non-negative short integer, that is any number greater than or equal to zero and less than or equal to 32,767.
– If Variable is selected, you must enter a global variable of the type short.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear, indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Timed transition

When you are creating or editing a timed transition (which you do by right-clicking on a timed transition and clicking on Edit in the pop-up window), a dialog box similar to that illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes">

Atomic bucketsballs editor bucket timedtrans attributes.png


<xr id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes" nolink />: Buckets and Balls timed transition editor.
</figure>


  • The Name text box allows you to modify the name, provided that the new name is unique in the current model.
  • The Arc Cardinality text box allows you to set the number of balls transferred by the timed transition when it fires. Note: the transition will not occur for a given bucket if the number of balls in the bucket is less than the number set in this text box.
  • The Time distribution function section of the dialog contains a pull-down menu of the general distributions available for a timed transition and a Parameters button that opens a dialog to allow you to parameterize the selected distribution. Section 1.2.5 of Modeling Background describes the distribution functions for timed activities in Möbius along with their parameters. The parameters can be expressions, global variables of type double, or a series of statements. As with the SAN atomic models, if a series of statements is used, you must provide a return statement with a double-precision value for the parameter.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear, indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Instantaneous transition

When you are creating or editing an instantaneous transition (which you do by right-clicking on an instantaneous transition and clicking on Edit in the pop-up window), a dialog box similar to that illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes">

Atomic bucketsballs editor bucket insttrans attributes.png


<xr id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes" nolink />: Buckets and Balls instantaneous transition editor.
</figure>


  • The Name text box allows you to modify the name, provided that the new name is unique in the current model.
  • The Arc Cardinality text box allows you to set the number of balls transferred by the timed transition when it fires. Note: the transition will not occur if the number of balls is less than the number listed in the text box.
  • The Weight text box allows you to set a probabilistic weight for the transition (as only one transition may be selected out of each bucket), these weights will be normalized for all transitions of the specified rank for a given bucket. The weight may be expressed as a variable or as a double-precision value.
  • The Rank text box allows you to set the rank of this transition, indicating its priority with respect to the bucket of origin. Higher-valued ranks will be selected first unless they cannot fire, in which case lower-valued ranks will be selected. Rank may be expressed as a variable or a constant.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Arcs and lines

In Buckets and Balls models, as in SAN models, there are three arc drawing tools at your disposal: straight, spline, and connected lines. In a Buckets and Balls model, these arcs define the timed and instantaneous transitions. In order to draw an arc, you simply select one of the arc tools with the left mouse button. Move the mouse to a bucket and click with the left mouse button to set the origin bucket for the transition. If you are drawing a spline or connected line, click the left mouse button in the drawing area to set control points. Finally, click the left mouse button on the destination bucket to create the transition arc. If at any point you wish to cancel the arc, right-click on the drawing area. Arcs may overlap other objects and other arcs. All arcs and lines are directed, and therefore must have both of their endpoints anchored at buckets.


Text boxes

As in the SAN model editor, text boxes have been provided to allow programmers to write comments about different aspects of their models within the drawing area. These comments have no effect whatsoever on the functioning of the model, although they may help another programmer understand the model. For more information on creating and editing text boxes, please see “Text boxes” in Section 4.2.5.

Buckets and Balls[edit]

Another formalism supported by Möbius is that of Buckets and Balls. Buckets and Balls provides a method for modeling simple systems for which a SAN might not be necessary.

Buckets and Balls primitives[edit]

Buckets and Balls consists of two primitive objects: buckets and transitions. Buckets represent the current state of the system, and transitions represent activities and are used to change the state of the system.


Buckets[edit]

Buckets are used to represent the state of the model. In the editor, they are represented graphically as circles. Each bucket can contain a certain number of balls, which are used to indicate system state. All balls in a given bucket are assumed to be homogeneous. Thus only the current number of balls in a given bucket is known; there is no method for distinguishing one ball from another in a given bucket.

The meaning of the state of a given bucket is arbitrary. It could just as easily be jobs in a queue, failures propagating through a system, or an inventory model, for example.


Transitions[edit]

Transitions represent events that can change the state of the system. There are two types of transitions available for the Buckets and Balls formalisms: timed and instantaneous. Timed transitions are fired according to their time distribution functions. Transition time distribution functions can be any generally distributed random variables and can be dependent on both variables and the current state of the system. All transitions are represented graphically as lines with arrows indicating the direction of the transition. Timed transitions fire at their generated event times. Instantaneous transitions complete immediately when enabled by the system. It is important to note that only one instantaneous transition may fire from a given bucket at any one time. As there are often many transitions from a single bucket, it is necessary to determine an order for the firings. This order is determined based on the transitions’ weights and ranks. For each rank, all transitions are considered and identified as valid or invalid; the order in which the valid transitions are fired is determined probabilistically. If no valid transitions exist of a given rank, those of a lower rank are considered in the same manner. After a timed transition fires, instantaneous transitions will continue to fire until no more are valid, at which point the model will activate the next timed transition on the event list and proceed as before.

Editor[edit]

This section covers the atomic formalism of Buckets and Balls including the creation, editing, and manipulation of atomic models using the Möbius Buckets and Balls editor. Refer to Section 2 for details on how to create and open a Buckets and Balls model.


<figure id="fig:atomic_bucketsballs_editor">

Atomic bucketsballs editor.png


<xr id="fig:atomic_bucketsballs_editor" nolink />: Buckets and Balls editor.
</figure>


As in the SAN model editor, the name of the selected project appears in the top left corner along with the name of the current atomic model. The grid in the center of the interface is the drawing area and is initially blank for a newly created model. Drop-down menus are listed horizontally at the top of the active window and contain tools and options for working with the Buckets and Balls formalism. Some of the menus are common to all model editors in Möbius; please see Section 3.1 for a detailed description of these common editor functions.

Edit[edit]

The Buckets and Balls formalism has no unique features in the Edit menu; all functions are the same as those described in Section 3.1.

View[edit]

The view menu for the Buckets and Balls formalism is identical to that found in the SAN formalism. Please refer to Section 4.2.4 for more information on the options provided in this menu.

Elements[edit]

Elements are Buckets and Balls model primitives. The Elements menu includes the following types of elements:

  • Bucket, which will be represented by a blue circle.
  • Timed Transition, which will be represented by a black line with an attached arrow indicating the direction of the transition.
  • Instantaneous Transition, which will also be represented by a black line with an attached arrow indicating the direction of the transition.

Buckets and Balls model elements can be selected either through the menu item Elements or via the icons below the menu. To place one of these components, simply click on it, move it to the desired location, and place it by clicking the left mouse button. A dialog box will then appear, requesting that you specify the attributes related to the element’s type. As with the SAN model formalism, all names must be unique across the atomic model. All names must also conform to C++ variable naming conventions. For more information on placing transitions, please see the subsection on arcs and lines below.


Buckets

When you are creating or editing a bucket (which you do by right-clicking on the bucket and selecting Edit in the pop-up window), a dialog box similar to the one illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_attribute" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_attribute">

Atomic bucketsballs editor bucket attribute.png


<xr id="fig:atomic_bucketsballs_editor_bucket_attribute" nolink />: Buckets and Balls bucket editor.
</figure>


  • The Name text box allows you to modify the name of the bucket, provided the new name is still unique in the current model.
  • The Ball(s) section of the dialog contains a radio button to allow you to select either a constant or variable to represent the number of balls in this bucket.
– If Constant is selected, you must enter a non-negative short integer, that is any number greater than or equal to zero and less than or equal to 32,767.
– If Variable is selected, you must enter a global variable of the type short.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear, indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Timed transition

When you are creating or editing a timed transition (which you do by right-clicking on a timed transition and clicking on Edit in the pop-up window), a dialog box similar to that illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes">

Atomic bucketsballs editor bucket timedtrans attributes.png


<xr id="fig:atomic_bucketsballs_editor_bucket_timedtrans_attributes" nolink />: Buckets and Balls timed transition editor.
</figure>


  • The Name text box allows you to modify the name, provided that the new name is unique in the current model.
  • The Arc Cardinality text box allows you to set the number of balls transferred by the timed transition when it fires. Note: the transition will not occur for a given bucket if the number of balls in the bucket is less than the number set in this text box.
  • The Time distribution function section of the dialog contains a pull-down menu of the general distributions available for a timed transition and a Parameters button that opens a dialog to allow you to parameterize the selected distribution. Section 1.2.5 of Modeling Background describes the distribution functions for timed activities in Möbius along with their parameters. The parameters can be expressions, global variables of type double, or a series of statements. As with the SAN atomic models, if a series of statements is used, you must provide a return statement with a double-precision value for the parameter.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear, indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Instantaneous transition

When you are creating or editing an instantaneous transition (which you do by right-clicking on an instantaneous transition and clicking on Edit in the pop-up window), a dialog box similar to that illustrated in <xr id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes" /> is shown.


<figure id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes">

Atomic bucketsballs editor bucket insttrans attributes.png


<xr id="fig:atomic_bucketsballs_editor_bucket_insttrans_attributes" nolink />: Buckets and Balls instantaneous transition editor.
</figure>


  • The Name text box allows you to modify the name, provided that the new name is unique in the current model.
  • The Arc Cardinality text box allows you to set the number of balls transferred by the timed transition when it fires. Note: the transition will not occur if the number of balls is less than the number listed in the text box.
  • The Weight text box allows you to set a probabilistic weight for the transition (as only one transition may be selected out of each bucket), these weights will be normalized for all transitions of the specified rank for a given bucket. The weight may be expressed as a variable or as a double-precision value.
  • The Rank text box allows you to set the rank of this transition, indicating its priority with respect to the bucket of origin. Higher-valued ranks will be selected first unless they cannot fire, in which case lower-valued ranks will be selected. Rank may be expressed as a variable or a constant.
  • The OK button accepts any changes you may have made and returns you to the Buckets and Balls Editor. If there are any problems with changes you have made, an error message will appear indicating the error and asking you to rectify it.
  • The Cancel button discards all changes and returns you to the Buckets and Balls Editor.


Arcs and lines

In Buckets and Balls models, as in SAN models, there are three arc drawing tools at your disposal: straight, spline, and connected lines. In a Buckets and Balls model, these arcs define the timed and instantaneous transitions. In order to draw an arc, you simply select one of the arc tools with the left mouse button. Move the mouse to a bucket and click with the left mouse button to set the origin bucket for the transition. If you are drawing a spline or connected line, click the left mouse button in the drawing area to set control points. Finally, click the left mouse button on the destination bucket to create the transition arc. If at any point you wish to cancel the arc, right-click on the drawing area. Arcs may overlap other objects and other arcs. All arcs and lines are directed, and therefore must have both of their endpoints anchored at buckets.


Text boxes

As in the SAN model editor, text boxes have been provided to allow programmers to write comments about different aspects of their models within the drawing area. These comments have no effect whatsoever on the functioning of the model, although they may help another programmer understand the model. For more information on creating and editing text boxes, please see “Text boxes” in Section 4.2.5.