From: AAAI Technical Report WS-00-02. Compilation copyright © 2000, AAAI (www.aaai.org). All rights reserved. Building dispatchable networks involving consumable resources within the HSTS framework. R. J. Wallace, E. C. Freuder Constraint Computation Center University of NewHampshire, Durham, NH 03824 decisions have caused it to reach a point where there are no options (a ’dead end’), because these earlier activities have already begun. For this reason, when actual plan execution begins there must be guarantees that a schedule derived from the time-envelopes is executable incrementally or "dispatchable’. In recent work it has been shown that consistent temporal constraint networks, which are a basic component of the Planner-Scheduler’s output, can be made dispatchable (Muscettola, Morris, & Tsamardinos 1998). Abstract Earlier work on scheduling by autonomous systems has demonstratedthat schedules in the form of simple temporal networks, with intervals of values for possible event-times, can be made"dispatchable", i.e., executable incrementally in real time with guarantees against failure due to unfortunate event-time selections. These schedules can be built prior to execution by an automated Planner/ Scheduler based on the Heuristic Scheduling Testbed System (HSTS). the present work we show howthe property of dispatchabflity can be extended to networks that include constraints for consumableresources. Wefirst describe conditions under which a componentof the network composedof resource constraints will support dispatchability. Then we showhow a network can be produced during planning that supports dispatchabflity while allowing flexible resource use. This workindicates that flexible handling of consumableresources can be safely extended to the execution layer to provide more effective deploymentof these resources. In this paper we describe work we have done to extend the earlier work with temporal constraints to situations where there are also consumableresource constraints. The goal of this work is to develop methods for deriving similar guarantees against running out of options during plan execution, in this case because some resource constraint cannot be satisfied. In this report we restrict our analysis to modesof representation associated with the Heuristic Scheduling Testbed System (HSTS) (Muscettola 1994) that provides framework for the Planner-Scheduler for the NASARemote Agent (Muscettola et al. 1998). Wepresent in some detail a system for building networks for the Executive that are dispatchable with respect to a consumable resource. In this case the dispatchability problem can be defined in a way that makes it feasible to produce dispatchable networks, while allowing sufficient flexibility to be of practical interest. Introduction. Like many other contemporary scheduling systems, the scheduling system within of the Remote Agent architecture developed at NASA-Ames (Muscettola et al. 1998) has two basic layers of operation. There is first, deliberative layer, the "Planner-Scheduler", which creates a basic schedule of operation (Muscettola 1994). In the Remote Agent, the output from this subsystem consists of an envelope of scheduling times for each operation, or activity, which allows someflexibility in scheduling specific activities based on current conditions. The task of selecting specific times for operation is carried out in the second (reactive) layer the plan executor, or "Smart Executive", which issues the commandsignals for operating the physical system and monitors the progress of the system to determine whether activites have been performed successfully. Because the Executive is operating in real time, the constraints on its operation are severe. In particular, during the instantiation of a schedule the Executive cannot afford to backtrack. That is, it cannot go back and reschedule earlier activities wheneverits previous The next section gives an overview of how we are dealing with the problem and describes how to represent resource usage and release as a "consumable resource network" (cRN) that can be associated with the Executive STN. The section after that describes conditions that insure that the cRNwill support dispatchability in the combinednetwork. The next section discusses methods that can be used during the planning stage to track resource use and detect oversubscription. The following section describes the construction of a cRNbased on this information. The final section gives conclusions. 54 What The Present are We Aiming For? types (along with an Idle state), instances of which are inserted in the SSRtime-line. Consumable resource constraints can be incorporated into the data structure sent to the Executive via a separate subgraph that we will designate as the consumable resource network, or cRN. In Figure 1 the cRN is shown as a subnetwork apart from the temporal subnetwork. This figure is to be taken strictly as a means of showing the reader the relations between parts of the overall structure. In particular, the ’null’ nodes and associated arcs in the cRNare not needed in practice, but are included so that resource use can be represented in a way that parallels the temporal duration represented for the same activity in the STN. In the cRNdepicted in Figure 1, intervals represent bounds on resource use for a given activity. For example, in this figure each interval, [10,20], represents a range of possible use of a resource between 10 and 20 units. In addition, k-ary constraints within sets of variables prevent the resource capacity from being exceeded. In the present example, the capacity is 30 resource units, and the sum of the upper bounds exceeds capacity by 10 units. Therefore, if activity x starts before y, and if the duration stipulated for the former activity results in its using more than 10 resource units, then the upper bound of y must be reduced by the excess amount in order to satisfy the constraint between x and y. Wewill refer to a set of activities like this as a "bout" of resource use; in practice, bouts are succeeded and possibly preceeded by an instance of resource release (not shownin Figure 1). In the full network, the cRNmust be associated with STNnodes that correspond to the same activities. Resource use is assumedto be a nondecreasing function of time, and for expository purposes we will assume a linear relation, specifically, multiplication of the temporal bounds by a positive or negative quantity for resource use and release, respectively, this quantity being constant for a given activity. Of importance is the fact that the mapping from STNevent to associated resource use is both bijective, i.e., one-to-one and onto, and monotonic. In Figure 1, the linkage between STN and claN is shownexplicitly by means of dashed lines, each labeled with its constant of proportionality. In practice, a constraint of the form, 5(d - b) ÷ 2(g < 30 might be added to the STN, or it might only be implicit in certain procedures carried out on the STN (cf. below). HSTS System HSTS(for Heuristic Scheduling Testbed System) is planning and scheduling system originally developed at Carnegie-Mellon University and later put into use at the NASA-Ames Research Center as part of its program in automated scheduling. The system is designed to create and schedule plans of action for systems such as spacecraft and orbiting telescopes, that have multiple components whose activities must be coordinated. This is done by building schedules along multiple timelines, or "state variables", one for each dynamic feature of the system. Activities are represented in terms of types. For example, a power component might be represented as a state variable with two types called "power-low" and "power-high". Associated with each type is a set of relevant constraint types. Instances of each activity-type, called "tokens", are inserted on the time lines along with their constraints; following such insertion, constraint propagation is carried out. To improve efficiency this is done using associated constraint networks. In particular, temporal events associated with tokens are represented in a separate network that, for reasons of tractability, is in the form of a simple temporal network (STN) (Dechter, Meiri, ~z Pearl 1991). In the present scheduling system, the PlannerScheduler sends the Executive an envelope of acceptable scheduling times, also in the form of an STN. A critical characteristic of this network is that it is not only consistent but dispatchable. This means that events can be instantiated successively, whenever the current time is within the present bounds of an event, and the system will not encounter a dead-end, i.e., an event that cannot be scheduled because the current time is beyond its present time bounds (Muscettola, Morris, & Tsamardinos 1998). Incorporating the Executive Consumable Network Resources Into We begin with an example. Most if not all spacecraft use an onboard solid state recorder (SSR) store data collected via cameras and other sensors temporarily, until the craft is in communicationwith the Deep Space Network on earth, when the information is downloaded. Data storage occurs during a Record state; in this state resource capacity is used up. Data transmission occurs during a Playback state, when information is relayed to earth; in this state resource capacity is released. Change in the amount of storage used occurs at a fixed rate during each instance of Record or Playback. The SSRis, therefore, typical of consumable resources in that it has a fixed capacity that cannot be exceeded during the schedule. (It is more general than manyin that it is also intermittently renewable.) In the HSTSrepresentation, the SSRis a state variable, with Record and Playback as Making (Executive) cRN Support Dispatchability. At the outset, it is important to note that the tractability of the STN-cRNas a constraint satisfaction problem is not a fundamental problem. This is because both temporal and consumable resource constraints are closed under a binary function, min, that is associative, commutative, and idempotent. This CSP, therefore, falls under tractability class 2 of (Jeavons, 55 the Obviously, in this case the Executive does not need to process the cRNat all, since whatever values it selects from the STN,the resulting resource use will be within capacity. This condition puts limitations on the range of choice that can be given to the Executive. This can be seen in Figure 1, where the sum of upper bounds (40) is well above the capacity (30). At the same time, the cRNin this figure is fully consistent, because for every value of resource usage chosen for activity x there is a usage value for activity y within the designated bounds. Given the constraint between these variables, then any selection for one variable can be matched by a selection for the other in such a waythat the resource capacity is not exceeded. This suggests that th.ere are weaker conditions for dispatchability with the general form j k [10,20],(~ y_< 30-x~ (\ (--) [2,4] , ~ tIo,2o] *2\\ \\ ,5 / ~ --5 \\ .hh \\ // [7,101 [4,7] ~ [~,1ol ~ Figure 1: Composite temporal-and-consumableresource network, in which intervals for duration (STN) and resource use (cRN) associated with same activity are linked together. Such links are indicated by dashed lines; the linked intervals are those associated with arcs directed toward the nodes of origin and destination for the cross-links. For example, activity x in the cRNis associated with arc (b,d) the STN.See text for further explication. i----1 + r. tb, < C,.,, i=j-}-i (3) for two mutually exclusive and exhaustive subsets of resource activities within a bout of length k. In particular, the condition k--1 E ubi + lbk <_ Cini, (4) i=1 holding for all subsets of k - 1 activities in a bout of length k would allow any value of resource use to be used for the first k- 1 activities, and still leave at least one value available for the last one. Unfortunately, it has been shown that conditions such as these are not sufficient to support dispatchability (Wallace ~ Freuder 2000a)(Wallace & Freuder 2000b). In a nutshell, the problem is due to interactions between the STNand cRN: propagation over resource constraints can exclude values in the STN, while propagation in the STNcan exclude values for resource use. As a result values may be lost that are necessary to insure STN-dispatchability or, conversely, that are necessary to fulfill conditions on resource usage of the kind just described. In previous work it has been shown that dispatchability can be supported if, for a critical subset of activities associated with lower bounds in equation (2), the duration is independent of the start-time. (Such activities will be referred to as "buffers", since they serve to buffer the scheduling procedure against going over resource capacity.) This extra requirement insures that the lower bound values will be available regardless of the values (for times or resource use) chosen for their predecessors and successors. This, together with the condition described by inequation (2) will be referred to as a condition type ii. Conditions of this type mayappear to put severe restrictions on the values that must be chosen for some activities, in order to meet the inequality condition. Cohen, & Gyssens 1995). To support dispatchability, a cRNmust allow any sequence of instantiations to be made in the associated STNwithout resource capacity being exceeded. Given the bijective mapping from STNevent to resource use, this implies that any choice of value for an instance of resource use must allow some values to be chosen for all future (as yet uninstantiated) variables. Werefer to this loosely as "cl:tN dispatchability". (The present discussion is presented in terms of a single bout of resource use, between instances of release. Elsewhere the analysis is extended to sequences of bouts (Wallace Freuder 2000a)(Wallace & Freuder 20005).) The only necessary condition for cRNdispatchability appears to be the following: k X:lb < (1) i---1 In words, the sum of the minimumusage for all activities in a bout must not exceed the current capacity. Fortunately, there are weakersufficient conditions. Weconsider two such conditions for cRN dispatchability, that we call condition (i) and (ii). The first simply that the sum of the upper bounds on resource use be less than or equal to the initial resource capacity, k < (2) 56 Fortunately, these restrictions can be ameliorated in various ways. First, it should be noted that one can use the smallest possible buffer set consistent with inequality (2). Ideally, this wouldbe a singleton. Moreover, there are more than one such minimal sets, then these can be tracked during execution, so that the last one is the one chosen as the actual buffer set. In addition, it should be possible during execution to track the difference between the upper bound on resource for an activity and the actual usage. The sum of these differences, called the "credit" (Wallace & Freuder 2000a) (Wallace & Freuder 2000b), can then be added to the lower bounds for the activities in the buffer set without exceeding capacity or otherwise compromising dispatchability. To summarize at this point, what we are aiming for is an Executive cRN-STNnetwork that satisfies either condition for dispatchability across each bout of resource use. The remainder of the paper describes how such a network can be built within the HSTSframework. ¯ the dispatchability condition we wish to meet, i.e. condition (i) or someversion of type (ii) Wemust also take into account the fact that our task is really two-fold, because we are always computing in terms of bounds on events (the intervals in Figure 1) and, therefore, activity durations. This gives lower and upper bounds on resource use for each relevant activity, that need to be monitored separately. The task of handling lower bounds is simpler, because any instance of excess use must be avoided (inequality (1) above). Dynamic features include adding an activity that goes at the end of the list, inserting a new activity within the existing sequence, and adjusting the time bounds for an activity. In addition, activities maybe removedif the procedure is forced to backtrack. Placement of activities that release the resource (e.g., Playbacks) can be considered a further dynamic condition. In some cases these activities may be inserted at our" discretion, but in manycases there will probably be fairly tight restrictions on the times of their occurrence. Under such conditions, it appears unlikely that a series of sums could be used to track resource use. The problem is that separate sums are based on a partition of the set of activities into bouts. But this partitioning can only be done when one knows the locations of instances of resource release. Unless these can be specified a priori, neither the numberof sums nor the association of an activity with a particular sum can be determined. Moreover,if activities are shifted in time, the Planner must recognize when this changes the partition, and this requires more apparatus than a series Tracking Resource Use During Planning In the planning stage, a schedule is built by laying down tokens on time lines, where some of these tokens represent activities that use the resources in question. With respect to consumable resources, our task is to monitor resource use and use this information to produce flexible, dispatchable schedules for the Executive that cannot result in oversubscription of these resources. In this context and perhaps more generally, we can identify three approaches that might be used to monitor resource use to avoid oversubscription. These are: 1. maintaining sums of resource usage between instances of resource release 2. maintaining lists of activities that use the resource, where these activities are ordered by time (especially starttimes) 3. maintaining a graphical representation of resource use, based on time lines that are isomorphic with the time lines used in HSTS, to ’map’ resource use by activities associated with different components (state variables) of the system These strategies are ordered by complexity of representation and processing. Obviously, we would like to use the simplest strategy possible in a given situation. However, we must also consider computational adequacywith respect to several criteria: ¯ whether the method will function adequately in the dynamic setting of automated schedule production ¯ whether it can handle special constraints, in particular, those related to occurrences of resource release ¯ flexibility of response to instances of potential overuse of sums. Onthe other hand, it appears that a single list of activities ordered by start times can suffice, provided that connections are maintained with appropriate activities (tokens) on the time lines. Partial sums representing minimal and maximal resource use by the end of each activity must also be associated with each element in the list. This strategy can be considered an amplified version of the second approach listed above. It differs from the third strategy not only in being restricted to one sequence of activities that fall on different time lines, but in excluding activities that do not affect resource capacity. (We have also developed a version of the third approach, with a separate line for each state variable associated with resource use, as well as isomorphism between activities on the temporal and resource time lines, but in view of the above conclusion we will not discuss it here.) In the present conception, there is no special treatment of cases where activities that use a resource overlap in time. (Weassume, of course, that in such cases the mechanicsof the system will allow this.) This is because the important information is how much resource is used, which doesn’t depend on whether or not instances of use overlap in time. The same argument holds for overlap of resource use and resource release, 57 since the relation being monitored is that between accumulated usage and amount of resource released. Since adjustments to the changes mentioned above appear to be straightforward in each case, they will not be treated in detail, other than to note that rearrangement of the sequence may be necessary after bounds have changed, and that after each alteration, the partial sums associated with successive activities must be recalculated from the earliest change to the end of the list. In regard to flexibility of response, possible responses to instances of oversubscription include reducing time (and, therefore, resource) bounds, deleting activities or shifting them ahead of an instance of resource release, adding an instance of resource release if this is possible, or simply tracking excess usage in order to add constraints to the Executive network. All of these appear to be possible with the ordered list described above. Which response we choose will depend in part on the condition we are trying to satisfy. Thus, the lastmentionedstrategy is only possible if our goal is to satisfy a condition of type (ii). (Hence, it can only be used in the context of upper bounds.) In general, a rough guiding principle might be to try to meet condition (i) if this doesn’t have a marked effect on scheduling options or flexibility of execution. Another factor is the place in a sequence of activities where capacity is first exceeded. If this is late in the sequence, shifting activities might be practical, otherwise it maybe necessary to reduce bounds or add a constraint. In manycases, choice of strategy, especially betweenthe first two, will depend on other criteria pertaining to planning goals. If we are trying to satisfy conditions of type (ii), important part of the tracking process involves determining minimal sets of buffers. This process is shown schematically in Figure 2. Part of this process (subsumed by the test that the full set of buffers satisfies inequality (ii) - cf. figure) involves determining that an activity is a buffer. This can be done during ~he planning phase by using the same dominance rules, based on a triangle equality, that are used by (Muscettola, Morris, & Tsamardinos 1998) to produce a minimal dispatchable STNafter the plan has been set up. Briefly, suppose that activity X uses the resource in question, and this activity is represented in a temporal network by arc BC; in this case C represents the end-time. If there is another arc, AC, ending at C, then ifAB + BC --- AC, arc ACcan be removed at the time when the Executive STNis made dispatchable. If this can be done for all arcs other than BCthat end in C, then activity X can be considered a buffer. The basic procedure represented by the flowchart can be augmented for special purposes. In particular, we maywant to insure that singleton buffers occur as close to the end of each bout as possible in order to maximizeflexibility during execution and/or to insure the effectiveness of execution procedures (cf. next Figure 2: Flowchart for discovering a minimal set of buffers for one bout of activities that satisfies condition (ii). section). In this case, the first buffer test and the procedure "adjust network" would include procedures for manipulating the network to establish such conditions. Creating an Executive network Setting up for execution If the goal is to send feasible bounds to the Executive (in connection with condition (ii)), then the work that the Executive receives must be elaborated to include information about capacity bounds. Since the critical decision during execution is the choice of end-time, and therefore duration, for the last buffer activity, all that is neededis to keep track of the credit before this point. In general, this can be done with a counter, in addition to a mechanismfor identifying nodes associated with resource use. However, if the buffer is the last activity in the bout, then resource constraints like the one depicted in Figure 3 (part of which is identical to the cRNin Figure 1). will be sufficient. (If the last buffer is earlier in the bout, then a constraint of this sort will not be effective in setting maximalusage consistent with inequation (2) or (3).) In Figure 3 there is one bout composedof two activities, x and y, so there is a constraint associated with this set. In addition, there is an instance of resource release, z, and a constraint betweenit and the resourceusing activities to insure that release (e.g., Playback) 58 carried out during the planning and scheduling stage (in Figure 2, within the "adjust network" procedure) when time constraints are not so severe, it may need to be done repeatedly as well as for every bout, so that speed of execution will probably be important. If the condition is not met, then determining an adjustment that will meet the inequality is also easy. (This argument does not consider restrictions due to considerations outside those of trying to meet this condition.) Thus, if the sum for one of the subsets is < the capacity, then the upper bound that does not appear in the sum can be reduced to insure dispatchability. The amount it must be reduced is equal to a difference of differences. Supposea is the element in question, i.e., the activity whose lower bound is in the sum that is < the limit. And suppose that b is the element whose lower bound is in the sum that exceeds the limit by the greatest amount. Viz, © [lo,2o] Figure 3: Example of an Executive cRN that could be constructed by the Planner/Scheduler. does not go on longer than necessary. (Note that this constraint is of the same form as the first, to insure that tractability conditions are met.) With either approach, an additional complication occurs if Playback does not release all of the capacity that has been used. In this case, the limit in the resource constraint must be adjusted. This must be done in part in the planning phase by considering lower bounds on the capacity that each Playback will release and upper bounds on preceding resource use (not exceeding capacity), although the resulting estimates will be very conservative. Fortunately, it should be possible to adjust these limits during execution, provided one tracks actual resource use during each bout, together with subsequent release. An alternative method of employing resource constraints is to add constraints that include variables representing amount of resource release. For example, suppose activity y in Figure 2 occurs after activity z. Westill need a constraint that x be less than capacity C and one that specifies that z - x is _< 0. In addition, we could add the constraint, x q- y + z _< C. (Note that the latter is not sufficient by itself, because we cannot let capacity be exceeded even temporarily.) However, this approach becomesunwieldy with further instances of usage and release, because further constraints must cover the entire set of activites up to that point. k-2 E ubi + ubb q- lba < Cinit i=1 and k--P. ubi + uba + lbb > Cinit " i=l Then the upper bound of a can be reduced by the following amountto insure dispatchability for this set: (uo - lo) - - lb) Since (ua - In) must be greater than (Ub -- lb), we know that this difference must be positive, and obviously it is _< the original difference between ua and la. If there is no sum less than the limit, it is sufficient to choose a sum, reduce one or more upper bounds until the condition in equation (3) is met, and then use the above procedure. Given that the basic conditions for dispatchability have been met, we can also add further constraints that allow later activities to have more flexibility in resource usage. For example, if we want to insure such flexibility for the kth activity, we maybe able to add a constraint based on the following formula: Meeting dispatchability conditions for all singleton activities Provided that condition ii holds for some singleton buffers, we may want to establish the condition de, scribed by inequation (3) for all activities in the bout. In this way, if the resource use for any activity within the bout is within the bound set by the lower bound plus the current credit, then the resource capacity cannot be exceed during the bout. This is another means of increasing the flexibility of resource use during execution. To determine whether this condition holds for a bout of activities, we need to examine O(k) subsets of size k- 1. These can be generated in sequence by swapping single activities in and out; at the same time, respective sumsafter the first can be generated by single additions and subtractions. Therefore, the complexity of this procedure is only O(k). Although this calculation /¢-1 _< c- (6) i=1 where lb~ < t < ubk. In this case we must assure that dispatcha-bility conditions hold for this subset of activities. Of course, this idea maybe redundant with credit-based strategies that do not require explicit constraint-based processing; it is presented here as a further possible strategy. Summary and Conclusions. In this work we have shown how to create a network involving both temporal relations and consumable resource constraints that can support dispatchable execution. In the first place, this involves meeting limiting conditions that guarantee that resource capacity 59 will not be exceeded. Whenflexibility of usage is one of the goals, then these conditions must also involve resource constraints in some form, either in terms of explicit constraints added to the Executive network or credit-tracking procedures. Procedures of this sort are described in this work. In addition, we have devised methods with low time complexity for establishing some conditions, that can be carried out prior to setting up the Exec~’tive network. The present work is pertinent to a large class of problems encountered in planning by autonomous systems like the RemoteAgent, when consumable resources like the Solid State Recorder are involved. In these systems, greater flexibility of resource use can makeoperations involving tasks such as data collection more effective, thus increasing the likelihood that overall mission goals are accomplished. Acknowledgements. This work was carried out in association with the NASA-AmesReseach Center, Moffet Field, CA and was partly supported by the National Science Foundation under Grant No. IRI-9504316. References Dechter, R.; Meiri, I.; and Pearl, J. 1991. Temporal constraint networks. Artificial Intelligence 49:61-95. Jeavons, P.; Cohen, D.; and Gyssens, M. 1995. A unifying framework for tractable constraints. In Montanari, U., and Rossi, F., eds., Principles and Practice of Constraint Programming . CP ’95, volume 976 of Lecture Notes in ComputerScience. Berlin: Springer. 276-291. Muscettola, N. 1994. HSTS: Integrating planning and scheduling. In Zweben, M., and Fox, M. S., eds., Intelligent Scheduling. San Mateo, CA: Morgan Kaufmann. 169-212. Muscettola, N.; Morris, P.; and Tsamardinos, I. 1998. Reformulating temporal plans for efficient execution. In Proceedings Kt~-98. Muscettola, N.; Nayak, P. P.; Pell, B.; and Williams, B. C. 1998. Remote agent: to boldly go where no AI system has gone before. Artificial Intelligence 103:547. Wallace, R. J., and Freuder, E. C. 2000a. Dispatchable execution of schedules involving consumable resources. In Proceedings Fifth International Conference on Artificial Intelligence Planning and Scheduling (AIPS-2000), 283-290. Menlo, CA: AAAIPress. Wallace, R. J., and Freuder, E; C. 2000b. Dispatchability conditions for schedules with consumable resources. In Proceedings Fourteenth European Conference on Artificial Intelligence (ECAI-O0), (to appear). 6O