J Intell Manuf DOI 10.1007/s10845-008-0176-3

Constraint-based modeling of discrete event dynamic systems Gérard Verfaillie · Cédric Pralet · Michel Lemaître

Received: 5 August 2008 / Accepted: 1 September 2008 © Springer Science+Business Media, LLC 2008

Abstract Numerous frameworks dedicated to the modeling of discrete event dynamic systems have been proposed to deal with programming, simulation, validation, situation tracking, or decision tasks: automata, Petri nets, Markov chains, synchronous languages, temporal logics, event and situation calculi, STRIPS…All these frameworks present significant similarities, but none offers the flexibility of more generic frameworks such as logic or constraints. In this article, we propose a generic constraint-based framework for the modeling of discrete event dynamic systems, whose basic components are state, event, and time attributes, as well as constraints on these attributes, and which we refer to as CNT for Constraint Network on Timelines. The main strength of such a framework is that it allows any kind of constraint to be defined on state, event, and time attributes. Moreover, its great flexibility allows it to subsume existing apparently different frameworks such as automata, timed automata, Petri nets, and classical frameworks used in planning and scheduling. Keywords Discrete event dynamic systems · Constraint-based modeling · Timelines

G. Verfaillie (B) · C. Pralet · M. Lemaître ONERA, 2 av. Édouard, Belin, BP 74025, Toulouse Cédex 4 31055, France e-mail: [email protected] C. Pralet e-mail: [email protected] M. Lemaître e-mail: [email protected]

Introduction The goal of this article is to propose a generic constraintbased framework for the modeling of discrete event dynamic systems, i.e. of systems which are subject to instantaneous events and whose state evolves via instantaneous changes. Numerous frameworks exist to model such systems. Some of them are logic-based such as temporal logics Pnueli (1977), event and situation calculi Kowalski and Sergot (1986) and Levesque et al. (1997) which extend the basic logic formalism to dynamic temporal notions. Others are graph-based such as automata, Petri nets, Markov chains and decision processes Puterman (1994) which use variants of the basic graph formalism to represent states, events, and transitions. Still others are language-oriented such as the synchronous languages Benveniste et al. (2003) which allow automata to be compactly described. Finally, some of them such as the STRIPS framework Fikes and Nilsson (1971) or the PDDL language McDermott (1998) and Fox and Long (2003) are dedicated to special tasks such as planning and scheduling. Although all these frameworks present significant similarities (discrete steps at which instantaneous events or state changes occur, more or less compact representation of states, events, and transitions), comparing them is somewhat difficult, unless translating all of them into the most basic and less compact ones, such as automata or Markov chains. On the other hand, although constraint-based modeling is known to combine compactness and flexibility in terms of modeling with efficiency in terms of problem solving, it remains mainly used to deal with static problems, i.e. with problems that do not involve time, despite some notable exceptions: mainly the scheduling problems [see Baptiste et al. (2001)] and to a certain extent the planning problems (see for example Kautz and Selman 1992; van Beek and Chen

123

J Intell Manuf

1999). With only a few exceptions, it is not used to deal with validation problems on dynamic systems or with situation tracking problems, such as failure diagnosis. We think that such a situation is mainly due to the absence of a generic constraint-based framework, dedicated to the modeling of discrete event dynamic systems and indifferently usable for simulation, validation, situation tracking, or decision tasks. This is such a framework we propose in this article. It is based on the assumption of discrete steps at which instantaneous events or state changes may occur. Its basic components are time, state, and event attributes. With each attribute, is associated a type (time, state, or event), a domain of values, and a countable1 sequence of steps. With each attribute and each step, is associated a value which may be unknown, i.e. a mathematical variable, whose domain of values is the attribute domain. Time attributes are used to represent the temporal positions of the successive steps, state attributes to represent the successive values that permanent features of the system take at each step (permanent because they are always present, even if their value may change at each step, as for example a level of free memory), and event attributes to represent the successive values that instantaneous phenomena in the system take at each step. The only difference between state and event attributes is that, between two successive steps, the former keep the value they took at the first of both steps, whereas the latter take no value. The domains of values of the attributes can be either continuous or discrete. Completely synchronized attributes, which share the same sequence of steps, are gathered into one timeline. With a timeline, are consequently associated a countable sequence of steps, at most one time attribute, and a set of state or event attributes. Concurrent executions can be represented using various timelines. A constraint network on timelines (CNT) is defined by a set of timelines which defines itself a set of variables (one per attribute and per step in its associated timeline) and by a set of constraints on these variables. As in the constraint satisfaction problem (CSP) framework Dechter (2003), any constraint is defined by its scope (the set of variables it links) and its relation (any explicit or implicit representation of the set of allowed combinations of values of the variables in the constraint scope). No restriction is a priori imposed on the type of constraint to consider. The number of steps in each timeline is generally not fixed. These numbers are also variables which may be submitted to constraints. As a consequence, the resulting CSP has two parts: a static one which does not depend on these numbers and a dynamic one which depends on them. The result is a form of dynamic (or conditional) CSP Mittal and Falkenhainer (1990) where actual variables and constraints depend 1

A set is denumerable if and only if it is equipollent to the finite ordinals. It is countable if and only if it is either finite or denumerable.

123

on the assignment of the variables that represent the number of steps in each timeline. Although different in terms of modeling proposals, the CNT framework we propose has been inspired by works carried out at the frontier between planning, scheduling, and constraint satisfaction problems, where the notion of timeline is used to represent the way actions take place and states and resources evolve over time, and finally to reason on time, actions, states, resources, and transitions Laborie and Ghallab (1995), Muscettola (1994), Ghallab (1996), Muscettola et al (1998), Miguel et al. (2001), Barták (1999), Nareyek (2001) and Frank and Jónsson (2003). In Nareyek et al. (2005), the authors classify the existing constraint-based approaches to planning into three categories, which can be roughly described as follows: (1) planning with constraint posting: CSP techniques are used for constraint propagation in subroutines which are called by a classical planning search mechanism; (2) planning with maximal graphs: under the assumption of a given number of actions, the planning problem is modeled as a classical CSP and the number of actions is modified until a plan is found; (3) completely capturing planning within constraint programming: the whole planning problem, including the unknown number of actions, is captured as a dynamic CSP. The CNT modeling framework proposed in this article goes beyond planning problems, but, as far as planning is concerned, it belongs to the third category. This article focuses on modeling issues and says next to nothing about algorithmic issues (constraint propagation, search …), which will be the subject of future studies and articles. We do that because we think that the first obstacle, and perhaps the main one, to the systematic use of constraintbased modeling and reasoning in the context of discrete event dynamic systems is the modeling question. Moreover, when building the CNT framework, our main concern is to propose a minimal set of basic concepts necessary to model discrete event dynamic systems, on top of which it will be later possible to build more sophisticated constructs, useful to model compactly real systems. Section “Modeling assumptions” is an informal introduction to the modeling assumptions we adopt, related to steps, time, states, and events. Section “An illustrative example” presents a tiny example we will use to illustrate section “The CNT framework” which offers a formal presentation of the CNT framework, with the notions of attributes, timelines, variables, constraints, constraint network, assignment, and consistency. Section “The illustrative example revisited” shows how the example can be fully cast into the CNT framework. Section “Subsumed frameworks” shows how many

J Intell Manuf

existing frameworks, such as automata, products of automata, timed automata, Petri nets, STRIPS planning, resourceconstrained project scheduling, temporal constraint networks, and others, are subsumed by the CNT framework. Finally Sect. “Discussion” discusses the main features of the proposed framework, decidability, complexity, and algorithmic issues, as well as possible extensions.

Fig. 1 State attribute over time

