• No se han encontrado resultados

First this section provides an overview of the available MDD data encodings in the LTSmin toolset, after which it goes into detail how MDD operations are accessed.

3.3.1

Available MDD libraries

In the reachability algorithms of the LTSmin toolset a number of available MDD data structure

implementations can be used. The back-end layer of the LTSmin toolset currently contains five different types of such implementations using four different libraries, resulting in different underlying implemented encodings. The libraries used (which all contain a form of garbage collection) are:

■ ATermDD library (vset_atermdd.c) [22]: a C library that uses an abstract data type (ATerm) for handling graph-like data structures and is capable of maximal subterm sharing (common subterms are shared to prevent storing duplicate subterms, which reduces memory usage).

■ BuDDy library (vset_buddy.c) [17]: a fully-fledged BDD library written in C containing all standard BDD operations.

■ libDDD library (vset_ddd.cpp) [15]: a C++ library which uses Data (which only stores integers) or Set Decision Diagrams with functions that represent relations, and with support for Saturation-type algorithms.

■ listDD library (vset_listdd.c): an in-house developed MDD library written in C. The underlying implementation structure of an MDD can be one of the following:

■ In a graph-like data structure for MDDs (just as given in Definition 2.2), where MDD nodes contain local state values and from each one of them, an arc points to another MDD node.

■ In a linked-list data structure for MDDs, where MDD nodes are represented as a linked list and each entry of the linked list contains a local state value, a link to another linked list and a link to the next entry of the linked list (if any). This data structure is also referred to as a List Decision Diagram (abbreviated to LDD) [3].

With the given descriptions of the four libraries and the implementation structure used for storing MDDs, Table 3.4 gives an overview of the concrete encodings of the MDD data structure available in the LTSmin toolset.

45 Option Library used Data structure Explanation

list ATermDD Graph using

linked-lists

Full-fledged implementation of LDDs with integer as node value and building on ATerm objects.

tree ATermDD Graph Full-fledged implementation of MDDs with integer as node value

and building on ATerm objects.

fdd BuDDy Graph Wrapper around BuDDy library.

ddd libDDD Graph Wrapper around libDDD library.

ldd listDD Graph using

linked-list

Full-fledged implementation of LDDs with integer as node value.

Table 3.4: Available MDD data encodings in the LTSmin toolset. ■ Running example 2 – Next-state function as LDD

The LDD of event 1 of the second example model is given in Figure 3.3. A node is a linked list which is stretched out horizontally in a level. The three components in an entry of a linked list are given in the order as pointed out above (local state value, pointer to other linked list and pointer to next entry of linked list). And also the memory usage is optimized: instead of storing the redundant LDD node in level 4 (node with dashed borders), part of the linked list on the left is reused.

Figure 3.3: LDD (left) corresponding to MDD of event 1 of example model 2. ■ Running example 1 & 2 – Reachable state space as LDD

The LDD data structure can also be used for storing the reachable state space of the example models. In Figure 3.4 the reachable state space of example model 1 using an LDD and an MDD are depicted next to each other, and likewise for example model 2 in Figure 3.5.

46

Figure 3.5: Reachable state space of example model 2 using LDD (left) and MDD (right).

3.3.2

Access to MDD operations

To be able to work with the MDD data structure implementations in the tool, the back-end layer is structured to distinguish among the data structure encodings and its concrete uses. It makes use of the following three types of data objects:

■ Vector domain (vdom_t): this refers to the type of MDD data structure encoding to be used, namely the five mentioned earlier in Table 3.4 (list, tree, fdd, ddd and ldd). It then makes a correct reference to the actual MDD operations belonging to a specific encoding.

■ Vector set (vset_t): this refers to the MDD implementation structure that is used for maintaining sets of state vectors and auxiliary data, e.g. it is used for storing the reachable state space.

■ Vector relation (vrel_t): this refers to the MDD implementation structure that is used for maintaining (transition) relations and auxiliary data, e.g. it is used for storing the next-state function of a model. The most crucial auxiliary data that is being stored in the vector set and vector relation is the projection on the state vector. This makes it possible to do operations on a subvector of the state vector, when certain state slots do count.

When considering the use of MDD operations, the current exploration algorithms only have access to high-level operations via the vector domain, for example union of, intersection of and equality matching between two MDD. The concrete (low-level) implementations depend on the type of MDD data structure encoding selected by the user.

In Table 3.5 and Table 3.6 an overview of the most relevant high-level MDD operations is given in simplified form. All these operations are defined in the header file vector_set.h (with concrete implementation in file vector_set.c).

Before starting a symbolic reachability analysis, the user is able to choose which vector domain (or MDD data structure encoding) is used, after which the appropriate vector set and vector relations and

references to the high-level MDD operators are constructed. Hereby the header file vdom_object.h comes into play, which defines the possible high-level MDD operators for which a connection can be established with a particular associated MDD operator that is implemented in the chosen MDD data structure encoding.

47 High-level MDD

operation

Input arguments Return value

vset_create - vector domain (as vdom_t)

- length of state vector - projections of state vectors

New empty instance of MDD (as vset_t) with the number of levels corresponding to length of state vector and containing projections as auxiliary data.

vset_add - MDD (as vset_t)

- state (as indexed state vector)

MDD (as vset_t) with the given state added.

vset_is_empty - MDD (as vset_t) True if given MDD is empty and otherwise False.

vset_equal - 2 MDDs (as vset_t) True if the given MDDs are equal and otherwise

False.

vset_copy - MDD (as vset_t) Copy of MDD (as vset_t).

vset_project - source MDD (as vset_t)

- projection list

Projected MDD (as vset_t) of source MDD using the given projection list.

vset_union - 2 MDDs (as vset_t) Union of given MDDs (as vset_t).

vset_intersect - 2 MDDs (as vset_t) Intersection of given MDDs (as vset_t).

vset_minus - 2 MDDs (as vset_t) Difference of given MDDs (as vset_t).

vset_enum - MDD (as vset_t)

- call back function - context information

Enumerate every (sub) state of given MDD and use call back function and context information to perform operations on these (sub) states. vset_least_fixpoint - source MDD (as vset_t)

- list of relation MDDs (as vrel_t) - number of relation MDDs in list

MDD (as vset_t) that is the result of performing a least fix-point computation on the source MDD using the relation MDDs (for which there number is given).

vset_next - source MDD (as vset_t)

- relation MDD (as vrel_t)

Return an MDD (as vset_t) containing all successors that can be reached in one step from (sub) states in the given source MDD using the given relation MDD.

vset_prev - source MDD (as vset_t)

- relation MDD (as vrel_t)

Return an MDD (as vset_t) containing all

predecessors that can reach (sub) states in the given source MDD in one step using the given relation MDD.

Table 3.5: Some high-level MDD operations and their arguments as defined in header file vector_set.h (simplified).

High-level MDD operation for transition groups

Input arguments Return value

vrel_create - vector domain (as vdom_t)

- length of state vector - projections of state vectors

New empty instance of MDD (as vrel_t) with the number of levels corresponding to 2 × length of state vector (representing unprimed and primed levels) and containing projections as auxiliary data.

vrel_add - relation MDD (as vrel_t)

- source state (as indexed state vector) - successor state (as indexed state vector)

Relation MDD (as vrel_t) with the given source and successor states added

(corresponding to the ‘from’ and ‘to’ states, respectively).

Table 3.6: Some high-level MDD operations and their arguments for transition groups as defined in header file vector_set.h (simplified).

48