# Uncertainty in Soft Temporal Constraint Problems:A General Framework and Controllability Algorithms forThe Fuzzy Case

In real-life temporal scenarios, uncertainty and preferences are often essential and coexisting aspects. We present a formalism where quantitative temporal constraints with both preferences and uncertainty can be defined. We show how three classical notions of controllability (that is, strong, weak, and dynamic), which have been developed for uncertain temporal problems, can be generalized to handle preferences as well. After defining this general framework, we focus on problems where preferences follow the fuzzy approach, and with properties that assure tractability. For such problems, we propose algorithms to check the presence of the controllability properties. In particular, we show that in such a setting dealing simultaneously with preferences and uncertainty does not increase the complexity of controllability testing. We also develop a dynamic execution algorithm, of polynomial complexity, that produces temporal plans under uncertainty that are optimal with respect to fuzzy preferences.

## Authors

• 2 publications
• 1 publication
• 1 publication
• ### Logical Fuzzy Preferences

We present a unified logical framework for representing and reasoning ab...

• ### Elicitation strategies for fuzzy constraint problems with missing preferences: algorithms and experimental studies

Fuzzy constraints are a popular approach to handle preferences and over-...
09/24/2009 ∙ by Mirco Gelain, et al. ∙ 0

• ### DATELINE: Deep Plackett-Luce Model with Uncertainty Measurements

The aggregation of k-ary preferences is a historical and important probl...
12/14/2018 ∙ by Bo Han, et al. ∙ 0

• ### Complexity Bounds for the Controllability of Temporal Networks with Conditions, Disjunctions, and Uncertainty

In temporal planning, many different temporal network formalisms are use...
01/08/2019 ∙ by Nikhil Bhargava, et al. ∙ 0

• ### Soft robust solutions to possibilistic optimization problems

This paper discusses a class of uncertain optimization problems, in whic...
12/03/2019 ∙ by Adam Kasperski, et al. ∙ 0

• ### Residuation for Soft Constraints: Lexicographic Orders and Approximation Techniques

Residuation theory concerns the study of partially ordered algebraic str...
03/11/2021 ∙ by Fabio Gadducci, et al. ∙ 0

• ### An Extensible and Personalizable Multi-Modal Trip Planner

Despite a tremendous amount of work in the literature and in the commerc...
09/25/2019 ∙ by Xudong Liu, et al. ∙ 0

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## 1 Introduction

Current research on temporal constraint reasoning, once exposed to the difficulties of real-life problems, can be found lacking both expressiveness and flexibility. In rich application domains it is often necessary to simultaneously handle not only temporal constraints, but also preferences and uncertainty.

This need can be seen in many scheduling domains. The motivation for the line of research described in this paper is the domain of planning and scheduling for NASA space missions. NASA has tackled many scheduling problems in which temporal constraints have been used with reasonable success, while showing their limitations in their lack of capability to deal with uncertainty and preferences. For example, the Remote Agent [Rajan, Bernard, Dorais, Gamble, Kanefsky, Kurien, Millar, Muscettola, Nayak, Rouquette, Smith, Taylor,  TungRajan et al.2000, Muscettola, Morris, Pell,  SmithMuscettola et al.1998] experiments, which consisted of placing an AI system on-board to plan and execute spacecraft activities, represents one of the most interesting examples of this. Remote Agent worked with high level goals which specified, for example, the duration and frequency of time windows within which the spacecraft had to take asteroid images to be used for orbit determination for the on-board navigator. Remote Agent dealt with both flexible time intervals and uncontrollable events; however, it did not deal with preferences: all the temporal constraints are hard. The benefit of adding preferences to this framework would be to allow the planner to handle uncontrollable events while at the same time maximizing the mission manager’s preferences.

A more recent NASA application is in the rovers domain [Dearden, Meuleau, Ramakrishnan, Smith,  WashingtonDearden et al.2002, Bresina, Jonsson, Morris,  RajanBresina et al.2005]. NASA is interested in the generation of optimal plans for rovers designed to explore a planetary surface (e.g. Spirit and Opportunity for Mars) [Bresina, Jonsson, Morris,  RajanBresina et al.2005]. Dearden et al. (2002) describe the problem of generating plans for planetary rovers that handle uncertainty over time and resources. The approach involves first constructing a “seed” plan, and then incrementally adding contingent branches to this plan in order to improve its utility. Again, preferences could be used to embed utilities directly in the temporal model.

A third space application, which will be used several times in this paper as a running example, concerns planning for fleets of Earth Observing Satellites (EOS) [Frank, Jonsson, Morris,  SmithFrank et al.2001]. This planning problem involves multiple satellites, hundreds of requests, constraints on when and how to serve each request, and resources such as instruments, recording devices, transmitters and ground stations. In response to requests placed by scientists, image data is acquired by an EOS. The data can be either downlinked in real time or recorded on board for playback at a later time. Ground stations or other satellites are available to receive downlinked images. Different satellites may be able to communicate only with a subset of these resources, and transmission rates will differ from satellite to satellite and from station to station. Further, there may be different financial costs associated with using different communication resources. In [Frank, Jonsson, Morris,  SmithFrank et al.2001] the EOS scheduling problem is dealt with by using a constraint-based interval representation. Candidate plans are represented by variables and constraints, which reflect the temporal relationship between actions and the constraints on the parameters of states or actions. Also, temporal constraints are necessary to model duration and ordering constraints associated with the data collection, recording, and downlinking tasks. Solutions are preferred based on objectives (such as maximizing the number of high priority requests served, maximizing the expected quality of the observations, and minimizing the cost of downlink operations). Uncertainty is present due to weather: specifically due to duration and persistence of cloud cover, since image quality is obviously affected by the amount of clouds over the target. In addition, some of the events that need to be observed may happen at unpredictable times and have uncertain durations (e.g. fires or volcanic eruptions).

Some existing frameworks, such as Simple Temporal Problems with Preferences (STPPs) [Khatib, Morris, Morris,  RossiKhatib et al.2001], address the lack of expressiveness of hard temporal constraints by adding preferences to the temporal framework, but do not take into account uncertainty. Other models, such as Simple Temporal Problems with Uncertainty (STPUs) [Vidal  FargierVidal  Fargier1999], account for contingent events, but have no notion of preferences. In this paper we introduce a framework which allows us to handle both preferences and uncertainty in Simple Temporal Problems. The proposed model, called Simple Temporal Problems with Preferences and Uncertainty (STPPUs), merges the two pre-existing models of STPPs and STPUs.

An STPPU instance represents a quantitative temporal problem with preferences and uncertainty via a set of variables, representing the starting or ending times of events (which can be controllable by the agent or not), and a set of soft temporal constraints over such variables, each of which includes an interval containing the allowed durations of the event or the allowed times between events. A preference function associating each element of the interval with a value specifies how much that value is preferred. Such soft constraints can be defined on both controllable and uncontrollable events. In order to further clarify what is modeled by an STPPU, let us emphasize that graduality is only allowed in terms of preferences and not of uncertainty. In this sense, the uncertainty represented by contingent STPPU constraints is the same as that of contingent STPU constraints: all durations are assumed to be equally possible. In addition to expressing uncertainty, in STPPUs, contingent constraints can be soft and different preference levels can be associated to different durations of contingent events.