Modeling assumptions Steps We want to model discrete event dynamic systems in which events and state changes occur instantaneously at some steps. Time attributes Time attributes are used to represent the temporal positions of these steps. Their domains of values must be totally ordered. To remain as general as possible, we consequently assume that the domain of values of any time attribute is any subset of R, either continuous or discrete. If t and t  are the temporal positions of two successive steps, it is assumed that t < t  (two steps cannot be simultaneous; but any step can involve several simultaneous events and state changes). State attributes A state attribute is associated with any relevant permanent feature of the system: passive ones such as the position or the level of available energy of a robot, as well as active ones such as the mode of an observation instrument or the fact that a robot is moving in some way. In other words, state attributes can be used to represent what is usually referred to as the state of the system (position, energy level, …), as well as what is usually referred to as actions, when they are not instantaneous (an observation, a movement, …). State attributes are used to represent the values these permanent features take at each step. No restriction is imposed on their domain of values. It is assumed that, between two successive steps whose temporal positions are t and t  , i.e. on the semi-open temporal interval [t, t  [, a state attribute keeps the value it took at the first of these steps: assumption of a stepwise evolution (see Fig. 1). In other words, just before any step, a state attribute has the value it took at the previous step, but at this step it takes instantaneously its new value. However, nothing prevents a state attribute from equal values at successive steps (no change).

Fig. 2 Event attribute over time

Event attributes An event attribute is associated with any relevant possible instantaneous phenomenon in the system, such as, with a robot, the reception of an observation request from an operator, the emission of a command to a subsystem, or the failure of a subsystem. Event attributes are used to represent the values these phenomena take at each step. No restriction is imposed on their domain of values, except that they systematically include a default value ⊥ which represents the absence of phenomenon. It is assumed that, between two successive steps whose temporal positions are t and t  , i.e. on the open temporal interval ]t, t  [, an event attribute has the value ⊥ (see Fig. 2). Moreover, nothing prevents an event attribute from a value equal to ⊥ at a given step (no phenomenon). Other possible assumptions It is important to stress that no assumption is made about any correlation or causality relation between state changes and events. State changes and events can be simultaneous. State changes can occur without any event and events without any state change. Moreover, nor Markovian2 , neither stationary3 assumption is made. Such assumptions could be however added to define more specialized frameworks.

2

The evolution of a system is Markovian if and only if the state of the system at a given step depends only on the events at this step and on the state of the system just before this step.

3

The evolution of a system is stationary if and only if the state of the system at a given step depends on the events at this step and on some state and event history, but not on the temporal position of this step.

123

J Intell Manuf

An illustrative example In this section, we present a tiny example that we will use to illustrate all the abstract notions presented in the following section. Let us consider a robot which can execute two types of task (types A and B). With each type of task t y, is associated a duration Dt y and a consumption Ct y of memory (for example, to store data when tasks are observations).4 It is assumed that two tasks of the same type or of different types cannot overlap. At any time, the level of free memory is somewhere between 0 and Mmax. The robot is able to perform data downloads whose result is a level of free memory equal to Mmax (all the data is downloaded and the whole memory is restored). Data downloads are assumed to be instantaneous. It is moreover assumed that a data download cannot be executed during the execution of a task of any type ( A or B), including starting times but not ending times (a data download can be executed exactly at the end of a task). We consider a temporal horizon between T min and T max. Initially, at T min, the level of free memory is equal to Minit. Over this horizon, we assume two tasks of any type (A or B) and one data download. We assume the following data: T min = 0, T max = 12, Mmax = 10, Minit = 5, D A = 4, D B = 7, C A = 7, and C B = 5. The CNT framework In this section we present the minimal set of basic notions that are necessary to define the modeling framework we propose. Attributes Definition 1 An attribute at is defined by a pair t y(at), do(at), where t y(at) is the type of at with three possible values (state, event, or time) and do(at) is the domain of values of at. If at is of type state, there is no assumption on the nature of do(at). In particular, do(at) may be finite or infinite. If at is of type event, there is no assumption too, except that do(at) includes a special value ⊥ to represent the absence of event. Finally, if at is of type time, it is assumed that do(at) ⊆ R. State attributes are used to represent the successive values of permanent features of the system. Event attributes are used to represent the successive values of instantaneous phenomena in the system. Finally, time attributes are used to 4

Dt y and Ct y are assumed to be strictly positive.

123

represent the times at which permanent features change or instantaneous phenomena occur. To represent our illustrative example, we may use: (1) an attribute ta, which represents the successive task types, with t y(ta) = event and do(ta) = {A, B, ⊥}; (2) an attribute tta, which represents the times at which successive tasks are triggered, with t y(tta) = time and do(tta) = [T min, T max];5 (3) an attribute dl, which represents the successive data downloads, with t y(dl) = event and do(dl) = {, ⊥}; (4) an attribute tdl, which represents the times at which successive data downloads are triggered, with t y(tdl) = time and do(tdl) = [T min, T max]; (5) an attribute me, which represents the successive levels of free memory, with t y(me) = state and do(me) = [0 . . . Mmax];6 (6) an attribute tme, which represents the times at which the level of free memory changes, with t y(tme) = time and do(tme) = [T min, T max]. Timelines Definition 2 A timeline tl is defined by a pair ats(tl), ns(tl), where ats(tl) is a finite set of attributes associated with tl and ns(tl) is a variable (an unknown) which represents the number of steps in tl. It is assumed that ats(tl) includes at most one time attribute. We note ti(tl) this time attribute, if it exists. It may not exist when the temporal positions of the successive steps are not relevant. It is also assumed that an attribute belongs to exactly one timeline (the timelines induce a partition of the set of attributes). For each attribute at, we note tl(at) the timeline at which it belongs. To be more concise, for each state or event attribute at, we note ti(at) the time attribute of the timeline at which it belongs: ti(at) = ti(tl(at)). It is assumed that the domain of values do(ns(tl)) of the variable ns(tl) is a subset of N, finite or infinite. Steps are numbered from 1 to ns(tl). To be more concise too, we note ns(at) = ns(tl(at)). Timelines are used to gather synchronized attributes, i.e. attributes that share the same steps, with the same temporal positions. To represent our illustrative example, we may use: (1) a timeline tlta to represent the successive tasks, with ats(tlta) = {ta, tta} and do(ns(tlta)) = {2} (assumption of exactly two tasks); 5

As usual, we note [a, b] the set of reals between a and b.

6

We note [a . . . b] the set of integers between a and b.

J Intell Manuf

(2) a timeline tldl to represent the successive data downloads, with ats(tldl) = {dl, tdl} and do(ns(tldl)) = {1} (assumption of exactly one data download); (3) a timeline tlme to represent the successive levels of free memory, with ats(tlme) = {me, tme} and do(ns(tlme) = {3} (exactly three steps at which the level of free memory may change, with the assumption that all the memory required by a task is consumed when triggering it). For example, we would have: ti(tlta) = tta, tl(ta) = tlta, and ti(ta) = tta. In this tiny example, the domains of the variables ns(tl) are singletons. These variables are in fact constant. But, if we had assumed at least two tasks and at most one data download, we would have the following domains: do(ns(tlta)) = [2 . . . ∞], do(ns(tldl)) = [0 . . . 1], and do(ns(tlme)) = [2 . . . ∞], i.e. two infinite domains and one finite one.7 In this example too, in each timeline, there are one time attribute and only one state or event attribute. But, in general, this is not the case. For example, if we assume that there is no data download, task triggerings and changes in the level of free memory are synchronized. In such conditions, it would be possible to consider only three attributes ta, me, and tta, and one timeline tl, with ats(tl) = {ta, me, tta}. Associated variables We saw that, with any timeline tl, is associated a variable ns(tl) which represents the number of steps in tl. Moreover, with each timeline tl, each attribute at ∈ ats(tl), and each step i ∈ [1 . . . max(do(ns(tl)))],8 i.e. with each possible step in tl, is associated a variable ati which represents the value of at at step i. The domain of values do(ati ) of this variable is the domain do(at) of the associated attribute. In other words, all the variables ati have the same domain of values do(at). For state attributes and only for them, we add a variable at0 which represents the initial value of at. We note sa-vars(at) the finite set of the variables that are necessarily associated with an attribute at. For state attributes, sa-vars(at) = {ati | i ∈ [0 . . . min(do(ns(at)))]} and for event or time attributes, sa-vars(at) = {ati | i ∈ [1 . . . min(do(ns(at)))]}. Moreover, we note a-vars(at) the finite variable set of the variables associated with an attribute at, function of the variable ns(at). For state attributes, a-vars(at) = {ati | i ∈ [0 . . . ns(at)]} and for event or time

7

We note [a . . . ∞] the set of integers greater than or equal to a.

Fig. 3 Tabular representation of the timeline tlme

attributes, a-vars(at) = {ati | i ∈ [1 . . . ns(at)]}.9 In our illustrative example: (1) sa-vars(me) = {me0 , me1 , me2 , me3 }; me0 represents the initial level of free memory and me1 , me2 , and me3 the levels of free memory at each of the three successive steps in the associated timeline tlme; these four variables have the same domain of values do(me) = [0 . . . Mmax] (example of a state attribute); (2) sa-vars(ta) = {ta1 , ta2 }; ta1 represents the type of the first task and ta2 the type of the second one; both variables have the same domain of values do(ta) = {A, B, ⊥} (example of an event attribute); (3) sa-vars(tta) = {tta1 , tta2 }; tta1 represents the time at which the first task is triggered and tta2 the time at which the second one is triggered; both variables have the same domain of values do(tta) = [T min, T max] (example of a time attribute). We note sa-vars(tl) the finite set of the variables that are necessarily associated with a timeline tl: sa-vars(tl) = ∪at∈ats(tl) sa-vars(at). Similarly, we note a-vars(tl) the finite variable set of the variables associated with a timeline tl, function of the variable ns(tl): a-vars(tl) = ∪at∈ats(tl) a-vars(at). Figure 3 shows a tabular representation of the timeline tlme, which represents the evolution of the free memory. The first row represents the successive steps. The second one represents the variables associated with the attribute tme, i.e. the temporal positions of these steps, and the third one the variables associated with the attribute me, i.e. the levels of free memory at these steps. If tls is a finite set of timelines, we note: (1) d-vars(tls) = {ns(tl) | tl ∈ tls}: a finite set of variables we refer to as dimension variables; (2) sa-vars(tls) = ∪tl∈tls sa-vars(tl): a finite set of variables we refer to as static attribute variables; (3) s-vars(tls) = d-vars(tls) ∪ sa-vars(tls): a finite set of variables we refer to as static variables, because they are necessarily present, independently of the assignment of the dimension variables; (4) a-vars(tls) = ∪tl∈tls a-vars(tl): a variable finite set we refer to as attributes variables, which is a function of the assignment of the dimension variables;

8

If the domain of values do(ns(tl)) of the variable ns(tl) is infinite, we adopt the convention that max(do(ns(tl))) = ∞.

9

For the sake of concision, we omit ns(at) in the parameters of a-vars.

123

J Intell Manuf

Constraint c2 , together with constraint c1 and the domain of values of the attribute tta, is sufficient to specify that both tasks occur between T min and T max : tta2 + Dta2 ≤ T max

(2)

Constraint c3 specifies that the data download does not conflict with both tasks: (tdl1 < tta1 ) ∨ (tta1 + Dta1 ≤ tdl1 < tta2 ) ∨

(3)

(tta2 + Dta2 ≤ tdl1 ) Constraint c4 specifies the initial level of free memory: me0 = Minit

Constraints c5 , c6 , and c7 specify the way the level of free memory evolves according to the interleaving between the data download and both tasks.

Fig. 4 Variables associated with a set tls of timelines

(5) da-vars(tls) = a-vars(tls)\sa-vars(tls): a variable finite set of variables we refer to as dynamic attribute variables, because their presence depends on the assignment of the dimension variables. Figure 4 represents the two partitions of the set of variables associated with a set of timelines: between dimension and attribute variables and between static and dynamic ones. In our illustrative example, because the numbers of steps in each timeline are fixed, all the variables are static. Static constraints In this section, we assume a finite set tls of timelines and we define static constraints, i.e. constraints whose definition does not depend on the assignment of the dimension variables. Definition 3 A static constraint c on a finite set tls of timelines is a classical CSP constraint, defined by a pair sco(c), r el(c), where sco(c) (the scope of c) is a (finite) set of static variables (sco(c) ⊆ s-vars(tls)) and r el(c) (the relation associated with c) is any explicit or implicit representation of the set of allowed combinations of values of the variables in sco(c). In other words, a static constraint is a classical CSP constraint on the static variables. Our illustrative example can be modeled using only such constraints. Constraint c1 specifies that both tasks do not overlap: tta1 + Dta1 ≤ tta2

(1)

Note that this constraint is not linear because of the variable ta1 which appears as an index of D. Its scope is {tta1 , tta2 , ta1 } and its relation is specified by Eq. 1.

123

(4)

(tdl1 < tta1 ) →

((me1 = Mmax)∧

(5)

(me2 = me1 −Cta1 )∧ (me3 = me2 −Cta2 )) (tta1 + Dta1 ≤ tdl1 < tta2 ) → ((me1 = me0 −Cta1 )∧ (6) (me2 = Mmax)∧ (me3 = me2 −Cta2 )) (tta2 + Dta2 ≤ tdl1 ) →

((me1 = me0 −Cta1 )∧ (7) (me2 = me1 −Cta2 )∧ (me3 = Mmax))

Note that the fact that the level of free memory must always lie between 0 and Mmax is enforced by the domain of values of the attribute me. Finally, if we want to have exactly two tasks and one data download, we should add constraints c8 , c9 , and c10 : ta1 = ⊥

(8)

ta2 = ⊥

(9)

dl1 = ⊥

(10)

This modeling is not very compact. We will see in Sect. “Illustrative example revisited” a more compact modeling of an extended version of this example, thanks to the notions introduced in Sect. “Dynamic constraints and other useful variables”. Dynamic constraints In this section, we keep assuming a finite set tls of timelines and we define dynamic constraints, i.e. constraints whose definition depends on the assignment of the dimension variables. Definition 4 A dynamic constraint c on a finite set tls of timelines is defined by a pair tls(c), f ct (c), where tls(c)

J Intell Manuf

is a (finite) set of timelines, subset of tls, and f ct (c) is a function which associates a finite set of CSP constraints with each assignment of the dimension variables in d-vars(tls(c)). It is moreover assumed that the scope of each of these CSP constraints is a (finite) subset of a-vars(tls(c)) ∪ s-vars(tls). In other words, a dynamic constraint is a way of defining sets of classical CSP constraints, with a specific set associated with each assignment of the dimension variables. As an example, let us consider our illustrative example with no assumption about the number of tasks. To generalize the static constraint c2 defined in static constraints, we can use a dynamic constraint c2 such that tls(c2 ) = {tlta} (only the timeline tlta is involved) and f ct (c2 ) associates only one constraint with each assignment of ns(tlta). The scope of this latter constraint is {ttans(tlta) , tans(tlta) } and its relation is specified by Eq. 11: ttans(tlta) + Dtans(tlta) ≤ T max

(11)

Constraint c2 expresses merely that the last task must end before T max or at T max at the latest. The same way, to generalize the static constraint c1 defined in Sect. “Static constraints”, we can use a dynamic constraint c1 such that tls(c1 ) = {tlta} (only the timeline tlta is involved) and f ct (c1 ) associates a set of constraints with each assignment of ns(tlta). In this set, we have one con for each i ∈ [2 . . . ns(tlta)]. The scope of c is straint c1,i 1,i {ttai−1 , ttai , tai−1 } and its relation is specified by Eq. 12: ttai−1 + Dtai−1 ≤ ttai

(12)

More compactly, this could be written: ∀i ∈ [2 . . . ns(tlta)], ttai−1 + Dtai−1 ≤ ttai

(13)

Constraint c1 expresses that two successive tasks do not overlap. Dynamic constraints can be used the same way to specify that, for each timeline tl such that ti(tl) (its associated time attribute) exists and each step i ∈ [2 . . . ns(tl)], we have (ti(tl))i−1 < (ti(tl))i (basic assumption of the CNT framework). Another example is the case of an attribute at (in a timeline tl) which must not take the same value at two different steps. To enforce that, we can use a dynamic constraint c which involves only the timeline tl (tls(c) = {tl}) and associates only one constraint with each assignment of ns(tl). The scope of this latter constraint is {ati | i ∈ [1 . . . ns(tl)]} and its relation is specified by: alldi f f er ent (ati | i ∈ [1 . . . ns(tl)]). To enforce that there exists a step at which an attribute at takes a specific value val, we could use the same kind of dynamic constraint by replacing alldi f f er ent (ati | i ∈ [1 . . . ns(tl)]) by ∨i∈[1...ns(tl)] (ati = val).

Constraint network on timelines We have now all the pieces necessary to define what a constraint network on timelines (CNT) is. Definition 5 A constraint network on timelines cnt is defined by a pair tls(cnt), cs(cnt), where tls(cnt) is a finite set of timelines and cs(cnt) is a finite set of static or dynamic constraints on tls(cnt). It is assumed that all the sets ats(tl) | tl ∈ tls(cnt) are disjoints (no shared attribute). For example, our illustrative example is modeled by the constraint network on timelines cnt, where tls(cnt) = {tlta, tldl, tlme} and cs(cnt) = {c1 , . . . , c10 }. We define now what an assignment of a constraint network on timelines, a consistent assignment, and a consistent constraint network on timelines are. Definition 6 An assignment of a constraint network on timelines cnt is defined by an assignment of all the variables in d-vars(tls(cnt)) and in a-vars(tls(cnt)), i.e. of all the dimension variables and all the associated attribute variables. It is important to keep in mind that the set a-vars(tls(cnt)) of attribute variables is function of the assignment of the dimension variables in d-vars(tls(cnt)). In other words, a constraint network assignment specifies the numbers of steps in all the timelines and the values of all the variables associated with each attribute and each step. It can be seen as a finite history, execution, or scenario, which may be consistent or not. Definition 7 A consistent assignment (a solution) of a constraint network on timelines cnt is an assignment of cnt such that all the static constraints and all the ones that result from the dynamic constraints and from the assignment of the dimension variables are satisfied. Such an assignment can be seen as a feasible and/or acceptable history, execution, or scenario, according to the origin of the constraints: physical laws and/or user requirements. Definition 8 A constraint network on timelines cnt is consistent if there exists a consistent assignment of cnt. Figure 5 shows a tabular representation of a solution of our illustrative example with a task of type B triggered at t = 0.3, a data download triggered at t = 7.5 some time after the end of this task, and a task of type A triggered at t = 7.8. Figure 6 shows a graphical representation of the same solution. Other useful variables The variables presented in Sect. “Associated variables” are the basic variables on which we have to reason when reasoning

123

J Intell Manuf

Fig. 7 Value of an attribute at (associated with a timeline tl  ) at a step i in another timeline tl

Fig. 5 Tabular representation of a solution

Fig. 6 Graphical representation of the same solution

on timelines. It may be however useful to introduce other variables which are functions of the previous ones, but may make modeling and reasoning easier. To define these variables, we make the assumption that each timeline tl has an associated time attribute ti(tl). A timeline tl defines the values of its associated state or event attributes at the successive steps in tl. But, it may be useful to refer to the value of any state or event attribute, which may not belong to tl, but to another timeline tl  , at any step in tl (different timelines are not assumed to be synchronized). Let val(at, tl, i) be the value of the attribute at at the step i in the timeline tl. This value is a function of the variable (ti(tl))i (the time associated with the step i in the timeline tl), but also of the variable ns(at) and of the variables in a-vars(at) and a-vars(ti(at)). Let be j = max(0, max( j  | ( j  ∈ [1 . . . ns(at)]) ∧ ((ti(at)) j  ≤ (ti(tl))i ))): j is the latest step in tl(at) that occurs before (ti(tl))i or at (ti(tl))i , equal to 0 if such a step does not exist (see Fig. 7 for an illustration). If at is a state attribute, then val(at, tl, i) = at j , according to the

123

assumption that, between two successive steps, a state attribute keeps the value it took at the first of these steps. If at is an event attribute, if j = 0 and (ti(at)) j = (ti(tl))i , then val(at, tl, i) = at j . Else, val(at, tl, i) = ⊥, according to the assumption that, between two successive steps, an event attribute has the value ⊥. Independently from the type of attribute (state or event), if tl(at) = tl, we have obviously: val(at, tl, i) = ati . As an example, in the solution of Fig. 5, val(me, tlta, 1) = 0, val(me, tldl, 1) = 10, and val(ta, tldl, 1) = ⊥. To go further, it may be useful to refer to the value of any state attribute, which may not belong to tl, but to another timeline tl  , just before any step in tl. For an event attribute, this value is systematically equal to ⊥. Let valb(at, tl, i) be the value of the state attribute at just before the step i in the timeline tl. As val(at, tl, i) is, this value is a function of the variable (ti(tl))i (the time associated with the step i in the timeline tl), but also of the variable ns(at) and of the variables in a-vars(at) and a-vars(ti(at)). Let be j = max(0, max( j  | ( j  ∈ [1 . . . ns(at)]) ∧((ti(at)) j  < (ti(tl))i ))): j is the latest step in tl(at) that occurs strictly before (ti(tl))i , equal to 0 if such a step does not exist. We have valb(at, tl, i) = at j . If tl(at) = tl, we have obviously: valb(at, tl, i) = ati−1 . As an example, in the solution of Fig. 5, valb(me, tlta, 1) = 5 and valb(me, tldl, 1) = 0.

The illustrative example revisited All the notions presented in the previous section allow us now to model our illustrative example without any assumption on the number of tasks and data downloads. To do that, we keep considering three timelines: (1) a timeline tlta to represent the successive tasks, with ats(tlta) = {ta, tta}, do(ns(tlta)) = [0 . . . ∞], t y(ta) = state, do(ta) = {A, B, ⊥}, t y(tta) = time, and do(tta) = [T min, T max]; (2) a timeline tldl to represent the successive data downloads, with ats(tldl) = {dl, tdl}, do(ns(tldl)) = [0 . . . ∞], t y(dl) = event, do(dl) = {, ⊥}, t y(tdl) = time, and do(tdl) = [T min, T max];

J Intell Manuf

(3) a timeline tlme to represent the successive levels of free memory, with ats(tlme) = {me, tme}, do(ns(tlme)) = [0 . . . ∞], t y(me) = state and do(me) = [0 . . . Mmax], t y(tme) = time, and do(tme) = [T min, T max]. Note that ta is now a state attribute, whereas it was an event attribute in the previous section. The following set of constraints expresses all the physical limitations and user requirements. Constraint c14 specifies that there is initially no active task (example of a static constraint). ta0 = ⊥

∀i ∈ [0 . . . ns(tlta)], (tai = ⊥) → (val(me, tlta, i) (22) = valb(me, tlta, i) − Ctai ) Finally, constraint c23 specifies the effect of a data download on the memory. ∀i ∈ [1 . . . ns(tldl)], val(me, tldl, i) = Mmax

(23)

Note that the domains of the time attributes tta and tdl enforce that all the tasks and data downloads occur between T min and T max.

(14)

Constraint c15 specifies that there is no active task too at the last step, and thus at the end of the temporal horizon: all the tasks are achieved (example of a dynamic constraint). tans(tlta) = ⊥

(15)

Constraint c16 results from the task durations. Moreover, it takes into account the fact that a task can start exactly when the previous one ends. ∀i ∈ [0 . . . ns(tlta) − 1], (tai = ⊥) →

(16)

(ttai+1 = ttai + Dtai ) Constraint c17 specifies that there are no two successive steps in the timeline tlta with no active task at both steps: the second step would be useless. The goal of such a constraint is to make the model more compact. ∀i ∈ [0 . . . ns(tlta) − 1], (tai = ⊥) →

(17)

(tai+1 = ⊥) Constraint c18 specifies that there is a data download at each step in tldl: a step with no data download would be useless. As the previous constraint, the goal of such a constraint is to make the model more compact. ∀i ∈ [1 . . . ns(tldl)], dli = ⊥

(18)

Constraint c19 specifies that no task is active when a data download is triggered. ∀i ∈ [1 . . . ns(tldl)], val(ta, tldl, i) = ⊥

(19)

Constraint c20 specifies that there is no step in the timeline tlme independently of a task triggering or of a data download. In the writing of this constraint, (tai = ⊥) is equal to 1 when tai = ⊥ and to 0 otherwise.  ns(tlme) = ns(tldl) + (tai = ⊥) (20) i∈[0...ns(tlta)]

Constraint c21 sets the initial level of free memory. me0 = Minit

Constraint c22 specifies the task memory consumptions.

(21)

Subsumed frameworks In this section, we show how the CNT framework subsumes existing ones such as automata, products of automata, timed automata, Petri nets, STRIPS planning, resource-constrained project scheduling, temporal constraint networks, and others. Automata An automaton is usually defined as a quadruple S, E, T, Sinit where: (1) (2) (3) (4)

S is a finite set of states; E is a finite set of events; T ⊆ S × E × S is a set of transitions; Sinit ∈ S is the initial state.

T is the set of possible transitions: if s, e, s   ∈ T , transition is possible from state s to state s  when event e occurs. This definition includes non determinism because, for a given state s and a given event e, there may exist several states s  such that s, e, s   ∈ T . An automaton can be modeled in the CNT framework by using one timeline tl, involving two attributes: one state attribute s to represent the successive states and one event attribute e to represent the successive events. Because the temporal positions of the successive steps are irrelevant in the basic automaton framework, tl involves no time attribute. More precisely, it is easy to show that an automaton S, E, T, Sinit is equivalent to a CNT tls, cs where tls = {tl} (one timeline tl), ats(tl) = {s, e} (two attributes s and e), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), t y(s) = state, do(s) = S, t y(e) = event, do(e) = E ∪{⊥}, and cs is made of the following constraints: one static constraint which specifies the initial state (c24 ) and two dynamic ones which specify that an event occurs at each step (c25 ) and that the resulting transition belongs to the set of possible transitions (c26 ). s0 = Sinit

(24)

123

J Intell Manuf

∀i ∈ [1 . . . ns(tl)], ei = ⊥

(25)

∀i ∈ [1 . . . ns(tl)], si−1 , ei , si  ∈ T

(26)

If we want to prove that a given state Sr is reachable (resp. unreachable), it suffices to add constraint c27 and to prove that the resulting CNT is consistent (resp. inconsistent). sns(tl) = Sr

(27)

Synchronized products of automata A synchronized product of automata Arnold and Nivat (1982) is usually defined as a pair AS, SY  where: (1) AS is a finite set of n automata Sa , E a , Ta , Sinita , a ∈ [1 . . . n];  (2) SY ⊆ a∈AS (E a ∪ {⊥}) is a set of joint events, where ⊥ represents the absence of event in a local automaton. The synchronization set SY specifies possible joint events. Note that the absence of event in a local automaton is now allowed. A synchronized product of automata can be modeled in the CNT framework by using one timeline tl, involving one state attribute sa and one event attribute ea for each automaton a ∈ [1 . . . n]. More precisely, it is easy to show that a synchronized product of automata AS, SY  is equivalent to a CNT tls, cs where tls = {tl} (one timeline), ats(tl) = ∪a∈[1...n] {sa , ea } (two attributes sa and ea per automaton), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), ∀a ∈ [1 . . . n], t y(sa ) = state, do(sa ) = Sa , t y(ea ) = event, do(ea ) = E a ∪ {⊥}, and cs is made of the following constraints: n static constraints which specify the initial state (c28 ), n dynamic ones which specify the possible transitions in each local automaton (c29 ), and one dynamic constraint which specifies the possible joint events (c30 ). ∀a ∈ [1 . . . n], sa,0 = Sinita

(28)

∀a ∈ [1 . . . n], ∀i ∈ [1 . . . ns(tl)]

(29)

sa,i−1 , ea,i , sa,i  ∈ Ta ∪ {s, ⊥, s | s ∈ Sa } ∀i ∈ [1 . . . ns(tl)], e1,i . . . ea,i . . . en,i  ∈ SY

(30)

More specific ways of synchronizing automata, via shared variables or message passing, could be easily translated in the CNT framework too. Timed automata A timed automaton Alur and Dill (1994) is usually defined as a tuple S, E, C, I, T, Sinit where:

123

(1) S is a finite set of states; (2) E is a finite set of events; (3) C is a finite set of clocks, each clock c ∈ C being a real-valued variable; let ccs(C) be the set of all the possible clock constraints that can be defined on C, a clock constraint being any finite conjunction of atomic constraints of the form c ∼ n or c − c ∼ n, with c, c ∈ C, n ∈ N, and ∼∈ {<, ≤, =, ≥, >}; (4) I is a function from S to ccs(C), which associates a clock constraint with each state; (5) T ⊆ S × ccs(C) × E × 2C × S is a finite set of transitions;10 (6) Sinit ∈ S is the initial state. Function I specifies the clock constraint that must hold in any state (usually referred to as a state invariant constraint). T specifies the set of possible transitions. If s,cc,e,C  ,s  ∈T, transition is possible from state s to state s  when event e occurs and the clock constraint cc holds (usually referred to as a transition guard constraint). Moreover, as a result of the transition, all the clocks in C  are reset to 0. However, a timed automaton can be modeled in the CNT framework by using one timeline tl, involving 3+2.|C| attributes: one state attribute s to represent the successive states, one event attribute e to represent the successive events, one time attribute t to represent the temporal positions of the successive steps, and two state attributes tc and tbc for each clock c ∈ C to represent the clock values at each step (tc ) and just before each step (tbc ). More precisely, one can show that a timed automaton S, E, C, I, T, Sinit is equivalent to a CNT tls, cs where tls = {tl} (one timeline), ats(tl) = {s, e, t} ∪ {tc , tbc | c ∈ C} (three attributes s, e, and t, plus two attributes tc and tbc per clock), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), t y(s) = state, do(s) = S, t y(e) = event, do(e) = E ∪ {⊥}, t y(t) = state, do(t) = R+ , ∀c ∈ C, t y(tc ) = t y(tbc ) = state and do(tc ) = do(tbc ) = R+ , and cs is made of the following constraints: two static constraints which specify the initial state (c31 ) and the initial time (c32 ), |C| static constraints which specify the initial value of each clock (c33 ), |C| dynamic ones which specify for each clock the relation between the attributes tbc , tc , and t (c34 ), and three dynamic ones which specify that the state invariant constraint associated with any state is satisfied when starting and ending with this state(c35 ), that an event occurs at each step (c36 ), that the resulting transition belongs to the set of possible transitions, taking into account the transition guard constraint and the clock resets (c37 ). s0 = Sinit 10

