• Keine Ergebnisse gefunden

A Formal Interface To The Evaluation Goal Schedule

5.5 The Evaluation Goal Schedule

5.5.4 A Formal Interface To The Evaluation Goal Schedule

above, it is advisable to provide a more concise summary that facilitates refer-ring to parts of the data structure or related mechanisms in the algorithms that will be described below. What is actually needed is a kind of a formal interface with which operators on the evaluation goal schedule can be referred to in an unambiguous and compact way. In doing so, it is practicable to use a repre-sentation of the schedule’s data structure that can be integrated seamlessly in the imperative description of the algorithms. In fact, the examples above demonstrate that it makes sense to represent the state of each goal instance as a row or tuple in a table similar to a relational database.

Definition 5.23 (Evaluation goal schedule). The evaluation goal schedule can be understood as a set of tuples of which each is identified by a unique id and describes the state of one scheduled goal instance by means of interval sequences and references as described above. Formally, this is written as

Schedgoal ={G1, . . . , Gn} where

id link parameters level pending (?) positive (┬) negative (┴) cache id

1 1 [3, 15]

2 1 [13, 13] [3, 12], [14, 15]

3 0 [3, 4], [6, 12], [14, 15]

4 2 [10, 12] [5, 9], [13, 15]

5 2 [5, 9], [13,

15] [10, 12]

6 1 [13, 15] [5, 12]

7 0 [5, 5], [13, 13]

formula cache

compiled formula ID

one([not(c_([marking(item1, _15912, s0), _15912 = 1])), until(20, one([

not(occur(grab(rob1, item1))), until(10, carrying(rob1, item1, s0), not(carrying(rob1, item1, s0)))]), c_([marking(item1, _15958, s0), _15958 = 0]))])

1

c_([marking(item1, _15976, s0), _15976 = 0]) 2

one([not(occur(grab(rob1, item1))), until(10, carrying(rob1, item1, s0), not(carrying(rob1,

item1, s0)))]) 3

one([not_ok, until(20, sched(_16032, cf(3)), sched(_16048, cf(2)))]) 4

not(carrying(rob1, item1, s0)) 5

carrying(rob1, item1, s0) 6

one([not_ok, until(10, sched(_16099, cf(6)), sched(_16115, cf(5)))]) 7 one([not_ok, until(20, sched(_16146, cf(7)), sched(_16162, cf(2)))]) 8 G = implies(marking(item1) = 1, until(20, implies( occur(grab(rob1, item1)), until(10, carrying(rob1, item1), not( carrying(rob1, item1)))), marking(item1) = 0))

P: (0,1,2,2) : 2 Q: (0,1,2,3) : 1

2 3

4

evaluation goal schedule formula cache

formula cache

5 6

7

8 P: (0,1,2,2) : 5

Q: (0,1,2,3) : 4 P: (0,1,2,2) : 6 Q: (0,1,2,3) : 1

Initial Situation

marking(item1, s0) = 0 time(s0) = 0 carrying(rob1, item1, s0) = false

Simulation History

t= 3: mark(item1, 1) t= 5: grab(rob1, item1) t=10: drop(rob1, item1) t=13: grab(rob1, item1)

Figure 5.13: Example for an evaluation goal schedule state with nested tem-poral operators.

Gi =hidi, Ti,?, Ti,>, Ti,⊥,leveli,linkParamsi,cacheRefii

Here, the columns, which will be used without the indexiin the following, store all information that is needed to reconstruct the scheduled formula and for calculating the result of temporal operator expressions based on the eval-uation history. The first column, id is the unique identifier of the goal in the evaluation goal schedule,T?,T>, andT are temporal interval sequences that store the intervals where the evaluation result for the goal instanceGidwas un-determined, positive, or negative, respectively. Additionally, cacheRef holds a pointer that references an entry in the formula cache which contains the goal’s

formula. How deep this (sub-)formula is nested within temporal operators is indicated by the column level. Finally, linkParams contains subterm position paths and the concrete sub-goal id’s that are used to construct the history of goals with possibly nested temporal operators (see Section 5.5.1, paragraph in the middle of page 149)).

In order to refer to the contents of a goal, a dot notation can be used that is adopted from object-oriented programming languages. For instance, if a goal is denoted by G, the interval sequences can be accessed with G. T?, G. T>, and G. T, respectively. Additionally, several functions are necessary for the retrieval and manipulation of information in the schedule. Some of these functions are of rather technical nature, and their semantics are hence presented in a more informal style. In the following list,GOALS is the set of all evaluation goals,IDsched represents the set of all possible evaluation goal schedule ids, FormulaP SL the set of all possible SALMA-PSL formulas,

res

R the set of all result mappings,IDcache the set of all cache ids, and P athsthe set of all possible position paths. With these conventions, the interface to the evaluation goal schedule is modeled as follows:

loadFromSchedule(id) :IDsched→GOALS

Loads the evaluation goal with the given id from the schedule.

applyLinkParameters(id) :IDsched→FormulaP SL

Returns the instantiated formula of the goal with the given id. The returned formula is created by substituting the link parameters for the placeholders in thesched parts of the goal’s formula in the cache.

applyDecisions(id,

res

R) :IDsched×

res

R

Updates the evaluation goal schedule entry with the given id according to the new results in the given mapping. More precisely, each interval with a fixed decision in

res

R “moves” this segment from the undetermined interval sequence T? from the schedule to one of the sequences T> or T, according to the label in the result mapping. Formally, when

res

R denotes the set of all possible result mappings and G0id is the state of the scheduled goal after the application of the results, then the effect applyDecisionscan be defined as follows:

hid, T?, T>, T,lev,lP,cRi applyDecisions(id,

res

R)

−−−−−−−−−−−−−→

hid, T?0, T>0, T0,lev,lP,cRi

where

Ir ={I ∈ IT(

res

R .intv)|

res

R .rmap(I) =r} forr ∈ {>,⊥,?}

T?0 =

 [

I∈I>∪I

T?\I

∪

I∈I?

I

T>0 =T>

I∈I>I

and T0 =T

I∈II

storeInSchedule(lev,cId,lp) :N0× IDcache× P(P aths× IDsched)→ IDsched Creates a new entry in the evaluation goal schedule that points to a formula with idcIdin the formula cache which is nested at levellev. Additionally, the link parameters inlp are set up in the new goal, which potentially establishes the links seen in the examples above. Here, P aths denotes the set of possible subterm position paths and IDcache the set of ids in the formula cache. The result of a call to storeInSchedule is the unique id that was assigned to the newly created entry.

addNondetScheduleInterval(id,interval) :IDsched× IT Adds the given inter-val to the sequence T? of the evaluation goal schedule entry with the given id. In other words, it is declared that the evaluation result for each time point within the given interval is undetermined. This also effec-tively means that obligations to re-visit the property are added for each of these time instances. In terms of the operations defined in Section 5.3, this can simply be written as

hid, T?, T>, T,lev,lP,cRi addNondetScheduleInterval(id,I)

−−−−−−−−−−−−−−−−−−−→

hid, T?⊕I, T>, T,lev,lP,cRi

With these definitions in place, it is now possible to express usages of the evaluation goal schedule in a precise way that does not add unnecessarily clutter to the presentation of the algorithms in the following section.