On these problems, we consider notions of controllability similar to those defined for STPUs, to be used instead of consistency because of the presence of uncertainty, and we adapt them to handle preferences. These notions, usually called strong, weak, and dynamic controllability, refer to the possibility of “controlling” the problem, that is, of the executing agent assigning values to the controllable variables, in a way that is optimal with respect to what Nature has decided, or will decide, for the uncontrollable variables. The word optimal here is crucial, since in STPUs, where there are no preferences, we just need to care about controllability, and not optimality. In fact, the notions we define in this paper that directly correspond to those for STPUs are called strong, weak, and dynamic optimal controllability.

After defining these controllability notions and proving their properties, we then consider the same restrictions which have been shown to make temporal problems with preferences tractable [Khatib, Morris, Morris,  RossiKhatib et al.2001, Rossi, Sperduti, Venable, Khatib, Morris,  MorrisRossi et al.2002], i.e, semi-convex preference functions and totally ordered preferences combined with an idempotent operator. In this context, for each of the above controllability notions, we give algorithms that check whether they hold, and we show that adding preferences does not make the complexity of testing such properties worse than in the case without preferences. Moreover, dealing with different levels of preferences, we also define testing algorithms which refer to the possibility of controlling a problem while maintaining a preference of at least a certain level (called -controllability). Finally, in the context of dynamic controllability, we also consider the execution of dynamic optimal plans.

Parts of the content of this paper have appeared in [Venable  Yorke-SmithVenable  Yorke-Smith2003, Rossi, Venable,  Yorke-SmithRossi et al.2003, Yorke-Smith, Venable,  RossiYorke-Smith et al.2003, Rossi, Venable,  Yorke-SmithRossi et al.2004]. This paper extends the previous work in at least two directions. First, while in those papers optimal and controllability (strong or dynamic) were checked separately, now we can check optimal (strong or dynamic) controllability and, if it does not hold, the algorithm will return the highest such that the given problem is -strong or -dynamic controllable. Moreover, results are presented in a uniform technical environment, by providing a thorough theoretical study of the properties of the algorithms and their computational aspects, which makes use of several unpublished proofs.

This paper is structured as follows. In Section 2 we give the background on temporal constraints with preference and with uncertainty. In Section 3 we define our formalism for Simple Temporal Problems with both preferences and uncertainty and, in Section 4, we describe our new notions of controllability. Algorithms to test such notions are described respectively in Section 5 for Optimal Strong Controllability, in Section 6 for Optimal Weak Controllability, and in Section 7 for Optimal Dynamic Controllability. In Section 8 we then give a general strategy for using such notions. Finally, in Section 9, we discuss related work, and in Section 10 we summarize the main results and we point out some directions for future developments. To make the paper more readable, the proofs of all theorems are contained in the Appendix.

## 2 Background

In this section we give the main notions of temporal constraints [Dechter, Meiri,  PearlDechter et al.1991] and the framework of Temporal Constraint Satisfaction Problems with Preferences (TCSPPs) [Khatib, Morris, Morris,  RossiKhatib et al.2001, Rossi, Sperduti, Venable, Khatib, Morris,  MorrisRossi et al.2002], which extend quantitative temporal constraints [Dechter, Meiri,  PearlDechter et al.1991] with semiring-based preferences [Bistarelli, Montanari,  RossiBistarelli et al.1997]. We also describe Simple Temporal Problems with Uncertainty (STPUs) [Vidal  FargierVidal  Fargier1999, Morris, Muscettola,  VidalMorris et al.2001], which extend a tractable subclass of temporal constraints to model agent-uncontrollable contingent events, and we define the corresponding notions of controllability, introduced in [Vidal  FargierVidal  Fargier1999].

### 2.1 Temporal Constraint Satisfaction Problems

One of the requirements of a temporal reasoning system for planning and scheduling problems is an ability to deal with metric information; in other words, to handle quantitative information on duration of events (such as “It will take from ten to twenty minutes to get home”). Quantitative temporal networks provide a convenient formalism to deal with such information. They consider instantaneous events as the variables of the problem, whose domains are the entire timeline. A variable may represent either the beginning or an ending point of an event, or a neutral point of time. An effective representation of quantitative temporal networks, based on constraints, is within the framework of Temporal Constraint Satisfaction Problems (TCSPs) [Dechter, Meiri,  PearlDechter et al.1991].

In this paper we are interested in a particular subclass of TCSPs, known as Simple Temporal Problems (STPs) [Dechter, Meiri,  PearlDechter et al.1991]. In such a problem, a constraint between time-points and is represented in the constraint graph as an edge , labeled by a single interval that represents the constraint . Solving an STP means finding an assignment of values to variables such that all temporal constraints are satisfied.

Whereas the complexity of a general TCSP comes from having more than one interval in a constraint, STPs can be solved in polynomial time. Despite the restriction to a single interval per constraint, STPs have been shown to be valuable in many practical applications. This is why STPs have attracted attention in the literature.

An STP can be associated with a directed weighted graph , called the distance graph. It has the same set of nodes as the constraint graph but twice the number of edges: for each binary constraint over variables and , the distance graph has an edge which is labeled by weight , representing the linear inequality , as well as an edge which is labeled by weight , representing the linear inequality .

Each path from to in the distance graph , say through variables induces the following path constraint: . The intersection of all induced path constraints yields the inequality , where is the length of the shortest path from to , if such a length is defined, i.e. if there are no negative cycles in the distance graph. An STP is consistent if and only if its distance graph has no negative cycles [ShostakShostak1981, Leiserson  SaxeLeiserson  Saxe1988]. This means that enforcing path consistency, by an algorithm such as PC-2, is sufficient for solving STPs [Dechter, Meiri,  PearlDechter et al.1991]. It follows that a given STP can be effectively specified by another complete directed graph, called a -graph, where each edge is labeled by the shortest path length in the distance graph .

In [Dechter, Meiri,  PearlDechter et al.1991] it is shown that any consistent STP is backtrack-free (that is, decomposable) relative to the constraints in its -graph. Moreover, the set of temporal constraints of the form is the minimal STP corresponding to the original STP and it is possible to find one of its solutions using a backtrack-free search that simply assigns to each variable any value that satisfies the minimal network constraints compatibly with previous assignments. Two specific solutions (usually called the latest and the earliest assignments) are given by and , which assign to each variable respectively its latest and earliest possible time [Dechter, Meiri,  PearlDechter et al.1991].

The -graph (and thus the minimal network) of an STP can be found by applying Floyd-Warshall’s All Pairs Shortest Path algorithm [FloydFloyd1962] to the distance graph with a complexity of where is the number of variables. If the graph is sparse, the Bellman-Ford Single Source Shortest Path algorithm can be used instead, with a complexity equal to , where is the number of edges. We refer to [Dechter, Meiri,  PearlDechter et al.1991, Xu  ChoueiryXu  Choueiry2003] for more details on efficient STP solving.

### 2.2 Temporal CSPs with Preferences

Although expressive, TCSPs model only hard temporal constraints. This means that all constraints have to be satisfied, and that the solutions of a constraint are all equally satisfying. However, in many real-life situations some solutions are preferred over others and, thus, the global problem is to find a way to satisfy the constraints optimally, according to the preferences specified.

To address this need, the TCSP framework has been generalized in [Khatib, Morris, Morris,  RossiKhatib et al.2001] to associate each temporal constraint with a preference function which specifies the preference for each distance allowed by the constraint. This framework merges TCSPs and semiring-based soft constraints [Bistarelli, Montanari,  RossiBistarelli et al.1997].