As usual, we note 2C the set of subsets of a set C.

(31)

J Intell Manuf

t0 = 0

(32)

∀c ∈ C, tc,0 = 0

(33)

∀c ∈ C, ∀i ∈ [1 . . . ns(tl)],

(34)

tbc,i = tc,i−1 + ti − ti−1 ∀i ∈ [1 . . . ns(tl)], ∀ac ∈ I (si−1 ),

(35)

((ac = c ∼ n) → ((tc,i−1 ∼ n) ∧ (tbc,i ∼ n))) ((ac = c ∼ c ) → ((tc,i−1 ∼ tc ,i−1 ) ∧ (tbc,i ∼ tbc ,i ))) ∀i ∈ [1 . . . ns(tl)], ei = ⊥ ∀i ∈ [1 . . . ns(tl)], ∃ s, cc, e, C  , s   ∈ T |

(36) (37)



((si−1 = s) ∧ (si = s ) ∧ (ei = e) ∧ (∀c ∈ C  , tc,i = 0) ∧ (∀c ∈ C − C  , tc,i = tbc,i ) ∧ (∀ac ∈ cc, ((ac = c ∼ n) → (tbc,i ∼ n)) ((ac = c ∼ c ) → (tbc,i ∼ tbc ,i )))) To be more precise about constraint c35 , we must consider the special case where ac is of the form c < n. In that case, we should not enforce the constraint tbc,i < n, but the weaker constraint tbc,i ≤ n to allow a transition when tbc,i = n, because such a transition satisfies ac. To be more precise too, we should add the constraint that it is not possible to end in a state s such that the state invariant constraint I (s) includes an atomic constraint ac of the form c ∼ n, with ∼∈ {<, ≤}, because of the necessary violation of such a constraint as time goes on. For any such state s, it suffices to add the constraint Sns(tl) = s. Petri nets A Petri net is usually defined as a quadruple P, T, I p, O p where: (1) P is a finite set of places; (2) T is a finite set of transitions; (3) I p is an input function from P × T to N, which associates a positive integer (possibly null) with each place p ∈ P and each transition t ∈ T ; (4) O p is a similar output function. A marking m (which can be considered as a state) is defined as a function from P to N, which associates an integer m( p) with each place p ∈ P. To be triggered from marking m, a transition t ∈ T must satisfy the following condition:

∀ p ∈ P, m( p) ≥ I p( p, t). If a transition t ∈ T is triggered from marking m, the result is a marking m  where ∀ p ∈ P, m  ( p) = m( p) − I p( p, t) + O p( p, t). A Petri net can be modeled in the CNT framework by using one timeline tl, involving |P| + 1 attributes: one state attribute m p for each place p ∈ P to represent the successive markings and one event attribute t to represent the successive transitions. As with automata, because the temporal positions of the successive steps are irrelevant in the basic Petri net framework, tl involves no time attribute. More precisely, it is easy to show that a Petri net P, T, I p, O p is equivalent to a CNT tls, cs where tls = {tl} (one timeline tl), ats(tl) = {m p | p ∈ P} ∪ {t} (|P| state attributes m p and one event attribute t), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), ∀ p ∈ P, t y(m p ) = state, do(m p ) = N, t y(t) = event, do(t) = T ∪ {⊥},11 and cs is made of the following constraints: one dynamic constraint which specifies that a transition occurs at each step (c38 ) and two dynamic ones for each place p ∈ P, the first ones specifying the transition conditions (c39 ) and the second ones specifying its effects (c40 ). ∀i ∈ [1 . . . ns(tl)], ti = ⊥

(38)

∀ p ∈ P, ∀i ∈ [1 . . . ns(tl)],

