CPN Tools State Space Manual: University of Aarhus
CPN Tools State Space Manual: University of Aarhus
University of Aarhus
Department of Computer Science
Aabogade 34
DK-8200 Aarhus N, Denmark
Tel: +45 89 42 56 00
Fax: +45 89 42 56 01
CPN Tools
State Space Manual
Table of Contents
Index .......................................................................................................................5
Chapter 1 ................................................................................................................7
Introduction to State Spaces ................................................................................7
The History of the State Space Tool .............................................................7
Example: Dining Philosophers ......................................................................7
Chapter 2 ..............................................................................................................11
How to Use the State Space Tools ....................................................................11
Generation of State Space Code ................................................................11
Details and Limitations (can be skipped in a first reading)................12
Generation of the State Space and Scc Graph ...........................................12
Standard Report..........................................................................................13
Statistics Functions...........................................................................14
State Space to Simulator.............................................................................14
Simulator to State Space.............................................................................15
Chapter 3 ..............................................................................................................17
How to Refer to the Items of a State Space .......................................................17
Nodes, Arcs and Strongly Connected Components ....................................17
Place Instances...........................................................................................17
Transition Instances ....................................................................................18
Markings......................................................................................................19
Binding Elements ........................................................................................19
String Representations................................................................................20
Time Values ................................................................................................22
Chapter 4 ..............................................................................................................23
How to Make Standard Queries ..........................................................................23
Chapter 5.............................................................................................................. 33
How to Make Your Own Queries ........................................................................ 33
Nodes and Arcs .......................................................................................... 33
Strongly Connected Components............................................................... 34
SearchNodes.............................................................................................. 35
PredNodes and EvalNodes.............................................................. 38
Examples of SearchNodes Calls...................................................... 39
SearchArcs ................................................................................................. 40
Examples of SearchArcs Calls......................................................... 41
SearchSccs ................................................................................................ 41
Examples of SearchSccs Calls ........................................................ 42
Chapter 6.............................................................................................................. 43
How to Change Options...................................................................................... 43
String Representation Options.................................................................... 43
Node and Arc Descriptor Options ............................................................... 44
Options for Calculating a State Space........................................................ 45
Stop Options............................................................................................... 46
Branching Options ...................................................................................... 46
Save Report Options .................................................................................. 47
Reference List ..................................................................................................... 49
Index
Index
A
AllReachable, 24
arc, 17
Arc, 17
arc descriptor, 21
arc descriptor options, 45
Arcs, 33
ArcsInPath, 33
ArcToBE, 20
ArcToScc, 34
ArcToTI, 20
B
BEsDead, 29
BEsFairness, 31
BEsLive, 29
BEsStrictlyLive, 30
BEToTI, 20
Bind, 19
binding element, 19
boundedness property, 13, 14, 24
branching option, 46
C
Calculate Scc Graph tool, 12
Calculate State Space option, 45
Calculate State Space tool, 12
CalculateOccGraph, 12
CalculateSccGraph, 12
chatty version, 23
combination function, 35
CreationTime, 22
D
DeadMarking, 28
DestNode, 33
dining philosopher, 7
E
Enter State Space tool, 11
EntireGraph, 36
EntireGraphCalculated, 14
EqualsUntimed, 22
EqualUntimed, 22
EvalAllArcs, 41
EvalAllNodes, 38
EvalAllSccs, 42
EvalArcs, 41
EvalNodes, 38
EvalSccs, 42
Evaluate ML tool, 12, 23
evaluation function, 35
F
fairness property, 31
FairnessProperty, 31
FullyProcessed, 34
G
generation of Scc graph, 12
generation of state space, 12
generation of state space code, 11
H
home property, 13, 26
HomeMarking, 26
HomeMarkingExists, 27
HomeSpace, 26
I
InArcs, 33
Initial HomeMarking, 27
InitNode, 17
InitScc, 17
InNodes, 33
Inst, 17
L
ListDeadMarkings, 28
ListDeadTIs, 29
ListFairTIs, 32
ListHomeMarkings, 27
ListHomeScc, 27
ListImpartialTIs, 31
ListJustTIs, 32
ListLiveTIs, 30
liveness property, 14, 28
LowerInteger, 25
LowerMultiSet, 25
M
Mark, 19
marking, 19
MinimalHomeSpace, 26
N
node, 17
O
OccurrenceTime, 22
option, 43
OutArcs, 33
OutNodes, 33
P
PI, 17
PI.All, 18
place instance, 17
PredAllArcs, 41
PredAllNodes, 38
PredAllSccs, 42
PredArcs, 41
predicate function, 35
PredNodes, 38
PredSccs, 42
Processed, 34
R
reachability property, 23
Reachable, 23
S
Save Report option, 47
Save Report tool, 13
Scc, 17
SccArcs, 34
SccArcsInPath, 34
SccDestNode, 34
SccGraphCalculated, 14
SccInArcs, 34
SccInNodes, 34
SccListDeadMarkings, 28
SccNodesInPath, 34
SccNoOfArcs, 14
SccNoOfNodes, 14
SccNoOfSecs, 14
SccOutArcs, 34
SccOutNodes, 34
SccReachable, 24
SccSourceNode, 34
SccTerminal, 34
SccToArcs, 34
SccToNodes, 34
SccTrivial, 35
search area, 35
search limit, 35
SearchAllArcs, 41
SearchAllNodes, 38
SearchAllSccs, 42
SearchArcs, 40
SearchNodes, 35
SearchReachableArcs, 41
SearchReachableNodes, 39
SearchReachableSccs, 42
SearchSccs, 41
Simulator to State Space tool, 15
SourceNode, 33
st_Arc, 20
st_BE, 20
st_Mark, 20
st_Node, 20
st_PI, 20
st_TI, 20
standard report, 13
start value, 35
state space code, 11
State Space to Simulator tool, 14
statistics, 13
statistics functions, 14
stop option, 46
string representation, 20
string representation option, 43
StripTime, 22
strongly connected component, 17
T
Terminal, 33
TI, 18
TI.All, 18
timed state space, 22
TIsDead, 28
TIsFairness, 31
TIsLive, 29
transition instance, 18
U
UpperInteger, 24
UpperMultiSet, 25
Chapter 1
Introduction to State Spaces
ph1
cs1
cs2
ph5
ph2
Rice
Dish
cs5
cs3
ph4
cs4
ph3
The philosopher system is modelled by the CP-net shown below. The PH colour set
represents the philosophers, while the CS colour set represents the chopsticks. The
function Chopsticks maps each philosopher into the two chopsticks next to him.
val n = 5;
colset PH = index ph with 1..n;
colset CS = index cs with 1..n;
var p: PH;
fun Chopsticks(ph(i)) =
1`cs(i) ++ 1`cs(if i=n then 1 else i+1);
PH.all()
Think
PH
p
Take
Chopsticks
Chopsticks(p)
p
p
CS.all()
Unused
Chopsticks
Eat
PH
CS
p
Chopsticks(p)
Put Down
Chopsticks
Take: {p=ph(1)}
Take: {p=ph(4)}
2
3:3
7
2:2
8
2:2
3
3:3
6
3:3
1
5:5
Put: {p=ph(2)}
4
3:3
9
2:2
Unused: 1`cs(1)
Think: 1`ph(1)++1`ph(3)++1`ph(5)
Eat: 1`ph(2)++1`ph(4)
5
3:3
Put: {p=ph(3)}
11
2:2
Unused: 1`cs(5)
Think: 1`ph(2)++1`ph(4)++1`ph(5)
Eat: 1`ph(1)++1`ph(3)
The state space for the dining philosophers is generated in the SS tool in CPN Tools.
Currently, there is no support for drawing state spaces in CPN Tools. It should be noted
that this state space is rather atypical. Most state spaces are much larger. The present
version of the SS tool is able to handle graphs with 20,000-200,000 nodes and 50,0002,000,000 arcs provided that you have sufficient RAM in your machine. Future versions
are expected to be able to handle much larger state spaces.
Chapter 2
How to Use the
State Space Tools
Tools for calculating a state space, saving a state space report, and transferring states
between the simulator and state space tool are found in the state space tool palette:
More information about using the state space tools can be found in the help pages, for
example in the online help:
http://wiki.daimi.au.dk/cpntools-help/use_state_space_tool.wiki
11
fun CalculateSccGraph
Options for the Calculate State Space tool can be found in Chapter 6.
12
Standard Report
When you have generated the state space for a CP-net, you can use the Save Report tool
to generate a text file which contains a standard report providing information about:
Statistics (size of state space and Scc graph).
Using the options for the Save Report tool (see Chapter 6), one can specify how much
information is to be put in the report. This is done by choosing one or more of the
possibilities mentioned above. Home and fairness properties can be included in the report
only if the Scc graph has been calculated. For the dining philosopher system the full
standard report looks similar to the report below:
Statistics
-----------------------------------------State Space
Nodes: 11
Arcs:
30
Secs:
1
Status: Full
Scc Graph
Nodes: 1
Arcs:
0
Secs:
0
Boundedness Properties
-----------------------------------------Best Integer Bounds
Upper
Lower
System'Eat 1
2
0
System'Think 1
5
3
System'Unused_Chopsticks 1 5
1
Best Upper Multi-set Bounds
System'Eat 1
1`ph(1)++
1`ph(4)++
System'Think 1
1`ph(1)++
1`ph(4)++
System'Unused_Chopsticks 1
1`cs(1)++
1`cs(4)++
Best Lower Multi-set Bounds
System'Eat 1
System'Think 1
System'Unused_Chopsticks 1
1`ph(2)++ 1`ph(3)++
1`ph(5)
1`ph(2)++ 1`ph(3)++
1`ph(5)
1`cs(2)++ 1`cs(3)++
1`cs(5)
empty
empty
empty
Home Properties
-----------------------------------------Home Markings: All
13
It is possible to customise the way the system displays place instances and transition
instances (e.g. to replace "System'Eat 1" by "Eat"). This is done by means of the
String Representation Options described in Chap. 6.
Statistics Functions
A number of functions can be used to get information about the size of the state space and
the size of the Scc graph.
The state space will always have at least one node (even if the Calculate State Space
tool has not been used). By convention node number 1 represents the initial marking.
If the state space is partial you may extend it by applying the Calculate State Space tool
once more (perhaps after modifying some of the Stop Options or Branching Options (see
Chapter 6)).
Statistics about the calculation of the state space and Scc graph can be accessed via the
following set of ML functions:
fun NoOfNodes
fun NoOfArcs
fun NoOfSecs
fun EntireGraphCalculated
fun SccNoOfNodes
fun SccNoOfArcs
fun SccNoOfSecs
fun SccGraphCalculated
14
15
Chapter 3
How to Refer to the Items
of a State Space
This chapter describes how you can refer to the items of a state space, such as nodes,
place instances, binding elements and markings.
(* positive *)
(* positive *)
(* negative *)
Place Instances
To denote place instances the following ML structure is available:
type Inst = int
con PI.<PageName>'<PlaceName> Inst -> PI.PlaceInst
17
PI.PlaceInst list
Transition Instances
To denote transition instances the following ML structure is available. It is totally
analogous to PI above:
con TI.<PageName>'<TransName> Inst -> TI.TransInst
For the dining philosophers we use:
TI.System'Take_Chopsticks 1
to refer to transition Take_Chopsticks on the first instance of page System. For the ring
network we use:
TI.Site'Send 3
to refer to transition Send on the third instance of page Site.
To denote the set of all transition instances, the following notation is available:
TI.All
18
TI.TransInst list
Markings
To inspect the markings of the different place instances the following ML structure is
available:
fun Mark.<PageName>'<PlaceName> Inst -> (Node -> CS ms)
where CS is the colour set of the place instance. For the dining philosophers we use:
Mark.System'Think 1 10
to refer to the multi-set of tokens on place Think on the first instance of page System in
the marking M10 (by convention we use Mi to refer to the marking of node i). For the ring
network we use:
Mark.Site'PackNo 3 217
to refer to the marking of place PackNo on the third instance of the page Site in M217. It
should be noted that the Mark function returns a list representation of the multi-set. To
obtain a string representation of the marking of a place the st_Mark functions should be
used (see String Representations below).
For a timed state space the above functions return a timed multi-set (for places with a
timed colour set).
Binding Elements
To denote binding elements the following ML structure is available:
con Bind.<PageName>'<TransName>
Inst * record -> Bind.Elem
where the second argument is a record specifying the binding of the variables of the
transition. The type of this argument depends upon the transition. For the dining
philosophers we use:
Bind.System'Take_Chopsticks (1,{p=ph(3)})
to refer to the binding element where transition Take_Chopsticks on the first instance of
page System has the variable p bound to ph(3). For the ring network we use:
Bind.Site'NewPack (3,{n=2,r=S(1),s=S(3)})
to refer to the binding element where transition NewPack on the third instance of page
Site has the variables n, r and s bound to 2, S(1) and S(3), respectively.
19
fun ArcToTI
fun BEToTI
String Representations
The following functions are used to obtain string representations of nodes, arcs, place
instances, transition instances and binding elements:
fun st_Node
fun st_Arc
fun st_PI
fun st_TI
fun st_BE
Examples:
st_Node (3)
"3"
st_Arc (18)
"18:6->10"
st_PI (PI.System'Eat 1)
"System'Eat 1"
st_TI (ArcToTI(18)) "System'Take_Chopsticks 1"
st_BE (ArcToBE(18)) "System'Take_Chopsticks 1:{p=ph(4)}"
To produce string representations of the markings of place instances the following ML
structure is provided:
fun st_Mark.<PageName>'<PlaceName>
Inst -> (Node -> string)
Example (the produced string ends with a carriage return):
st_Mark.System'Eat 1 10 "System'Eat 1: 1`ph(1)++1`ph(4)"
20
"Eat"
"Take_Chopsticks"
"Take_Chopsticks: {p=ph(4)}"
Analogously, it is possible to get a compact version of st_Mark (for empty markings the
result is the empty string):
st_Mark.System'Eat 1 10
st_Mark.System'Eat 1 1
"Eat: 1`ph(1)++1`ph(4)"
""
The NodeDescriptor function uses the st_Mark functions for each of the place instances
in the net. Example (the print function prints the string argument):
print(NodeDescriptor 7)
7:
System'Think 1: 1`ph(2)++1`ph(3)++1`ph(5)
System'Eat 1: 1`ph(1)++1`ph(4)
System'Unused_Chopsticks 1: 1`cs(3)
An arc descriptor is a string representation of the information associated with an arc in a
state space. An arc descriptor can be obtained using the following function:
fun ArcDescriptor
By default, an arc descriptor is a string showing the source and destination nodes of the
arc together with the corresponding binding element. Example
ArcDescriptor 11
"11:3->10 System'Take_Chopsticks 1: {p=ph(2)}"
21
Time Values
The following functions can only be used for timed state spaces.
Each node has a time value denoting the model time at which the marking started to
exist:
fun CreationTime
Analogously, each arc has a time value denoting the model time at which the binding
element occurred:
fun OccurrenceTime
The following function tells whether the markings of the two specified nodes are identical
when time stamps are ignored:
fun EqualUntimed
The following function maps a node into all those nodes which have the same marking
when time stamps are ignored:
fun EqualsUntimed
Most state spaces with time will be non-cyclic (since all nodes in a cycle must have the
same creation time).
22
Chapter 4
How to Make Standard Queries
This chapter explains how to perform standard queries to investigate the properties of a
CPN model. It is, e.g., possible to investigate the reachability, boundedness, home,
liveness and fairness properties defined in [CPN 1]. Many of the query functions return
results which already are included in the standard report described in Chap. 2.
The query functions are typically written in auxiliary texts alone or as part of a larger
ML expression. The text is evaluated by means of the Evaluate ML tool.
Some of the functions also have a chatty version which returns the same result as the
ordinary query function. The difference is that the chatty version (sometimes) prints a text
string with a more elaborated explanation of the result. Each chatty query function has the
same name as the corresponding ordinary query function, with a single quote appended to
the end (e.g., Reachable').
Reachability Properties
The query functions for reachability properties are based on Prop 1.12 in [CPN 2].
fun Reachable
fun SccReachable
fun AllReachable
Reachable determines whether there exists an occurrence sequence from the marking
of the first node to the marking of the second. This is done by investigating whether the
state space contains a directed path from the first node to the second. For the dining
philosopher system:
Reachable (5,3)
returns true. This tells us that there exists an occurrence sequence from the marking M5
(of node 5) to the marking M3 (of node 3). The function also has a chatty version:
Reachable' (5,3)
which returns the same result together with the explanation:
23
Boundedness Properties
The query functions for boundedness properties are based on Prop 1.13 in [CPN 2].
fun UpperInteger
fun LowerInteger
fun UpperMultiSet
fun LowerMultiSet
24
25
Home Properties
The query functions for home properties are based on Prop 1.14 in [CPN 2].
fun HomeSpace
fun MinimalHomeSpace
fun HomeMarking
fun ListHomeMarkings
fun ListHomeScc
fun HomeMarkingExists
fun InitialHomeMarking
HomeSpace determines whether the set of markings (specified in the list of nodes) is a
home space, i.e., whether, from each reachable marking, it is possible to reach at least one
of the markings. For the dining philosopher system:
HomeSpace [2,6]
returns true. The function also has a chatty version.
MinimalHomeSpace returns the minimal number of markings which is needed to form
a home space. This is identical to the number of terminal strongly connected components.
For the dining philosopher system:
MinimalHomeSpace ()
returns 1. This function cannot be used for a timed CPN model.
HomeMarking determines whether the marking of the specified node is a home
marking, i.e., whether it can be reached from all reachable markings. This is the case iff
there is exactly one terminal strongly connected component and the specified marking
belongs to that component. For the dining philosopher system:
HomeMarking (6)
26
27
Liveness Properties
The query functions for liveness properties are based on Prop 1.15 in [CPN 2].
fun DeadMarking
fun ListDeadMarkings
fun SccListDeadMarkings
fun TIsDead
fun BEsDead
fun ListDeadTIs
fun TIsLive
fun BEsLive
fun BEsStrictlyLive
fun ListLiveTIs
DeadMarking determines whether the marking of the specified node is dead, i.e., has
no enabled binding elements. For the dining philosopher system:
DeadMarking (8)
returns false. This tells us that M8 has some enabled binding elements.
ListDeadMarkings returns a list with all those nodes that are dead, i.e., have no
enabled binding elements. For the dining philosopher system:
ListDeadMarkings ()
returns the empty list.
SccListDeadMarkings returns the same result as ListDeadMarkings, but it
uses the Scc graph, i.e., the strongly connected components. This means that it is faster
than ListDeadMarkings (at least for state spaces which contain cycles).
TIsDead determines whether the set of transition instances (specified in the list) is dead
in the marking of the specified node, i.e., whether it is impossible to find an occurrence
sequence which starts in the marking and contains one of the transition instances. For the
dining philosopher system:
28
29
returns true. This tells us that philosopher ph(3) always has a chance to Take_Chopsticks.
He cannot do that in all the reachable markings but it is always possible to choose a
sequence of steps so that this may happen. The function also has a chatty version.
BEsStrictlyLive determines whether the set of binding elements (specified in the
list) is strictly live, i.e., whether each individual element in the list is live. For the dining
philosopher system:
BEsStrictlyLive [
Bind.System'Take_Chopsticks
Bind.System'Take_Chopsticks
Bind.System'Take_Chopsticks
Bind.System'Take_Chopsticks
Bind.System'Take_Chopsticks
(1,{p=ph(1)}),
(1,{p=ph(2)}),
(1,{p=ph(3)}),
(1,{p=ph(4)}),
(1,{p=ph(5)})]
returns true. This tells us that each philosopher always has a chance to Take_Chopsticks.
He cannot do that in all the reachable markings but it is always possible to choose a
sequence of steps so that this may happen.
ListLiveTIs returns a list with all those transition instances that are live. For the
dining philosopher system:
ListLiveTIs ()
returns:
[TI.System'Put_Down_Chopsticks 1,
TI.System'Take_Chopsticks 1]
This tells us that it is impossible to reach a marking such that one of the transition
instances never can occur.
30
Fairness Properties
The query functions for fairness properties are based on Prop 1.16 in [CPN 2].
fun TIsFairness
fun ListJustTIs
31
ListJustTIs()
32
Chapter 5
How to Make Your Own Queries
This chapter describes how you can make your own non-standard queries by writing
some simple ML functions. First we introduce a number of functions to inspect the
structure of a state space and an Scc graph. Then we describe three search functions by
which you can traverse the nodes, arcs and strongly connected components of a state
space.
fun DestNode
fun Arcs
fun InNodes
fun OutNodes
fun InArcs
fun OutArcs
The following function tells whether a node is terminal (i.e., have no outgoing arcs). The
result is identical to the result of DeadMarking (in Chap. 4).
fun Terminal
The following functions return the nodes/arcs in one of the shortest paths between the
two specified nodes. If no path exists the exception NoPathExists is raised:
fun NodesInPath
fun ArcsInPath
33
The following functions determine to which extent a node has been processed. The
Branching Options (in Chap.6) allow you to specify that a node can be processed without
calculating all the immediate successors. The second function checks whether this is the
case:
fun Processed
fun FullyProcessed
fun ArcToScc
fun SccToNodes
fun SccToArcs
The following functions (for Scc graphs) are analogous to the functions defined in Nodes
and Arcs (at the beginning of this chapter). Hence they have the same names prefixed
with Scc.
34
fun SccSourceNode
fun SccDestNode
fun SccArcs
fun SccInNodes
fun SccOutNodes
fun SccInArcs
fun SccOutArcs
fun SccTerminal
fun SccNodesInPath
fun SccArcsInPath
SearchNodes
The function SearchNodes traverses the nodes of the state space. At each node some
specified calculation is performed and the results of these calculations are combined, in
some specified way, to form the final result.
SearchNodes takes six different arguments and by varying these arguments it is
possible to specify a lot of different queries, e.g., many of the standard queries from
Chap. 4. The following description is taken from Sect. 1.7 of [CPN 2]:
Search Area
Predicate
function
Search Limit
Evaluation
function
Start value
Combination
function
35
search area
Node list
pred
limit
eval
start
comb
predicate function
search limit
evaluation function
start value
combine function
The ML types 'a and 'b are arbitrary and may be identical. The search area is specified
by a list of nodes (if a node is listed twice it will be searched twice). By convention we
use:
val EntireGraph
to denote the set of all nodes in the state space. The search limit is specified by a positive
integer. By convention we use:
val NoLimit
to specify an infinite limit, i.e., that the search continues until the entire search area has
fully been traversed.
The SearchNodes function is a bit complicated. But it is also extremely general and
powerful. As an example, we can use SearchNodes to implement the query function
ListDeadMarkings from Chap.4, i.e., to find all the dead markings. Then we simply
use the following arguments:
36
EntireGraph
Predicate function
Search limit
10
Evaluation function
fun Eval(n) = n
Start value
[]
Combination function
The predicate function uses the function OutArcs (from Nodes and Arcs at the
beginning of this chapter) to get a list of all the output arcs. If the length of this list is zero
there are no successors, and thus we have a dead marking. The evaluation function maps
a node into itself, i.e., into the unique node number. The combination function adds each
new dead marking to the list of those which we have previously found. With these
arguments SearchNodes returns a list with at most 10 dead markings. If the list is
empty there is no dead marking. If the length is less than 10, the list contains all the dead
markings. The exact ML call looks as follows:
SearchNodes (
EntireGraph,
fn n => (length(OutArcs(n)) = 0),
10,
fn n => n,
[],
op ::)
As a second example, we may use SearchNodes to implement the query function
UpperInteger from Chap. 4, i.e., to find the best upper integer bound for a given place
instance p PI. This is done by using the following arguments:
Search area
EntireGraph
Predicate function
Search limit
NoLimit
Evaluation function
Start value
Combination function
max
The exact ML call looks as follows (for the place Eat on the first instance of the page
System):
37
38
39
Mark.System'Unused_Chopsticks 1 n ++
ext_ms Chopsticks (Mark.System'Eat 1 n)
<><> CS.all())
SearchArcs
The function SearchArcs traverses the arcs of the state space. At each arc some
specified calculation is performed and the results of these calculations are combined, in
some specified way, to the form the final result.
We define SearchArcs in a way which is totally analogous to SearchNodes. The
arguments have the following types:
area
pred
limit
eval
start
comb
search area
predicate function
search limit
evaluation function
start value
combine function
Arc list
Arc -> bool
int
Arc -> 'a
'b
'a * 'b -> 'b
SearchSccs
The function SearchSccs traverses the strongly connected components of the state
space. At each strongly connected component some specified calculation is performed
and the results of these calculations are combined, in some specified way, to the form the
final result.
We define SearchSccs in a way which is totally analogous to SearchNodes and
SearchArcs. The arguments have the following types:
area
pred
limit
eval
start
comb
search area
predicate function
search limit
evaluation function
start value
combine function
Scc list
Scc -> bool
int
Scc -> 'a
'b
'a * 'b -> 'b
41
42
Chapter 6
How to Change Options
The SS tool has a number of options. Some options determine how the string
representation functions work, other options determine the way in which the tools in the
state space tool palette work.
or
Take
The first representation is convenient for a CP-net with many different pages/page
instances, while the second representation is convenient for a system with only one or a
few pages (and only one instance of each page).
The st-functions are used for the standard reports generated by the Save Report tool and
for the contents of SS node/arc descriptors. Hence, the options also influence these things.
However, it should be noted that the string representation options do not influence the
input format of the different ML functions in Chaps. 3-5. This means, e.g., that the user
always has to specify the page and instance of a transition instance even though he may
have decided to omit this information from the text strings created by st_TI.
For each of the st-functions we provide an ML function which specifies how the
individual substrings are put together (e.g., the order and the separators). The options are
changed by the following set of ML functions (the values indicate the system defaults):
OGSet.StringRepOptions'Node(
fn (node) => node)
OGSet.StringRepOptions'Arc(
fn (arc,source,dest) =>
arc ^ ":" ^ source ^ "->" ^ dest)
OGSet.StringRepOptions'PI(
43
44
45
Stop Options
The Stop Options allow you to determine when the calculation of a state space stops. This
happens when all nodes have been processed or when one of the stop options becomes
satisfied. The stop options can be changed by modifying tool options for the Calculate
State Space tool in the index of CPN Tools. The stop options can also be changed by the
following ML function (the values indicate the system defaults):
OGSet.StopOptions{
Nodes = NoLimit,
Arcs = NoLimit,
Secs = 300,
Predicate = fn _ => false}
The first three arguments specify the maximal number of nodes, arcs and seconds. By
convention, zero indicates NoLimit (i.e., that the corresponding stop option is inactive).
All counts are reset to zero whenever you call apply the Calculate State Space tool. This
means that you can extend a state space without changing the Stop Options. The fourth
argument specifies a predicate function which is evaluated after the calculation of the
successors:
Node -> bool
If the predicate evaluates to true the calculation of the state space will be stopped. This
can, e.g., be used to stop when a dead marking is found:
fn n => Terminal n
When a Stop Option has been met, the exception StopOptionSatisfied is raised
(this can, e.g., be seen if the state space is generated by means of the
CalculateOccGraph function described in Chap. 2). Furthermore a message is printed
with details about the activated stop option.
Warning: It is impossible to stop a run-away state space generation in a graceful way.
Hence, it is important that the Stop Options in have some sensible values
Branching Options
The Branching Options allow you to specify that, under certain circumstances, the SS
tool need not calculate all the successors of a node. The node is then said to be only
partially processed. The options can be changed by modifying the appropriate options for
46
47
48
Reference List
[CPN 1]
[CPN 2]
49