###### Definition 1 (soft temporal constraint)

A soft temporal constraint is a 4-tuple consisting of

• a set of two variables over the integers, called the scope of the constraint;

• a set of disjoint intervals , where , and for all ;

• a set of preferences ;

• a preference function , which is a mapping of the elements of into preference values, taken from the set .

Given an assignment of the variables and , and , we say that this assignment satisfies the constraint iff there exists such that . In such a case, the preference associated with the assignment by the constraint is .

When the variables and the preference set of an STPP are apparent, we will omit them and write a soft temporal constraint just as a pair .

Following the soft constraint approach [Bistarelli, Montanari,  RossiBistarelli et al.1997], the preference set is the carrier of an algebraic structure known as a c-semiring. Informally a c-semiring is a set equipped with two operators satisfying some proscribed properties [<]for details, see¿jacm). The additive operator is used to induce the ordering on the preference set ; given two elements , iff . The multiplicative operator is used to combine preferences.

###### Definition 2 (Tcspp)

Given a semiring , a Temporal Constraint Satisfaction Problems with Preferences (TCSPP) over is a pair , where is a set of variables and is a set of soft temporal constraint over pairs of variables in and with preferences in .

###### Definition 3 (solution)

Given a TCSPP over a semiring , a solution is a complete assignment of the variables in . A solution is said to satisfy a constraint in with preference if the projection of over the pair of variables of ’s scope satisfies with preference . We will write .

Each solution has a global preference value, obtained by combining, via the operator, the preference levels at which the solution satisfies the constraints in .

###### Definition 4 (preference of a solution)

Given a TCSPP over a semiring , the preference of a solution , denoted , is computed by .

The optimal solutions of a TCSPP are those solutions which have the best global preference value, where “best” is determined by the ordering of the values in the semiring.

###### Definition 5 (optimal solutions)

Given a TCSPP over the semiring , a solution of is optimal if for every other solution of , .

Choosing a specific semiring means selecting a class of preferences. For example, the semiring

 SFCSP=⟨[0,1],max,min,0,1⟩

allows one to model the so-called fuzzy preferences [RuttkayRuttkay1994, SchiexSchiex1992], which associate to each element allowed by a constraint a preference between and (with being the worst and being the best preferences), and gives to each complete assignment the minimal among all preferences selected in the constraints. The optimal solutions are then those solutions with the maximal preference. Another example is the semiring , which allows one to model classical TCSPs, without preferences, in the more general TCSPP framework.

In this paper we will refer to fuzzy temporal constraints. However, the absence of preferences in some temporal constraints can always be modelled using just the two elements and in such constraints. Thus preferences can always coexists with hard constraints.

A special case occurs when each constraint of a TCSPP contains a single interval. In analogy to what is done in the case without preferences, such problems are called Simple Temporal Problems with Preferences (STPPs). This class of temporal problems is interesting because, as noted above, STPs are polynomially solvable while general TCSPs are NP-hard, and the computational effect of adding preferences to STPs is not immediately obvious.

###### Example 1

Consider the EOS example given in Section 1. In Figure 1 we show an STPP that models the scenario in which there are three events to be scheduled on a satellite: the start time () and ending time () of a slewing procedure and the starting time (

) of an image retrieval. The slewing activity in this example can take from

to units of time, ideally between to units of time, and the shortest time possible otherwise. The image taking can start any time between and units of time after the slewing has been initiated. The third constraint, on variables and , models the fact that it is better for the image taking to start as soon as the slewing has stopped.

In the following example, instead, we consider an STPP which uses the set-based semiring: . Notice that, as in the fuzzy semiring, the multiplicative operator, i.e., intersection, is idempotent, while the order induced by the additive operator, i.e., union, is partial.

###### Example 2

Consider a scenario where three friends, Alice, Bob, and Carol, want to meet for a drink and then for dinner and must decide at what time to meet and where to reserve dinner depending on how long it takes to get to the restaurant. The variables involved in the problem are: the global start time , with only the value in its domain, the start time of the drink (), the time to leave for dinner (), and the time of arrival at the restaurant (). They can meet, for the drink, between 8 and 9:00pm and they will leave for dinner after half an hour. Moreover, depending on the restaurant they choose, it will take from 20 to 40 minutes to get to dinner. Alice prefers to meet early and have dinner early, like Carol. Bob prefers to meet at 8:30 and to go to the best restaurant which is the farthest. Thus, we have the following two soft temporal constraints. The first constraint is defined on the variable pair , the interval is [8:00,9:00] and the preference function, , is such that, , and . The second constraint is a binary constraint on pair (,), with interval and preference function , such that, and and . There is an additional “hard” constraint on the variable pair , which can be modeled by the interval and a single preference equal to . The optimal solution is , with preference .

Although both TCSPPs and STPPs are NP-hard, in [Khatib, Morris, Morris,  RossiKhatib et al.2001] a tractable subclass of STPPs is described. The tractability assumptions are: the semi-convexity of preference functions, the idempotence of the combination operator of the semiring, and a totally ordered preference set. A preference function of a soft temporal constraint is semi-convex iff for all , the set forms an interval. Notice that semi-convex functions include linear, convex, and also some step functions. The only aggregation operator on a totally ordered set that is idempotent is [Dubois  PradeDubois  Prade1985], i.e. the combination operator of the semiring.

If such tractability assumptions are met, STPPs can be solved in polynomial time. In [Rossi, Sperduti, Venable, Khatib, Morris,  MorrisRossi et al.2002] two polynomial solvers for this tractable subclass of STPPs are proposed. One solver is based on the extension of path consistency to TCSPPs. The second solver decomposes the problem into solving a set of hard STPs.

### 2.3 Simple Temporal Problems with Uncertainty

When reasoning concerns activities that an agent performs interacting with an external world, uncertainty is often unavoidable. TCSPs assume that all activities have durations under the control of the agent. Simple Temporal Problems with Uncertainty (STPUs) [Vidal  FargierVidal  Fargier1999] extend STPs by distinguishing contingent events, whose occurrence is controlled by exogenous factors often referred to as “Nature”.

As in STPs, activity durations in STPUs are modelled by intervals. The start times of all activities are assumed to be controlled by the agent (this brings no loss of generality). The end times, however, fall into two classes: requirement [<]“free” in¿vid:stnu and contingent. The former, as in STPs, are decided by the agent, but the agent has no control over the latter: it only can observe their occurrence after the event; observation is supposed to be known immediately after the event. The only information known prior to observation of a time-point is that nature will respect the interval on the duration. Durations of contingent links are assumed to be independent.

In an STPU, the variables are thus divided into two sets depending on the type of time-points they represent.

###### Definition 6 (variables)

The variables of an STPU are divided into:

• executable time-points: are those points, , whose time is assigned by the executing agent;

• contingent time-points: are those points, , whose time is assigned by the external world.

The distinction on variables leads to constraints which are also divided into two sets, requirement and contingent, depending on the type of variables they constrain. Note that as in STPs all the constraints are binary. Formally:

###### Definition 7

The constraints of an STPU are divided into:

• a requirement constraint (or link) , on generic time-points and 111In general and can be either contingent or executable time-points., is an interval such that where is a value assigned to variable