(39)

m p,i−1 ≥ I p( p, ti ) ∀ p ∈ P, ∀i ∈ [1 . . . ns(tl)],

(40)

m p,i = m p,i−1 − I p( p, ti ) + O p( p, ti ) STRIPS planning Planning problems may be of very different kinds and, despite many efforts such as the PDDL language McDermott (1998), Fox and Long (2003), there is no unique framework able to cover all of them Ghallab et al. (2004). This is why we restrict ourselves to the most classical one: the STRIPS framework Fikes and Nilsson (1971) where a planning problem is defined as a quadruple F, A, I, G where: (1) F is a finite set of boolean variables, called fluents; (2) A is a finite set of actions, where each action a ∈ A is defined by a triple  pa , ea− , ea+ , with pa , ea− , ea+ ⊆ F and ea− ∩ ea+ = ∅, where pa , ea− , and ea+ are action preconditions, negative effects, and positive effects; (3) I ⊆ F is a set of fluents, which defines the initial state; (4) G is a finite set of logical conditions on F, called goals. A state s is defined as a function from F to B, which associates a boolean value s( f ) with each fluent f ∈ F. The 11

This is possible because of the basic assumption of the Petri net framework that two transitions cannot be triggered at the same time.

123

J Intell Manuf

following conditions must be satisfied by states and transitions: (1) in the initial state s0 , (s0 )( f ) if and only if f ∈ I ; (2) an action a ∈ A can be executed in a state s if and only if ∀ f ∈ pa , s( f ); (3) if an action a ∈ A is executed in a state s, the result is a state s  where: (a) ∀ f ∈ ea− , ¬s  ( f ); (b) ∀ f ∈ ea+ , s  ( f ); (c) ∀ f ∈ F − (ea− ∪ ea+ ), s  ( f ) = s( f ).

∀ f ∈ I, s f,0 = 1

(41)

∀ f ∈ F \ I, s f,0 = 0

(42)

∀i ∈ [1 . . . ns(tl)], ai = ⊥

(43)

∀ f ∈ F, ∀i ∈ [1 . . . ns(tl)],

(44)

( f ∈ pai ) → (s f,i−1 = 1)

