WebSPN 3.3

Reward Measures Help



Double click on an item in STATEMENT, PLACES, TRANSITIONS to add it to MEASURES
 
Contents:

Available Measures

pr[Event]
steady state probability of Event

(return a value)
 
pr(time)[Event]
instantaneous probability of Event

(return a value)
 
cycle(time1, time2 [, step]) pr[Event]
probability of Event in interval [time1, time2]

(return an array of values)

av_token[Place Name]
steady state average number of tokens in Place Name

(return a value)
 
av_token(time)[Place Name]
instantaneous average number of tokens in Place Name

(return a value)
 
cycle(time1, time2 [, step]) av_token[PlaceName]
average number of tokens in Place Name in interval [time1, time2]

(return an array of values)

pr_enabled[Transition Name]
steady state probability that Transition Name is enabled

(return a value)
 
pr_enabled(time)[Transition Name]
instantaneous probability that Transition Name is enabled

(return a value)
 
cycle(time1, time2 [, step]) pr_enabled[TransitionName]
probability that Transition Name is enabled in interval [time1, time2]

(return an array of values)

exp[Reward Function]
steady state expected reward rate of Reward Function

(return a value)
 
exp(time)[Reward Function]
instantaneous expected reward rate of Reward Function

(return a value)
 
cycle(time1, time2 [, step]) exp[Reward Function]
expected reward rate of Reward Function in interval [time1, time2]

(return an array of values)

cum_exp[Reward Function]
steady state expected accumulated reward rate of Reward Function

(only if the Petri Net have absorption marking)
(return a value)
 
cum_exp(time)[Reward Function]
instantaneous expected accumulated reward rate of Reward Function

(return a value)
 
cycle(time1, time2 [, step]) cum_exp[RewardFunction]
expected accumulated reward rate of Reward Function in interval [time1,time2]

(return an array of values)

mtta
Mean Time To Absorption

(only if the Petri Net have absorption marking)
(return a value)

How to define a Reward Function f

f := <Reward Function Expression> or <Conditional Reward Function Expression>
(f is an array of values)
 
<Reward Function Expression>:
a numerical expression in which the only functions allowed are:
mark[Place Name]
return the number of tokens in Place Name
(return an array of values)
enabled[Transition Name]
return 1 if Transition Name is enabled, 0 otherwise
(return an array of values)

<Conditional Reward Function Expression>:
an IF THEN ELSE statement in the following form:
if <Event> then <Reward Function Expression> else <Reward Function Expression>
(ELSE clausole is not optional)

The numerical expression consist of an algebric expression with parenthesis and the following operators (the order represents the precedence too):

- : unary minus
^ : power operator; is considered left associative
2^3^4 is evaluated as (2^3)^4, not 2^(3^4). To specified a specific evaluation order use the parenthesis.
*, /
+, -
 

How to define <Event>

Is a boolean expression with parenthesis and the following operators (the order represents the precedence too):

! : not
& : and
| : or
 
The basic event have one of the following form:

Note:
# and mark are equivalent
? and is_enabled are equivalent
The relational operators are:
==
<
<=
>
>=
!=

Each expression that a user can define must be assigned to a variableto view the result of expression or to use the result in other expression.
There are two types of assignment, a value assignment and an array assignment.

If the expression value is a value, the form of assignment statement is:

variable_name = expression

If the expression value is an array of values, the form of assignment statement is:

variable_array_name := expression

To view the value of one or more variables that represent a value (NOT AN ARRAY) the PRINT keyword must be used, i.e.:

print(a, b, ...)

The arrays obtained by means of CYCLE keyword are automatic visualized in the result dialog.

If an array represents a REWARD FUNCTION only the relative expected reward rate and expected accumulated reward rate can be viewed.


Examples of valid statement

How to calculate and view the steady state average number of tokensin a place:

m1 = av_token[PlaceName]
print(m1)

How to calculate and view the instantaneous average number of tokens in a place:

m1 = av_token(7)[PlaceName]
  or
t = 7
m1 = av_token(t)[PlaceName]

print(m1)

How to calculate and view the Mean Time To Absorption (MTTA):
(mtta is calculated only for Petri Net with absorption marking)

t = mtta
print(t)

How to calculate and view the steady state probability of an event:

p = pr[#place1>0 & #place2=0 | #place3==5]
print(p)

How to calculate and view the instantaneous probability of an event:

p = pr(15)[#place1>0 & #place2=0 | #place3==5]
  or
time = 15
p = pr(time)[#place1>0 & #place2=0 | #place3==5]>

print(p)

How to calculate and view the steady state probability that a transition is enabled:

p = pr_enabled[TransitionName]
  or
p = pr[?TransitionName]

print(p)

How to calculate and view the instantaneous probability that a transition is enabled:

p = pr_enabled(20)[TransitionName]
  or
time = 20
p = pr_enabled(time)[TransitionName]

print(p)

How to define a reward function:

f := mark[PlaceName]
  or
f := enabled[TransitionName]
  or
f := if mark[PlaceName]>0 then 1 else 0
  or
f := if mark[PlaceName]>0 then mark[PlaceName]*10 else mark[PlaceName]/10

How to calculate and view steady state expected reward rate of a reward function:

p = exp[f]
print(p)

How to calculate and view steady state expected accumulated reward rate of a reward function:

p = cum_exp[f]
print(p)

How to calculate and view instantaneous expected reward rate of a reward function:

p = exp(25)[f]
print(p)

How to calculate and view steady instantaneous accumulated reward rate of a reward function:

p = cum_exp(10)[f]
print(p)

How to calculate and view the value of a measure in interval [t1, t2]

v:=cycle(t1, t2 [, step]) pr[#PlaceName >=0]
  or
v:=cycle(t1, t2 [, step]) av_token[PlaceName]
  or
v:=cycle(t1, t2 [, step]) pr_enabled[TransitionName]
  or
v:=cycle(t1, t2 [, step]) exp[RewardFunction]
  or
v:=cycle(t1, t2 [, step]) cum_exp[RewardFunction]

step is optional; if it is not present or is lower then delta it is set to delta


IMPORTANT: each statement must be written in a single line!!!

i.e.:

a = pr[ #p_0>0 & is_enabled[t_1] ]
is correct, while:
a = pr[ #p_0>0 &
is_enabled[t_1] ]
is wrong.