• a contingent link , on executable point and contingent point , is an interval which contains all the possible durations of the contingent event represented by and .

The formal definition of an STPU is the following:

###### Definition 8 (Stpu)

A Simple Temporal Problem with Uncertainty (STPU) is a 4-tuple such that:

• : is the set of executable time-points;

• : is the set of contingent time-points;

• : is the set of requirement constraints;

• : is the set of contingent constraints.

###### Example 3

This is an example taken from [Vidal  FargierVidal  Fargier1999], which describes a scenario which can be modeled using an STPU. Consider two activities Cooking and Having dinner. Assume you don’t want to eat your dinner cold. Also, assume you can control when you start cooking and when the dinner starts but not when you finish cooking or when the dinner will be over. The STPU modeling this example is depicted in Figure 2. There are two executable time-points {Start-cooking, Start-dinner} and two contingent time-points {End-cooking, End-dinner}. Moreover, the contingent constraint on variables {Start-cooking, End-cooking} models the uncontrollable duration of fixing dinner which can take anywhere from 20 to 40 minutes; the contingent constraint on variables {Start-dinner, End-dinner} models the uncontrollable duration of the dinner that can last from 30 to 60 minutes. Finally, there is a requirement constraint on variables {End-cooking, Start-dinner} that simply bounds to 10 minutes the time between when the food is ready and when the dinner starts.

Assignments to executable variables and assignments to contingent variables are distinguished:

###### Definition 9 (control sequence)

A control sequence is an assignment to executable time-points. It is said to be partial if it assigns values to a proper subset of the executables, otherwise complete.

###### Definition 10 (situation)

A situation is a set of durations on contingent constraints. If not all the contingent constraints are assigned a duration it is said to be partial, otherwise complete.

###### Definition 11 (schedule)

A schedule is a complete assignment to all the time-points in and . A schedule identifies a control sequence, , consisting of all the assignments to the executable time-points, and a situation, , which is the set of all the durations identified by the assignments in on the contingent constraints. denotes the set of all schedules of an STPU.

It is easy to see that to each situation corresponds an STP. In fact, once the durations of the contingent constraints are fixed, there is no more uncertainty in the problem, which becomes an STP, called the underlying STP. This is formalized by the notion of projection.

###### Definition 12 (projection)

A projection , corresponding to a situation , is the STP obtained leaving all requirement constraints unchanged and replacing each contingent constraint with the constraint , where is the duration of event represented by in . is the set of all projections of an STPU .

### 2.4 Controllability

It is clear that in order to solve a problem with uncertainty all possible situations must be considered. The notion of consistency defined for STPs does not apply since it requires the existence of a single schedule, which is not sufficient in this case since all situations are equally possible.222

tsamar2 has augmented STPUs to include probability distributions over the possible situations; in this paper we implicitly assume a uniform, independent distribution on each link.

For this reason, in [Vidal  FargierVidal  Fargier1999], the notion of controllability has been introduced. Controllability of an STPU is, in some sense, the analogue of consistency of an STP. Controllable means the agent has a means to execute the time-points under its control, subject to all constraints. The notion of controllability is expressed, in terms of the ability of the agent to find, given a situation, an appropriate control sequence. This ability is identified with having a strategy:

###### Definition 13 (strategy)

A strategy is a map : , such that for every projection , is a schedule which induces the durations in on the contingent constraints. Further, a strategy is viable if, for every projection , is a solution of .

We will write to indicate the value assigned to executable time-point in schedule , and the history of in , that is, the set of durations of contingent constraints which occurred in before the execution of , i.e. the partial solution so far.

In [Vidal  FargierVidal  Fargier1999], three notions of controllability are introduced for STPUs.

#### 2.4.1 Strong Controllability

The first notion is, as the name suggests, the most restrictive in terms of the requirements that the control sequence must satisfy.

###### Definition 14 (Strong Controllability)

An STPU is Strongly Controllable (SC) iff there is an execution strategy s.t. , is a solution of , and , projections and for every executable time-point .

In words, an STPU is strongly controllable if there is a fixed execution strategy that works in all situations. This means that there is a fixed control sequence that will be consistent with any possible scenario of the world. Thus, the notion of strong controllability is related to that of conformant planning. It is clearly a very strong requirement. As vid:stnu suggest, SC may be relevant in some applications where the situation is not observable at all or where the complete control sequence must be known beforehand (for example in cases in which other activities depend on the control sequence, as in the production planning area).

In [Vidal  FargierVidal  Fargier1999] a polynomial time algorithm for checking if an STPU is strongly controllable is proposed. The main idea is to rewrite the STPU given in input as an equivalent STP only on the executable variables. What is important to notice, for the contents of this paper, is that algorithm StronglyControllable takes in input an STPU and returns in output an STP defined on variables . The STPU in input is strongly controllable iff the derived STP is consistent. Moreover, every solution of the STP is a control sequence which guarantees strong controllability for the STPU. When the STP is consistent, the output of StronglyControllable is its minimal form.

In [Vidal  FargierVidal  Fargier1999] it is shown that the complexity of StronglyControllable is , where is the number of variables.

#### 2.4.2 Weak Controllability

On the other hand, the notion of controllability with the fewest restrictions on the control sequences is Weak Controllability.

###### Definition 15 (Weak Controllability)

An STPU is said to be Weakly Controllable (WC) iff there is a strategy s.t.  is a solution of .

In words, an STPU is weakly controllable if there is a viable global execution strategy: there exists at least one schedule for every situation. This can be seen as a minimum requirement since, if this property does not hold, then there are some situations such that there is no way to execute the controllable events in a consistent way. It also looks attractive since, once an STPU is shown to WC, as soon as one knows the situation, one can pick out and apply the control sequence that matches that situation. Unfortunately in [Vidal  FargierVidal  Fargier1999] it is shown that this property is not so useful in classical planning. Nonetheless, WC may be relevant in specific applications (as large-scale warehouse scheduling) where the actual situation will be totally observable before (possibly just before) the execution starts, but one wants to know in advance that, whatever the situation, there will always be at least one feasible control sequence.

In [Vidal  FargierVidal  Fargier1999] it is conjectured and in [Morris  MuscettolaMorris  Muscettola1999] it is proven that the complexity of checking weak controllability is co-NP-hard. The algorithm proposed for testing WC in [Vidal  FargierVidal  Fargier1999] is based on a classical enumerative process and a lookahead technique.

Strong Controllability implies Weak Controllability [Vidal  FargierVidal  Fargier1999]. Moreover, an STPU can be seen as an STP if the uncertainty is ignored. If enforcing path consistency removes some elements from the contingent intervals, then these elements belong to no solution. If so, it is possible to conclude that the STPU is not weakly controllable.

###### Definition 16 (pseudo-controllability)

An STPU is pseudo-controllable if applying path consistency leaves the intervals on the contingent constraints unchanged.

Unfortunately, if path consistency leaves the contingent intervals untouched, we cannot conclude that the STPU is weakly controllable. That is, WC implies pseudo-controllability but the converse is false. In fact, weak controllability requires that given any possible combination of durations of all contingent constraints the STP corresponding to that projection must be consistent. Pseudo-controllability, instead, only guarantees that for each possible duration on a contingent constraint there is at least one projection that contains such a duration and it is a consistent STP.

#### 2.4.3 Dynamic Controllability