( f ∈ ea+i ) → (s f,i = 1)

123

(f ∈

ea−i )

(46)

→ (s f,i = 0)

∀ f ∈ F, ∀i ∈ [1 . . . ns(tl)], (f ∈ F

\ (ea−i

∪ ea+i ))

(47) → (s f,i = s f,i−1 )

∀g ∈ G, g(Sns(tl) ) = tr ue

(48)

Resource-constrained project scheduling

The request usually associated with a planning problem is to produce a plan, i.e. a sequence of actions, whose execution allows the system to go from the initial state to a state that satisfies the goal conditions. Similarly to the modeling we used for the Petri net framework, a STRIPS planning problem can be modeled in the CNT framework by using one timeline tl, involving |F| + 1 attributes: one state attribute s f for each fluent f ∈ F to represent the successive states and one event attribute a to represent the successive actions. As with automata and Petri nets, because the temporal positions of the successive actions are irrelevant, tl involves no time attribute. More precisely, it is easy to show that a STRIPS planning problem F, A, I, G is equivalent to a CNT tls, cs where tls = {tl} (one timeline tl), ats(tl) = {s f | f ∈ F} ∪ {a} (|F| state attributes s f and one event attribute a), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), ∀ f ∈ F, t y(s f ) = state, do(s f ) = {0, 1}, t y(a) = event, do(a) = A ∪ {⊥}, and cs is made of the following constraints: one static constraint for each fluent f ∈ F which together specify the initial state (c41 and c42 ), one dynamic constraint which specifies that an action is triggered at each step (c43 ), four dynamic constraints for each fluent f ∈ F which together specify the action preconditions (c44 ), the action positive effects (c45 ), the action negative effects (c46 ), and the action null effects (c47 ), and finally one dynamic constraint per goal conditions g ∈ G (c48 with Si = {s f,i | f ∈ F}).

∀ f ∈ F, ∀i ∈ [1 . . . ns(tl)],

∀ f ∈ F, ∀i ∈ [1 . . . ns(tl)],

(45)

In the domain of scheduling, there is no reference modeling framework similar to the STRIPS framework used in planning. However there exist reference problems people are working on. Here we focus on the RCPSP (Resource-Constrained Project Scheduling Problem Baptiste et al. (2001)), because it generalizes to sharable resources well known problems on unsharable resources such as the Job-Shop, the FlowShop, and the Open-Shop problems.12 A RCPSP is defined by a tuple n, m, D, Co, Ca, Pr, T max where: (1) n is the number of tasks; (2) m is the number of resources; (3) D is a table which associates a duration Dt with each task t ∈ [1 . . . n]; (4) Co is a table which associates a resource consumption Cot,r with each task t ∈ [1 . . . n] and each resource r ∈ [1 . . . m]: Cot,r is the consumption of resource r by task t; (5) Ca is a table which associates a capacity Car with each resource r ∈ [1 . . . m]: at any time, the sum of the consumptions of the resource r by all the active tasks must be less than or equal to Car ; (6) Pr is a table which associates with each pair of tasks t, t  ∈ [1 . . . n] a boolean Prt,t  which is equal to 1 if and only if t must precede t  : ∀t ∈ [1 . . . n], Prt,t = 0 and ∀t, t  ∈ [1 . . . n], (Prt,t  = 1) → (Prt  ,t = 0); if Prt,t  = 1, task t  must start at the earliest at the end of task t; (7) T max is the maximal duration of the project: all the tasks must be achieved before T max or at T max at the latest. The request usually associated with a RCPSP is to find a starting date for each task such that all the resource and temporal constraints are satisfied: a decision problem with a positive answer if such dates exist and a negative one otherwise. 12

An unsharable resource is a special case of sharable resource where the maximum capacity and the consumption of each task are both equal to one.

J Intell Manuf

A RCPSP can be modeled in the CNT framework by using n timelines, one timeline tlt for each task t ∈ [1 . . . n], each of these timelines involving two attributes: one state attribute to represent the fact that task t is active or not and one time attribute to represent the starting and ending times of task t. More precisely, it is easy to show that a RCPSP n, m, D, Co, Ca, Pr, T max is equivalent to a CNT tls, cs where tls = {tlt | t ∈ [1 . . . n]} (n timelines), ∀t ∈ [1 . . . n], ats(tlt ) = {act , ti t } (two attributes per timeline), do(ns(tlt )) = {2} (two steps per timeline), t y(act ) = state, do(act ) = {, ⊥}, t y(t yt ) = time, do(ti t ) = [0, T max], and cs is made of the following static constraints: three constraints for each task t ∈ [1 . . . n] which specify that each task is initially inactive (c49 ), then active (c50 ), and then inactive again (c51 ), one constraint for each task t ∈ [1 . . . n] which specifies its duration (c52 ), one constraint for each pair of tasks t, t  ∈ [1 . . . n] such that Prt,t  = 1 which enforces precedence (c53 ), and finally one constraint for each resource r ∈ [1 . . . m] and each task t ∈ [1 . . . n] which specifies that, when triggering task t, the sum of the consumptions of the resource r by all the active tasks does not exceed the resource capacity (c54 ). ∀t ∈ [1 . . . n], act,0 = ⊥

(49)

∀t ∈ [1 . . . n], act,1 = 

(50)

∀t ∈ [1 . . . n], act,2 = ⊥

(51)

∀t ∈ [1 . . . n], ti t,2 − ti t,1 = Dt

(52)

∀t, t  ∈ [1 . . . n] | (Prt,t  = 1), ti t,2 ≤ ti t  ,1

(53)

∀r ∈ [1 . . . m], ∀t ∈ [1 . . . n], (54)  n   (val(act  , tlt , 1) = ) · Cot  ,r ≤ Car t  =1

The maximal duration of the project is enforced by the domains of the time attributes ti t . Note that contrary to what happens with all the previous frameworks all the variables and constraints are here static: the whole problem is thus static. Temporal constraint networks Temporal constraint networks Dechter et al. (1991) are a particular case of CSP where the domains of the variables are all equal to R and the constraints are all of the form t ∈ n [a , b ] or t − t  ∈ ∪n [a , b ], where t and t  are two ∪i=1 i i i=1 i i variables and ∀i ∈ [1 . . . n], ai and bi are two reals. Simple temporal networks are a special case where n = 1 for each constraint (no disjunction).

A temporal constraint network is equivalent to a degenerate CNT with one timeline tl, only one step, one time attribute at per variable t in the constraint temporal network, the same domain R for each attribute, and all the constraints obtained by replacing t by at,1 . Note that all the variables and constraints are static. Other frameworks Similarly problems expressed in the classical frameworks used in the domain of combinatorial satisfaction, such as SAT, CSP, or PLNE (with no optimization criterion) can be transformed into degenerate CNTs. The resulting CNT includes one timeline tl, only one step, one event attribute ax per variable x in the original problem, whose domain is x  s domain, and all the constraints obtained by replacing in each constraint in the original problem each variable x by ax,1 . All the variables and constraints are static too.

Discussion Now, if we try to analyze the proposed CNT modeling framework with regard to existing ones, such as the ones presented in the previous section, we think that its main strength lies in its genericity: no assumption about the nature of the attribute domains (discrete or continuous, finite or not) and of the constraints (no restriction to a given constraint expression language), neither Markovian nor stationary assumption about the system dynamics. For example, automata are very generic, but assume a Markovian dynamics in addition to finite sets of states and actions. A first benefit of this genericity is a more global view of the existing frameworks. For example, one can see the proximity between Petri nets and STRIPS planning in terms of system dynamics modeling, already observed by some authors Hickmott et al. (2007). About its originality, we think that the main trick lies in the introduction of the dimension variables that represent the number of steps in the various timelines. On the one hand, these variables are similar to all the other ones: the attribute variables that represent the values of the attributes at the successive steps; they have a domain of values and may be submitted to constraints as the attribute variables. On the other hand, their assignment determines the set of attribute variables to be considered. The result is a kind of dynamic CSP. In dynamic CSPs Mittal and Falkenhainer (1990), also referred to as conditional CSPs Sabin et al. (2003), Gelle and Faltings (2003), the set of variables is divided into a set of mandatory variables and a set of optional ones. The set of constraints is also divided into a set of compatibility constraints and a set of activity constraints. Compatibility constraints are classical constraints. Activity constraints define the conditions

123

J Intell Manuf

of activation of the optional variables as a function of the assignment of other mandatory or optional variables. Constraints are activated only if their variables are activated too. In the CNT framework, the mandatory variables are the socalled static variables, i.e. the dimension variables and the static attribute variables, which are necessarily present. The optional variables are the so-called dynamic variables, i.e the dynamic attribute variables, which are not necessarily present. Differently from the basic dynamic CSP framework, the number of potential dynamic attribute variables may be unbounded, if the domain of some dimension variables is infinite. Some explanations are however necessary about of the term dynamic, which is used with different conflicting meanings. Firstly, we used it to refer to the nature of the systems we want to model: these systems are dynamic because they evolve with time. Secondly, we used it to refer to the nature of the CSPs which result from the modeling of these systems: these problems are dynamic because the set of variables and constraints involved is not fixed; it may evolve according the assignment of the dimension variables. But, this term is also used to refer to CSPs whose definition changes due to changes in the world they model Dechter and Dechter (1988), Verfaillie and Jussien (2005). We do not consider such a situation here: we deal with dynamic systems, but we assume that the models of these systems are stable, i.e. not subject to changes. So, only the first two meanings are considered in this article.

Decidability and complexity We saw that one of the main advantages of the CNT framework lies in its genericity. But an advantage may become a disadvantage. It is indeed possible to show that a deterministic Turing machine and its associated halting problem can be modeled as a CNT. As a consequence, because the halting problem of a deterministic Turing machine is undecidable, determining whether or not a CNT is consistent is undecidable too: there exists no algorithm able to determine whether or not a CNT is consistent, whatever the CNT is. A deterministic Turing machine works on an infinite number of totally ordered cells, on which a head can read and write symbols and move left or right. It is defined as a tuple S, E, T, W init, Cinit where:

(4) W init is the initial assignment of a symbol in E − {⊥} to a finite number of cells; all the other cells are assumed to have ⊥ as the initial assignment; (5) Cinit is the initial cell (the initial head position). s  , e , m = T (s, e) means that, if the current machine state is s and the symbol read in the current cell is e, then the next machine state is s  , the symbol written in the current cell is e , and the head movement is m (one cell left if m = −1, one cell right if m = +1, and no movement if m = 0). The main difference between a Turing machine and an automaton lies in the infinite number of cells which induces an infinite set of possible machine configurations. The halting problem associated with a deterministic Turing machine consists in determining if this machine reaches the halting state Shalt. A deterministic Turing machine can be modeled in the CNT framework by using one timeline tl, involving four attributes: one state attribute s to represent the successive states, one state attribute c to represent the successively visited cells, one event attribute r to represent the successively read symbols, and one event attribute w to represent the successively written symbols. More precisely, it is easy to show that a deterministic Turing machine S, E, T, W init, Cinit is equivalent to a CNT tls, cs where tls = {tl} (one timeline tl), ats(tl) = {s, c, r, w} (four attributes s, c, r , and w), do(ns(tl)) = [0 . . . ∞] (an unspecified number of steps), t y(s) = state, do(s) = S, t y(c) = state, do(c) = Z, t y(r ) = event, do(r ) = E, t y(w) = event, do(w) = E, and cs is made of the following constraints: two static constraints which specify the initial state (c55 ) and the initial cell (c56 ), one dynamic constraint which specifies the result of a transition (c57 ),13 and one dynamic constraint which expresses the read symbol as a function of the past (c58 ): it is equal to the symbol written in this cell the last step the head was pointing to this cell, if such a step exists; it is equal the symbol initially assigned to this cell (function of W init), otherwise.14 s0 = Sinit

(55)

c0 = Cinit

(56)

∀i ∈ [1 . . . ns(tl)], si , wi , ci − ci−1  = T (si−1 , ri ) (57) 13

We consider that, at step i, symbols are read and written in the cell ci−1 and the head is moving to cell ci .

(1) S is a finite set of states, including an initial state Sinit and a halting one Shalt; (2) E is a finite set of symbols, including a special default symbol ⊥; (3) T is a transition function from S × E into S × E × {−1, 0, +1};

123

14

More precisely, constraint c58 is a constraint between any variable ri and the variables ci  and wi  such that i  ≤ i − 1. The size of the scope of this constraint is thus unbounded. Deterministic Turing machines can be modeled using the CNT framework because it allows dynamic constraints which may induce themselves constraints whose scope size may be unbounded, when the domains of the dimension variables are infinite.

J Intell Manuf

∀i ∈ [1 . . . ns(tl)] 

(58) 

let be i = max(0, max(i | (1 ≤ i < i) ∧(ci  −1 = ci−1 )))

if (i  > 0) then ri = wi 

else ri = f (W init, ci−1 ) To determine that the deterministic Turing machine reaches the halting state Shalt, it suffices to add constraint c59 to the CNT definition. sns(tl) = Shalt

(59)

Note that, in fact, as any non deterministic automaton can be modeled in the CNT framework, any non deterministic Turing machine can be modeled too. For that, it suffices to replace the transition function by a transition relation. If we want to limit ourselves to decidable problems, it is necessary to add to the generic CNT framework assumptions about the nature of the domains of the attribute variables (discrete or continuous, finite or infinite), about the domains of the dimension variables (finite or infinite), about the nature of the constraints, or about the constraint hyper-graph.15 For example, if we make the assumption of finite domains for all the variables (dimension and attribute variables), we get a decidable NP-complete problem, because any CNT can be represented as a CSP in such a context16 and because we already saw that any CSP can be represented as a degenerate CNT. Such a property has been already exploited by bounded planning Kautz and Selman (1992), van Beek and Chen (1999) and bounded model checking Clarke et al. (2001). Note that it is not necessary that the dimension variables be fixed. It suffices that their domains be finite. If we make further assumptions about the number of variables, the domain sizes, or the structure of the constraint hyper-graph, such as for example its induced width Dechter (1999),17 we can get polynomial problems. Between both these extrema (undecidable problems and decidable polynomial problems), there is a landscape that would be worth revisiting, using existing results about decidability and complexity in the context of automata, Petri nets, planning, and constraint satisfaction.

15

The constraint hyper-graph associated with a CSP associates a vertex with each variable and a hyper-edge with each constraint, linking all the vertices associated with the variables in the constraint scope.

16

To be precise, we must assume that a constraint checking (to check whether or not an assignment of the variables in the scope of a constraint c satisfies c) takes in the worst case a time which is a polynomial function of the number of involved variables: a usual assumption in the CSP framework.

17

Also referred to as tree width.

Algorithmic issues



About algorithms we are currently working on, we can exploit all the background existing in the context of automata, Petri nets, planning, scheduling, and generic search, but especially in the domain of constraint satisfaction Dechter (2003), Rossi et al (2006) and dynamic constraint satisfaction Sabin et al. (2003), Gelle and Faltings (2003). The key point lies in the special role of the dimension variables, because any increase in the lower bound on the domain of a dimension variable, due to either propagation or assignment decision, induces new mandatory attribute variables and new associated constraints. As a consequence, giving priority to the dimension variables in a variable ordering heuristic in the context of a tree search may be a good idea that should be evaluated via experiments. Note however that algorithmic choices are not limited to tree search. Other kinds of search such as greedy search, local search, or dynamic programming can be also considered. Possible extensions The proposed CNT framework could be extended along several directions. Firstly, it would be possible to go from pure satisfaction problems, as the ones presented in this article, to problems that combine satisfaction and optimization. To do that, it is possible to use the work done on the valued CSP framework Schiex et al (1995) (sometimes referred to as weighted CSP). Whereas a classical CSP constraint c is a function from v∈sco(c) do(v) to B, a valued constraint is a func tion from v∈sco(c) do(v) to a totally ordered valuation set E, whose minimal element ⊥ represents total satisfaction, maximal element  represents total dissatisfaction, and any element between ⊥ and  represents partial dissatisfaction. Local dissatisfaction degrees can be combined into a global dissatisfaction degree using an aggregation operator ⊕ which must only satisfy some algebraic properties such as commutativity, associativity, or monotonicity. This operator may be for example + or min, depending on the interpretation of dissatisfaction degrees: costs or priorities. The usual request consists in producing a complete assignment whose global dissatisfaction degree is the smallest. It is easy to show that all the CNT framework presented in this article can be reformulated by simply replacing classical hard constraints by valued ones. Secondly, we can observe that the proposed CNT framework allows us to express non determinism (several possible transitions from a state following an event), but does not allow us to be more precise by associating for example probability degrees to the various possible transitions, as it is done in Markov decision problems Puterman (1994) and in probabilistic planning Kushmerick et al. (1995). To do that in the

123

J Intell Manuf

most general way, it would be possible to use the work done on the PFU framework Pralet et al. (2007) which aims at modeling and solving sequential decision-making problems involving plausibilities, feasibilities, and utilities. In the PFU framework, environment variables are distinguished from decision variables and three kinds of local functions can be expressed on these variables: plausibility functions to express uncertainties on environment variables, feasibility functions to express hard constraints on decision variables, and utility functions to express preferences on environment or decision variables. As in the valued CSP framework, local functions can be combined into global ones using aggregation operators which satisfy some algebraic properties. However, at this moment, a PFU version of the CNT framework remains to be defined. Thirdly, we can think to go beyond the assumption of a stepwise evolution of the value of a state attribute, to consider for example linear evolutions or other ones, as in Trinquart and Ghallab (2001), Penberthy and Weld (1994). To do that, we could assume that the value of any state attribute between two steps be a function of time and of the values of the various attributes at the first step, with some sensible assumptions about this function.