In dynamic applications domains, such as planning, the situation is observed over a time. Thus decisions have to be made even if the situation remains partially unknown. Indeed the distinction between Strong and Dynamic Controllability is equivalent to that between conformant and conditional planning. The final notion of controllability defined in [Vidal  FargierVidal  Fargier1999] address this case. Here we give the definition provided in [Morris, Muscettola,  VidalMorris et al.2001] which is equivalent but more compact.

###### Definition 17 (Dynamic Controllability)

An STPU is Dynamically Controllable (DC) iff there is a strategy such that in and for any executable time-point :

1. if then ;

2. is a solution of and is a solution of .

In words, an STPU is dynamically controllable if there exists a viable strategy that can be built, step-by-step, depending only the observed events at each step. SC DC and that DC WC. Dynamic Controllability, seen as the most useful controllability notion in practice, is also the one that requires the most complicated algorithm. Surprisingly, mor:stnu and dc-rev05 proved DC is polynomial in the size of the STPU representation. In Figure 3 the pseudocode of algorithm DynamicallyControllable is shown.

In this paper we will extend the notion of dynamic controllability in order to deal with preferences. The algorithm we will propose to test this extended property will require a good (even if not complete) understanding of the DynamicallyControllable algorithm. Thus, we will now give the necessary details on this algorithm.

As it can be seen, the algorithm is based on some considerations on triangles of constraints. The triangle shown in Figure 4 is a triangular STPU with one contingent constraint, AC, two executable time-points, A and B, and a contingent time-point C. Based on the sign of and , three different cases can occur:

• Follow case (): B will always follow C. If the STPU is path consistent then it is also DC since, given the time at which C occurs after A, by definition of path consistency, it is always possible to find a consistent value for B.

• Precede case (): B will always precede or happen simultaneously with C. Then the STPU is dynamically controllable if , and the interval on AB should be replaced by interval , that is by the sub-interval containing all the elements of that are consistent with each element of .

• Unordered case ( and ): B can either follow or precede C. To ensure dynamic controllability, B must wait either for C to occur first, or for units of time to go by after A. In other words, either C occurs and B can be executed at the first value consistent with C’s time, or B can safely be executed units of time after A’s execution. This can be described by an additional constraint which is expressed as a wait on AB and is written , where . Of course if then we can raise the lower bound of AB, , to (Unconditional Unordered Reduction), and in any case we can raise it to if (General Unordered reduction) .

It can be shown that waits can be propagated (in mor:stnu, 2001, the term “regressed”is used ) from one constraint to another: a wait on AB induces a wait on another constraint involving A, e.g. AD, depending on the type of constraint DB. In particular, there are two possible ways in which the waits can be regressed.

• Regression 1: assume that the AB constraint has a wait . Then, if there is any DB constraint (including AB itself) with an upper bound, , it is possible to deduce a wait on . Figure 5(a) shows this type of regression.

• Regression 2: assume that the AB constraint has a wait , where . Then, if there is a contingent constraint DB with a lower bound, , and such that , it is possible to deduce a wait on . Figure  5(b) shows this type of regression.

Assume for simplicity and without loss of generality that A is executed at time 0. Then, B can be executed before the wait only if C is executed first. After the wait expires, B can safely be executed at any time left in the interval. As Figure 6 shows, it is possible to consider the Follow and Precede cases as special cases of the Unordered. In the Follow case we can put a “dummy” wait after the end of the interval, meaning that B must wait for C to be executed in any case (Figure 6 (a)). In the Precede case, we can set a wait that expires at the first element of the interval meaning that B will be executed before C and any element in the interval will be consistent with C (Figure 6 (b)). The Unordered case can thus be seen as a combination of the two previous states. The part of the interval before the wait can be seen as a Follow case (in fact, B must wait for C until the wait expires), while the second part including and following the wait can be seen as a Precede case (after the wait has expired, B can be executed and any assignment to B that corresponds to an element of this part of interval AB will be consistent with any possible future value assigned to C).

The DynamicallyControllable algorithm applies these rules to all triangles in the STPU and regresses all possible waits. If no inconsistency is found, that is no requirement interval becomes empty and no contingent interval is squeezed, the STPU is DC and the algorithm returns an STPU where some constraints may have waits to satisfy, and the intervals contain elements that appear in at least one possible dynamic strategy. This STPU can then be given to an execution algorithm which dynamically assigns values to the executables according to the current situation.

The pseudocode of the execution algorithm, DC-Execute, is shown in Figure 7. The execution algorithm observes, as the time goes by, the occurrence of the contingent events and accordingly executes the controllables. For any controllable B, its execution is triggered if it is (1) live, that is, if current time is within its bounds, it is (2) enabled, that is, all the executables constrained to happen before have occurred, and (3) all the waits imposed by the contingent time-points on B have expired.

DC-Execute produces dynamically a consistent schedule on every STPU on which algorithm DynamicallyControllable reports success [Morris, Muscettola,  VidalMorris et al.2001]. The complexity of the algorithm is , where is the number of variables and is the number of elements in an interval. Since the polynomial complexity relies on the assumption of a bounded maximum interval size, mor:stnu conclude that DynamicallyControllable is pseudo-polynomial. A DC algorithm of “strong” polynomial complexity is presented in [Morris  MuscettolaMorris  Muscettola2005]. The new algorithm differs from the previous one mainly because it manipulates the distance graph rather than the constraint graph of the STPU. It’s complexity is . What is important to notice for our purposes is that, from the distance graph produced in output by the new algorithm, it is possible to directly recover the intervals and waits of the STPU produced in output by the original algorithm described in [Morris, Muscettola,  VidalMorris et al.2001].

## 3 Simple Temporal Problems with Preferences and Uncertainty (STPPUs)

Consider a temporal problem that we would model naturally with preferences in addition to hard constraints, but one also features uncertainty. Neither an STPP nor an STPU is adequate to model such a problem. Therefore we propose what we will call Simple Temporal Problems with Preferences and Uncertainty, or STPPUs for short.

Intuitively, an STPPU is an STPP for which time-points are partitioned into two classes, requirement and contingent, just as in an STPU. Since some time-points are not controllable by the agent, the notion of consistency of an STP(P) is replaced by that of controllability, just as in an STPU. Every solution to the STPPU has a global preference value, just as in an STPP, and we seek a solution which maximizes this value, while satisfying controllability requirements.

More precisely, we can extend some definitions given for STPPs and STPUs to fit STPPUs in the following way.

###### Definition 18

In a context with preferences:

• an executable time-point is a variable, , whose time is assigned by the agent;

• a contingent time-point is a variable, , whose time is assigned by the external world;

• a soft requirement link , on generic time-points and 333Again, in general and can be either contingent or executable time-points., is a pair , where such that where is a value assigned to variable , and is a preference function mapping each element of the interval into an element of the preference set, , of the semiring ;

• a soft contingent link , on executable point and contingent point , is a pair where interval contains all the possible durations of the contingent event represented by and and is a preference function that maps each element of the interval into an element of the preference set .

In both types of constraints, the preference function represents the preference of the agent on the duration of an event or on the distance between two events. However, while for soft requirement constraints the agent has control and can be guided by the preferences in choosing values for the time-points, for soft contingent constraints the preference represents merely a desire of the agent on the possible outcomes of Nature: there is no control on the outcomes. It should be noticed that in STPPUs uncertainty is modeled, just like in STPUs, assuming “complete ignorance” on when events are more likely to happen. Thus, all durations of contingent events are assumed to be equally possible (or plausible) and different levels of plausibility are not allowed.