Conclusion As a conclusion, the CNT framework proposed in this article offers a unified view of classical frameworks dedicated to the modeling of discrete event dynamic systems. It proposes a unified constraint-based way of modeling such systems as dynamic CSPs. The request associated to the CNT framework (to determine whether a given CNT is consistent or not and to produce a consistent assignment in case of a positive answer) can be used to deal with various tasks: planning, scheduling, diagnosis, or validation. The CNT framework can be now used as a basis for the development of unified algorithmic tools which could bring together the best reasoning and search techniques coming from the domain of automata, Petri nets, planning, scheduling, or constraint satisfaction. Acknowledgements This work has been done thanks to the CNESONERA-LAAS AGATA project (Autonomy Generic Architecture: Tests and Applications; see http://www.agata.fr), whose aim is to develop technical tools allowing space system autonomy to be improved. It took advantage of the feedback from many people involved in the project, we would like to thank.

References Alur, R., & Dill, D. (1994). A theory of timed automata. Journal of Theoretical Computer Science, 126(2), 183–235.

123

Arnold, A., & Nivat, M. (1982). Comportements de processus. In Actes du Colloque AFCET “Les MathTmatiques de l’Informatique” (pp. 35–68). Paris. Baptiste, P., Pape, C. L., & Nuijten, W. (2001). Constraint-based scheduling: Applying constraint programming to scheduling problems. Kluwer Academic Publishers. Barták, R. (1999). Dynamic constraint models for complex production environments. In Proceedings of the Joint ERCIM/Compulog-Net Workshop. Cyprus. Benveniste, A., Caspi, P., Edwards, S., Halbwachs, N., & Guernic, P. L., de Simone, R. (2003). The synchronous languages twelve years later. Proceedings of the IEEE, 91(1), 64–83. Clarke, E., Biere, A., Raimi, R., & Zhu, Y. (2001). Bounded model checking using satisfiability solving. Formal Methods in System Design, 19(1), 7–34. Dechter, R. (1999). Bucket elimination: a unifying framework for reasoning. Artificial Intelligence, 113, 41–85. Dechter, R. (2003). Constraint Processing. Morgan Kaufmann. Dechter, R., & Dechter, A. (1988). Belief maintenance in dynamic constraint networks. In Proceedings of the 7th National Conference on Artificial Intelligence (AAAI-88) (pp. 37–42). St. Paul, MN, USA. Dechter, R., Meiry, I., & Pearl, J. (1991). Temporal constraint networks. Artificial Intelligence, 49, 61–95. Fikes, R., & Nilsson, N. (1971). STRIPS: a new approach to the application of theorem proving. Artificial Intelligence, 2, 189–208. Fox, M., & Long, D. (2003). PDDL2.1 : An extension to PDDL for expressing temporal planning domains. Journal of Artificial Intelligence Research, 20, 61–124. Frank, J., & Jónsson, A. (2003). Constraint-based attribute and interval planning. Constraints, 8(4), 339–364. Gelle, E., & Faltings, B. (2003). Solving mixed and conditional constraint satisfaction problems. Constraints, 8(2), 107–141. Ghallab, M. (1996). On chronicles: representation, on-line recognition and learning. In Proceedings of the 5th International Conference on the Principles of Knowledge Representation and Reasoning (KR-96) (pp. 597–606). Boston, MA, USA. Ghallab, M., Nau, D., & Traverso, P. (2004). Automated Planning: Theory and Practice. Morgan Kaufmann. Hickmott, S., Rintanen, J., ThiTbaux, S., & White, L. (2007). Planning via petri net unfolding. In Proceedings of the 20th International Joint Conference on Artificial Intelligence (IJCAI-07) (pp. 1904–1911). Hyderabad, India. Kautz, H., & Selman, B. (1992). Planning as satisfiability. In Proceedings of the 10th European Conference on Artificial Intelligence (ECAI-92) (pp. 359–363). Vienna, Austria. Kowalski, R., & Sergot, M. (1986). A Logic-based calculus of events. New Generation Computing, 4, 67–95. Kushmerick, N., Hanks, S., & Weld, D. (1995). An algorithm for probabilistic planning. Artificial Intelligence, 76, 239–286. Laborie, P., Ghallab, M. (1995). IxTeT: an integrated approach for plan generation and scheduling. In Proceedings of the 4th INRIA/IEEE Symposium on Emerging Technologies and Factory Automation (ETFA-95) (pp. 485–495). Paris, France. Levesque, H., Reiter, R., Lesperance, Y., Lin, F., & Scherl, R. (1997). GOLOG: a logic programming language for dynamic domains. Journal of Logic Programming, 31(1–3), 59–83. McDermott, D. (1998). PDDL—the planning domain definition language. Miguel, I., Shen, Q., & Jarvis, P. (2001). Efficient flexible planning via dynamic flexible constraint satisfaction. Engineering Applications of Artificial Intelligence, 14(3), 301–327. Mittal, S., Falkenhainer, B. (1990). Dynamic constraint satisfaction problems. In Proceedings of the 8th National Conference on Artificial Intelligence (AAAI-90) (pp. 25–32). Boston, MA, USA.

J Intell Manuf Muscettola, N. (1994). HSTS: integrating planning and scheduling. In M. Zweden, & M. Fox (Eds.), Intelligent Scheduling (pp. 169–212). Morgan Kaufmann. Muscettola, N., Nayak, P., Pell, B., & Williams, B. (1998). Remote agent: to boldly go where no AI system has gone before. Artificial Intelligence, 103(1–2), 5–48. Nareyek, A. (2001). Constraints-based agents—an architecture for constraint-based modeling and local-search-based reasoning for planning and scheduling in open and dynamic worlds. Springer. Nareyek, A., Freuder, E., Fourer, R., Giunchiglia, E., Goldman, R., Kautz, H., Rintanen, J., & Tate, A. (2005). Constraints and AI Planning. IEEE Intelligent Systems. Penberthy, J., & Weld, D. (1994). Temporal planning with continuous change. In Proceedings of the 12th National Conference on Artificial Intelligence (AAAI-94) (pp. 1010–1015). Seattle, WA, USA. Pnueli, A. (1977). The temporal logic of programs. In Proceedings of the 18th IEEE Symposium on the Foundations of Computer Science (FOCS-77) (pp. 46–57). Providence, RI, USA. Pralet, C., Verfaillie, G., & Schiex, T. (2007). An algebraic graphical model for decision with uncertainties, feasibilities, and utilities. Journal of Artificial Intelligence Research, 29, 421–489. Puterman, M. (1994). Markov Decision Processes, Discrete Stochastic Dynamic Programming. Wiley.

Rossi, R., Beek, P. V., & Walsh, T. (Eds.). (2006). Handbook of Constraint Programming. Elsevier. Sabin, M., Freuder, E., Wallace, R. (2003). Greater efficiency for conditional constraint satisfaction. In Proceedings of the 9th International Conference on Principles and Practice of Constraint Programming (CP-03) (pp. 649–663). Cork, Ireland. Schiex, T., Fargier, H., Verfaillie, G. (1995). Valued constraint satisfaction problems: Hard and easy problems. In Proceedings of the 14th International Joint Conference on Artificial Intelligence (IJCAI-95) (pp. 631–637). Montréal, Canada. Trinquart, R., & Ghallab, M. (2001). An extended functional representation in temporal plannning: towards continuous change. In Proceedings of the 6th European Conference on Planning (ECP-01). Toledo, Spain. van Beek, P., & Chen, X. (1999). CPlan: A constraint programming approach to planning. In Proceedings of the 16th National Conference on Artificial Intelligence (AAAI-99) (pp 585–590). Orlando, FL, USA. Verfaillie, G., & Jussien, N. (2005). Constraint solving in uncertain and dynamic environments: A survey. Constraints, 10(3), 253–281.

123

Constraint-based modeling of discrete event dynamic systems

tracking, or decision tasks: automata, Petri nets, Markov ... tracking problems, such as failure diagnosis. .... constrained project scheduling, temporal constraint.

480KB Sizes 1 Downloads 194 Views

Recommend Documents

Control of input/output discrete-event systems
(2) rigorous solution of the control problem We show that despite ... can be treated using Rabin- or parity-games [14]. ..... of finite length is a regular language.

Decentralized Diagnosis of Discrete Event Systems ...
Electrical Engineering and Computer Science, The University of. Michigan, 1301 Beal Avenue, Ann Arbor, MI 48109–2122, U.S.A.,. {yinw,stephane}@eecs.umich.edu. T. Yoo is with Idaho National Laboratory, Idaho Falls, ID 83403-2528,. U.S.A., YOOTS@inel

New Results on Decentralized Diagnosis of Discrete Event Systems
nostic protocols become necessary to deal with fault diagnosis in distributed systems where the information is decentralized [1,8]. In decentralized architectures ...