We can now state formally the definition of STPPUs, which combines preferences from the definition of an STPP with contingency from the definition of an STPU.

###### Definition 19 (Stppu)

A Simple Temporal Problem with Preferences and Uncertainty (STPPU) is a tuple where:

• is the set of executable time-points;

• is the set of contingent time-points;

• is a c-semiring;

• is the set of soft requirement constraints over S;

• is the set of soft contingent constraints over S.

Note that, as STPPs, also STPPUs can model hard constraints by soft constraints in which each element of the interval is mapped into the maximal element of the preference set. Further, without loss of generality, and following the assumptions made for STPUs [Morris, Muscettola,  VidalMorris et al.2001], we assume that no two contingent constraints end at the same time-point.

Once we have a complete assignment to all time-points we can compute its global preference, as in STPPs. This is done according to the semiring-based soft constraint schema: first we project the assignment on each soft constraint, obtaining an element of the interval and the preference associated to that element; then we combine the preferences obtained on all constraints with the multiplicative operator of the semiring. Given two assignments with their preference, the best is chosen using the additive operator. An assignment is optimal if there is no other assignment with a preference which is better in the semiring’s ordering.

In the following we summarize some of the definitions given for STPUs, extending them directly to STPPUs.

###### Definition 20

Given an STPPU :

• A schedule is a complete assignment to all the time-points in and ;

• Sched(P) is the set of all schedules of ; while Sol(P) the set of all schedules of that are consistent with all the constraints of (see Definition 1, Section 2.2);

• Given a schedule for , a situation (usually written ) is the set of durations of all contingent constraints in ;

• Given a schedule for , a control sequence (usually written is the set of assignments to executable time-points in ;

• is a schedule such that 444Regarding notation, as in the case with hard constraints, given an executable time-point , we will write to indicate the value assigned to in , and to indicate the durations of the contingent events that finish prior to in ., , and for every contingent constraint, , defined on executable and contingent time-point , -, where is the duration of in ;

• A projection corresponding to a situation is the STPP obtained from by leaving all requirement constraints unchanged and replacing each contingent constraint with the soft constraint , where is the duration of the event represented by in , and is the preference associated to such duration;

• Given a projection we indicate with the set of solutions of and we define , ; if the set of preferences is totally ordered we indicate with the preference of any optimal solution of ;

• Proj(P) is the set of all projections of an STPPU P;

• A strategy is a map : such that for every projection , is a schedule which includes ;

• A strategy is viable if , is a solution of , that is, if it satisfies all its soft temporal constraints. Thus a viable strategy is a mapping . In this case we indicate with the global preference associated to schedule in STPP .

###### Example 4

Consider as an example the following scenario from the Earth Observing Satellites domain [Frank, Jonsson, Morris,  SmithFrank et al.2001] described in Section 1. Suppose a request for observing a region of interest has been received and accepted. To collect the data, the instrument must be aimed at the target before images can be taken. It might be, however, that for a certain period during the time window allocated for this observation, the region of interest is covered by clouds. The earlier the cloud coverage ends the better, since it will maximise both the quality and the quantity of retrieved data; but coverage is not controllable.

Suppose the time window reserved for an observation is from to units of time and that we start counting time when the cloud occlusion on the region of interest is observable. Also, suppose, in order for the observation to succeed, the aiming procedure must start before units after the starting time, ideally before units, and it actually can only begin after at least time unit after the weather becomes observable. Ideally the aiming procedure should start slightly after the cloud coverage will end. If it starts too early, then, since the instrument is activated immediately after it is aimed, clouds might still occlude the region and the image quality will be poor. On the other hand, if it waits too long after the clouds have disappeared then precious time during which there is no occlusion will be wasted aiming the instrument instead of taking images. The aiming procedure can be controlled by the mission manager and it can take anywhere between and units of time. An ideal duration is or units, since a short time of units would put the instrument under pressure, while a long duration, like units, would waste energy.

This scenario, rather tedious to describe in words, can be compactly represented by the STPPU shown in Figure 8 with the following features:

• a set of executable time-points (Start Clouds), (Start Aiming), (End Aiming);

• a contingent time-point (End Clouds);

• a set of soft requirement constraints on ;

• a soft contingent constraint ;

• the fuzzy semiring .

A solution of the STPPU in Figure 8 is the schedule . The situation associated with is the projection on the only contingent constraint, , i.e. , while the control sequence is the assignment to the executable time-points, i.e. . The global preference is obtained by considering the preferences associated with the projections on all constraints, that is on , on , on , and on . The preferences must then be combined using the multiplicative operator of the semiring, which is , so the global preference of is . Another solution has global preference . Thus is a better solution than according to the semiring ordering since .

## 4 Controllability with Preferences

We now consider how it is possible to extend the notion of controllability to accommodate preferences. In general we are interested in the ability of the agent to execute the time-points under its control, not only subject to all constraints but also in the best possible way with respect to preferences.

It transpires that the meaning of ‘best possible way’ depends on the types of controllability required. In particular, the concept of optimality must be reinterpreted due to the presence of uncontrollable events. In fact, the distinction on the nature of the events induces a difference on the meaning of the preferences expressed on them, as mentioned in the previous section. Once a scenario is given it will have a certain level of desirability, expressing how much the agent likes such a situation. Then, the agent often has several choices for the events he controls that are consistent with that scenario. Some of these choices might be preferable with respect to others. This is expressed by the preferences on the requirement constraints and such information should guide the agent in choosing the best possible actions to take. Thus, the concept of optimality is now ‘relative’ to the specific scenario. The final preference of a complete assignment is an overall value which combines how much the corresponding scenario is desirable for the agent and how well the agent has reacted in that scenario.

The concepts of controllability we will propose here are, thus, based on the possibility of the agent to execute the events under her control in the best possible way given the actual situation. Acting in an optimal way can be seen as not lowering further the preference given by the uncontrollable events.

### 4.1 Strong Controllability with Preferences

We start by considering the strongest notion of controllability. We extend this notion, taking into account preferences, in two ways, obtaining Optimal Strong Controllability and -Strong Controllability, where is a preference level. As we will see, the first notion corresponds to a stronger requirement, since it assumes the existence of a fixed unique assignment for all the executable time-points that is optimal in every projection. The second notion requires such a fixed assignment to be optimal only in those projections that have a maximum preference value not greater than , and to yield a preference in all other cases.

###### Definition 21 (Optimal Strong Controllability)

An STPPU is Optimally Strongly Controllable (OSC) iff there is a viable execution strategy s.t.

1. , and for every executable time-point ;

2. , .

In other words, an STPPU is OSC if there is a fixed control sequence that works in all possible situations and is optimal in each of them. In the definition, ‘optimal’ means that there is no other assignment the agent can choose for the executable time-points that could yield a higher preference in any situation. Since this is a powerful restriction, as mentioned before, we can instead look at just reaching a certain quality threshold:

###### Definition 22 (α-Strong Controllability)

An STPPU is -Strongly Controllable (-SC), with a preference, iff there is a viable strategy s.t.

1. , and for every executable time-point ;

2. , such that with ;

3. otherwise.

In other words, an STPPU is -SC if there is a fixed control sequence that works in all situations and results in optimal schedules for those situations where the optimal preference level of the projection is not in a schedule with preference not smaller than in all other cases.

### 4.2 Weak Controllability with Preferences

Secondly, we extend similarly the least restrictive notion of controllability. Weak Controllability requires the existence of a solution in any possible situation, possibly a different one in each situation. We extend this definition by requiring the existence of an optimal solution in every situation.

###### Definition 23 (Optimal Weak Controllability)

An STPPU is Optimally Weakly Controllable (OWC) iff there is a strategy s.t.  is an optimal solution of .

In other words, an STPPU is OWC if, for every situation, there is a control sequence that results in an optimal schedule for that situation.

Optimal Weak Controllability of an STPPU is equivalent to Weak Controllability of the corresponding STPU obtained by ignoring preferences, as we will formally prove in Section 6. The reason is that if a projection has at least one solution then it must have an optimal solution. Moreover, any STPPU is such that its underlying STPU is either WC or not. Hence it does not make sense to define a notion of -Weak Controllability.

### 4.3 Dynamic Controllability with Preferences

Dynamic Controllability (DC) addresses the ability of the agent to execute a schedule by choosing incrementally the values to be assigned to executable time-points, looking only at the past. When preferences are available, it is desirable that the agent acts not only in a way that is guaranteed to be consistent with any possible future outcome but also in a way that ensures the absence of regrets w.r.t. preferences.

###### Definition 24 (Optimal Dynamic Controllability)

An STPPU is Optimally Dynamically Controllable (ODC) iff there is a viable strategy such that and for any executable time-point :

1. if then ;

2. and .

In other words, an STPPU is ODC if there exists a means of extending any current partial control sequence to a complete control sequence in the future in such a way that the resulting schedule will be optimal. As before, we also soften the optimality requirement to having a preference reaching a certain threshold.

###### Definition 25 (α-Dynamic Controllability)

An STPPU is -Dynamically Controllable (-DC) iff there is a viable strategy such that and for every executable time-point :

1. if then ;

2. and if with and with ;

3. and otherwise.

In other words, an STPPU is -DC if there is a means of extending any current partial control sequence to a complete sequence; but optimality is guaranteed only for situations with preference . For all other projections the resulting dynamic schedule will have preference at not smaller than .

### 4.4 Comparing the Controllability Notions

We will now consider the relation among the different notions of controllability for STPPUs.

Recall that for STPUs, (see Section 2). We start by giving a similar result that holds for the definitions of optimal controllability with preferences. Intuitively, if there is a single control sequence that will be optimal in all situations, then clearly it can be executed dynamically, just assigning the values in the control sequence when the current time reaches them. Moreover if, whatever the final situation will be, we know we can consistently assign values to executables, just looking at the past assignments, and never having to backtrack on preferences, then it is clear that every situation has at least an optimal solution.

###### Theorem 1

If an STPPU is OSC, then it is ODC; if it is ODC, then it is OWC.

Proofs of theorems are given in the appendix. The opposite implications of Theorem 1 do not hold in general. It is in fact sufficient to recall that hard constraints are a special case of soft constraints and to use the known result for STPUs [Morris, Muscettola,  VidalMorris et al.2001].

As examples consider the following two, both defined on the fuzzy semiring. Figure 9 shows an STPPU which is OWC but is not ODC. It is, in fact, easy to see that any assignment to A and C, which is a projection of the STPPU can be consistently extended to an assignment of B. However, we will show in Section 7 that the STPPU depicted is not ODC.

Figure 10, instead, shows an ODC STPPU which is not OSC. A and B are two executable time-points and C is a contingent time-point. There are only two projections, say and , corresponding respectively to point 1 and point 2 in the AC interval. The optimal preference level for both is 1. In fact, is a solution of with preference 1 and is a solution of with preference 1. The STPPU is ODC. In fact, there is a dynamic strategy that assigns to B value 2, if C occurs at 1, and value 3, if C occurs at 2 (assuming A is always assigned 0). However there is no single value for B that will be optimal in both scenarios.

Similar results apply in the case of -controllability, as the following formal treatment shows.

###### Theorem 2

For any given preference level , if an STPPU is -SC then it is -DC.

Again, the converse does not hold in general. As an example consider again the STPPU shown in Figure 10 and . Assuming , such an STPPU is 1-DC but, as we have shown above, it is not -SC.

Another useful result is that if a controllability property holds at a given preference level, say , then it holds also , as stated in the following theorem.

###### Theorem 3

Given an STPPU and a preference level , if is -SC (resp. -DC), then it is -SC (resp. -DC), .

Let us now consider case in which the preference set is totally ordered. If we eliminate the uncertainty in an STPPU, by regarding all contingent time-points as executables, we obtain an STPP. Such an STPP can be solved obtaining its optimal preference value . This preference level, , will be useful to relate optimal controllability to -controllability. As stated in the following theorem, an STPPU is optimally strongly or dynamically controllable if and only if it satisfies the corresponding notion of -controllability at .

###### Theorem 4

Given an STPPU defined on a c-semiring with totally ordered preferences, let . Then, P is OSC (resp. ODC) iff it is -SC (resp. -DC).

For OWC, we will formally prove in Section 6 that an STPPU is OWC iff the STPU obtained by ignoring the preference functions is WC. As for the relation between -controllability and controllability without preferences, we recall that considering the elements of the intervals mapped in a preference coincides by definition to considering the underlying STPU obtained by ignoring the preference functions of the STPPU. Thus, -X holds iff X holds, where X is either SC or DC.

In Figure 11 we summarize the relationships holding among the various controllability notions when preferences are totally ordered. When instead they are partially ordered, the relationships and , where is a controllability notion, do not make sense. In fact, in the partially ordered case, there can be several optimal elements and several minimal elements, not just one.

## 5 Determining Optimal Strong Controllability and α-Strong Controllability

In the next sections we give methods to determine which levels of controllability hold for an STPPU. Strong Controllability fits when off-line scheduling is allowed, in the sense that the fixed optimal control sequence is computed before execution begins. This approach is reasonable if the planning algorithm has no knowledge on the possible outcomes, other than the agent’s preferences. Such a situation requires us to find a fixed way to execute controllable events that will be consistent with any possible outcome of the uncontrollables and that will give the best possible final preference.

### 5.1 Algorithm Best-SC

The algorithm described in this section checks whether an STPPU is OSC. If it is not OSC, the algorithm will detect this and will also return the highest preference level such that the problem is -SC.

All the algorithms we will present in this paper rely on the following tractability assumptions, inherited from STPPs: (1) the underlying semiring is the fuzzy semiring defined in Section 2.2, (2) the preference functions are semi-convex, and (3) the set of preferences is discretized in a finite number of elements according to a given granularity.

The algorithm Best-SC is based on a simple idea: for each preference level , it finds all the control sequences that guarantee strong controllability for all projections such that their optimal preference is , and optimality for those with optimal preference . Then, it keeps only those control sequences that do the same for all preference levels .

The pseudocode is shown in Figure 12. The algorithm takes in input an STPPU (line 1). As a first step, the lowest preference is computed. Notice that, to do this efficiently, the analytical structure of the preference functions (semi-convexity) can be exploited.

In line 3 the STPU obtained from by cutting it at preference level is considered. Such STPU is obtained by applying function -Cut(STPPU ) with = 555Notice that function -Cut can be applied to both STPPs and STPPUs: in the first case the output is an STP, while in the latter case an STPU. Notice also that, -Cut is a known concept in fuzzy literature.. In general, the result of -Cut() is the STPU (i.e., a temporal problem with uncertainty but not preferences) defined as follows:

• has the same variables with the same domains as in P;

• for every soft temporal constraint (requirement or contingent) in on variables , and , say , there is, in , a simple temporal constraint on the same variables defined as .

Notice that the semi-convexity of the preference functions guarantees that the set forms an interval. The intervals in contain all the durations of requirement and contingent events that have a local preference of at least .

Once STPU is obtained, the algorithm checks if it is strongly controllable. If the STP obtained applying algorithm StronglyControllable [Vidal  FargierVidal  Fargier1999] to STPU is not consistent, then, according to Theorem 3, there is no hope for any higher preference, and the algorithm can stop (line 4), reporting that the STPPU is not -SC and thus is not OSC as well. If, instead, no inconsistency is found, Best-SC stores the resulting STP (lines 5-6) and proceeds moving to the next preference level 666By writing we mean the next preference level higher than defined in terms of the granularity of the preferences in the [0,1] interval. (line 7).

In the remaining part of the algorithm (lines 9-21), three steps are performed at each preference level considered:

• Cut STPPU and obtain STPU (line 10);

• Apply path consistency to considering it as an STP: PC() (line 11);

• Apply strong controllability to STPU PC() (line 13).

Let us now consider the last two steps in detail.

Applying path consistency to STPU means considering it as an STP, that is, treating contingent constraints as requirement constraints. We denote as algorithm PC any algorithm enforcing path-consistency on the temporal network (see Section 2.1 and meiri, 1991). It returns the minimal network leaving in the intervals only values that are contained in at least one solution. This allows us to identify all the situations, , that correspond to contingent durations that locally have preference and that are consistent with at least one control sequence of elements in . In other words, applying path consistency to leaves in the contingent intervals only durations that belong to situations such that the corresponding projections have optimal value at least . If such a test gives an inconsistency, it means that the given STPU, seen as an STP, has no solution, and hence that all the projections corresponding to scenarios of STPPU have optimal preference (line 11).

The third and last step applies StronglyControllable to path-consistent STPU PC(), reintroducing the information on uncertainty on the contingent constraints. Recall that the algorithm rewrites all the contingent constraints in terms of constraints on only executable time-points. If the STPU is strongly controllable, StronglyControllable will leave in the requirement intervals only elements that identify control sequences that are consistent with any possible situation. In our case, applying StronglyControllable to PC() will find, if any, all the control sequences of PC() that are consistent with any possible situation in PC().

However, if STPU PC() is strongly controllable, some of the control sequences found might not be optimal for scenarios with optimal preference lower than . In order to keep only those control sequences that guarantee optimal strong controllability for all preference levels up to , the STP obtained by StronglyControllable(PC()) is intersected with the corresponding STP found in the previous step (at preference level ), that is (line 15). We recall that given two two STPs, and , defined on the same set of variables, the STP has the same variables as and and each temporal constraint, , is the intersection of the corresponding intervals of and . If the intersection becomes empty on some constraint or the STP obtained is inconsistent, we can conclude that there is no control sequence that will guarantee strong controllability and optimality for preference level and, at the same time, for all preferences (line 16). If, instead, the STP obtained is consistent, algorithm Best-SC considers the next preference level, , and performs the three steps again.

The output of the algorithm is the STP, , obtained in the iteration previous to the one causing the execution to stop (lines 23-24) and two of its solutions, and . This STP, as we will show shortly, contains all the control sequences that guarantee -SC up to . Only if is the highest preference level at which cutting gives a consistent problem, then the STPPU is OSC. The solutions provided by the algorithm are respectively the the earliest, , and the latest, , solutions of . In fact, as proved in [Dechter, Meiri,  PearlDechter et al.1991] and mentioned in Section 2.1, since is minimal, the earliest (resp. latest) solution corresponds to assigning to each variable the lower (resp. upper) bound of the interval on the constraint defined on and the variable. This is indicated in the algorithm by procedures Earliest-Solution and Latest-Solution. Let us also recall that every other solution can be found from without backtracking.

Before formally proving the correctness of algorithm Best-SC, we give an example.

###### Example 5

Consider the STPPU described in Example 4, and depicted in Figure 8. For simplicity we focus on the triangular sub-problem on variables , , and . In their example, . Table 1 shows the STPUs obtained cutting the problem at each preference level . Table 2 shows the result of applying path consistency (line 11) to each of the STPUs shown in Table 1. As can be seen, all of the STPUs are consistent. Finally, Table 3 shows the STPs defined only on executable variables, and , that are obtained applying StronglyControllable to the STPUs in Table 2.

By looking at Tables 2 and 3 it is easy to deduce that the Best-SC will stop at preference level 1. In fact, by looking more carefully at Table 3, we can see that STP consists of interval on the constraint , while StronglyControllable(PC()) consist of interval on the same constraint. Obviously intersecting the two gives an inconsistency, causing the condition in line 16 of Figure 12 to be satisfied.

The conclusion of executing Best-SC on the example depicted in Figure8 is that it is -SC but not OSC. Let us now see why this is correct. Without loss of generality we can assume that is assigned value 0. From the last line of Table 3 observe that the only value that can be assigned to that is optimal with both scenarios that have optimal preference 1 (that is when is assigned 1 or 2) is 3. However, assigning 3 to is not optimal if happens at 6, since this scenario has optimal preference value 0.7 (e.g. if is assigned 5) while in this case it would have a global preference 0.6 (given in constraint )777Recall that in the fuzzy semiring context the global preference of any assignment is computed taking the minimum preference assigned to any of its projections..

### 5.2 Properties of Best-SC

We will now prove that algorithm Best-SC correctly identifies whether an STPPU is OSC, and, if not, finds the highest preference level at which is -SC. Let us first consider the events in which Best-SC stops.

• Event 1. StronglyControllable() is inconsistent (line 4);

• Event 2. PC() returns an inconsistency (line 11);

• Event 3. PC() is consistent but it is not strongly controllable (line 13);

• Event 4. PC() is strongly controllable, however the intersection of the STP obtained by StronglyControllable(PC() with the STP obtained at the previous preference level, , is inconsistent (line 16).

First notice that the algorithm terminates.

###### Theorem 5

Given any STPPU P with a finite number of preference levels, the execution of algorithm Best-SC over terminates.

Intuitively, either one of the termination events occur or all the preference levels will be exhausted.

Next, let us show that Best-DC is a sound and complete algorithm for checking if an STPPU is OSC and for finding the highest preference level at which it is -SC.

As we have said before, cutting an STPPU at a preference level gives an STPU . Moreover, every situation of can be seen as a situation of such that . This implies that every projection , which is an STP, corresponds to a projection which is an STPP. For all situations of , in what follows we will write always which should be interpreted as an STP when seen as a projection of and as an STPP when seen as a projection of . In the following lemmas we state properties which relate the solutions of such projections in the two contexts: without and with preferences.

###### Theorem 6

Consider an STPPU and preference level , and consider the STPU obtained by cutting at , and STPU PC()= . Then:

1. situation of , (PC()) iff ;

2. for every control sequence , is a solution of = StronglyControllable(PC(, iff Proj(PC ()),