Case-based Planning

Juho Rousu
VTT Biotechnology and Food Research

P.O. Box 1501, FIN-02044 VTT, Finland
Juho.Rousu@vtt.fi

In Seminar on Knowledge Engineering, Fall 1997, Helsinki University of Technology

Abstract

Case-based planning is a paradigm that rests on reusing previous successful solutions in solving new problems. The promises of this way of planning are two-fold: First, a case-based planner learns from experiences - both good and bad - as it solves problems. Hence, case-based planners are inherently adaptive. Second, reusing solutions leads to effective planning, as the previous solution is adapted only to the extent that is needed - sometimes not at all. This study discusses the questions inherent to case-based planning and, in addition, aims at contrasting case-based planning with other planning approaches; the presentations is, for the most part, restricted to planning tasks where the temporal relations are important, although some topics are shared with case-based design tasks.


Introduction

The motto of case-based reasoning is "similar problems have similar solutions". It has been argued that this is very humanlike view to planning: people do not tend to plan from scratch; they are more likely to do as they always have done. Deep contemplation seems to occur only when the situation encountered is new. Even then, people are likely to find solutions that resemble ones they have used before. Human memory is very strong in finding analogies and associations between situations.

Although this philosophical link to human reasoning has been very influential in CBR field, the approach can be justified also from the point of view of problems computers face. A fact of life is that the world model possessed by the planner cannot very often be accurate and complete; uncertainty about the consequences of the actions, or sequences thereof, is present. Thus, the planner is bound to make minor errors and even fail altogether. Moreover, unless the worlds model of the planner is updated, the errors and failures are bound to recur; a planner that does not learn, cannot adapt.

One way of looking at case-based planning is to consider the space of all world states. Having a complete world model - under some reasonable closed-world assumption - means that the planner can decide of every world state whether it is possible or not - and to find a plan between any two world states, if one exists. An incomplete world model means that in some planning situations the model can break down and either to result in spurious plans or the failure of finding a correct plan even if there would be one. A case-based planner, in this context, would possess an (possibly incomplete) world model and a set of "safe" paths trough regions of possible world states. Successful application of case-based planning relies one the fact that the domain model is sufficiently complete locally, i.e. that the consequences of slight modifications can be known with sufficient certainty.

Case-based planning is a paradigm that inherently support adaptive planning: as a plan is tried out in the world, the planner records the outcome and stores it with the plan as a case, in order to utilize the experience - good or bad - later on. If the plan was successful, the planner can try the similar thing again in a similar context. If the plan was a failure, the planner knows to try something else. Thus, case-based planning is a more realistic paradigm to, e.g., robotic planning than classical planning as the world model of a case-based planner need not to be neither accurate nor complete. Naturally, there is a trade-off between the goodness of the model and the complexity of the plans: long term planning becomes difficult even for a case-based planner if the model is too weak.

Case-based planning has not been in the mainstream of CBR research; retrieval-only advisory systems and case-based design systems have constituted most of the activity of the field; the reasoning about the temporal relations, that is an integral part of planning systems, is not well-represented on those areas. Nevertheless, some case-based planning systems have been presented over recent years, the meal planner CHEF (Hammond, 1990a) being the earliest case-based planner. One of the most interesting projects in planning research that utilizes, among other methods, case-based planning is the Prodigy/Analogy framework (Veloso et.al.1995), an application of which is a case-based route planner (Haigh and Veloso, 1995). Another interesting system is the CABINS scheduler (Miyashita & Sycara, 1995). SINS planner (Ram & Santamaria, 1997) is an example of a case-based robot navigation system.

Overview of Case-based planning

Case-based planning can be viewed as being composed of the following steps:

This division follows the "traditional" way of defining case-based reasoning. However, this view is perhaps too simple: case retrieval is not necessarily "unaware" of adaptation process. In fact, these two processes can be very much interleaved: the solution can be composed incrementally picking partial plans from case memory and merging them into the global plan by the means of adaptation (Haigh & Veloso 1995). The two steps can also be run iteratively in anytime fashion (Rousu & Aarts, 1996): different templates are adapted as long as there is enough time.

Representing planning cases

The purpose of cases is to record problem solving episodes such that the lessons they teach can be utilized in solving future problems. The following parts are likely to be included in a case in any case-based planner (Kolodner 1993)

The justifications for the parts are clear: the initial state is needed if the same plan will not always work in every world state in the same way, i.e. result in the same outcome. The goals can be useful if we have a weak world model: if we have previously failed to solve the same problem, we are more likely to be reminded of the unsuccessful episode. Naturally, in the case of a successful plan, storing the goals is redundant. The plan needs to be stored, otherwise there is nothing to be reused. Storing the outcome is equally important, since it represents the feedback mechanism that allows the planner to learn.

Typical of cases are that they are self-sufficient, concrete instances: in a sufficiently deterministic world, if we execute the actions in the case starting from the initial world state, we will end up in the final world state recorded in the case. Other than that, the complexity and size of the cases can vary greatly both in the number of contained actions and the structure of the representations. It is not necessary that the complexity of the case and the problem domain go hand in hand: solutions to a complex problem can be composed of several smaller cases in the fashion of hierarchical planners. There is a trade-off between the complexity of the cases and the effort of reusing them: On one hand, the more numerous and smaller the component cases are the more effort is needed in asserting the consistency of the composed plan. On the other hand, smaller fragments are more re-usable, as smaller sub-problems occur more frequently. A dual approach to this is to pick only a part of the case to the new problem. These two approaches are nicely used in concert in the route planner by Haigh and Veloso (1995) which composes the route between to points in a city from a few previously successfully used routes that cover the new problem to a sufficient degree. Only the parts of the template routes that contribute to the global goal are used, the rest is stripped away. A strategy of this kind is well suited to domains where combining the partial solutions is easy.

An another dimension of case representation is the level of abstraction: concrete instances have the benefit of being readily executable and accurate in the context they describe. An abstracted case, or prototypical case, typically needs some work instantiating the solution to the new problem, even if the new problem is direct descendant of the abstract case. A practical argument speaking in favor of abstracting cases is the efficiency of planning; redundant cases only slow down the planning. An another aspect speaking in favor of abstracted cases is noise: the values of the features of the case can sometimes be inaccurate. Relying on such malicious values may lead to problems in planning. Case abstraction can help recognizing these kind of noisy features: random variations are averaged out in the abstraction or generalization process. 

 

Indexing and retrieval: remembering previous solutions

The success of the case-based planner depends crucially on two factors: First, the amount of experience it has in the problem domain, that is, how well the planner's case memory covers the problem domain. Second, the degree to which it can remember those experiences that could be relevant in solving the current problem, that is, how well the case memory is indexed.

The planner can only partially decide the first factor, i.e. the contents of the case memory: it can decide to forget something, i.e., to refrain from storing a case. The other direction - that of the planner actively deciding which problems to solve - is realistic only in certain situations, e.g. when the planner is being deployed.

The second factor - how to index the case memory - is completely up to the planner. CHEF indexes the cases on two different dimensions: First, it indexes the cases by the problems they solve, i.e. the goals they obtain. Second, CHEF indexes the cases by the failures they avoid; after a planning failure CHEF fixes the plan, and stores the fixed plan into case memory as well as a generalized description of the failure. When CHEF begins planning a new dish, it first searches for failures that could be looming, and then searches for a case that avoids the failure and also provides a good match to the current problem. In a way, we can think of the negation of the failure state to be an additional goal that needs to be satisfied.

A popular way of performing indexing is the use of similarity metrics, combined with a flat-memory search. The benefit similarity metrics is that they are simple to use and implement. At its simplest, a similarity measure could determine the similarity of two planning cases by examining the goals, one by one, and computing the total number of post-conditions shared. This is clearly very straightforward, and can give good results. A bit more flexible similarity metric computes a (weighted) sum of feature-wise similarities; the weights aim at capturing the different importance/utilities of the goals.

Even the more elaborate metric implicitly assumes independence of the case features, including the goals. The weights can be defined to be constant in the whole casebase, but in more complex domains each case could have its own weight vector. In general, the following questions should be considered

The two latter questions can be problematic for a retrieval method. In practice, the only means of deciding what is the difficulty of obtaining a goal, can be that of searching for operation sequence that satisfies the goal starting from, i.e., to perform adaptation. That, in turn, cannot usually be justified: the complexity of retrieval could be prohibitive. Thus, finding the best template can be an elusive target. In some (simple) domains, however, it can be possible to predict adaptability (Smyth & Keane, 1995) given enough domain knowledge. One approach for finding adaptable templates is by gradually learning the importance of the goals, based on how often the template has been successfully/unsuccessfully re-used (Munoz-Avila & Hullen 1996, Bonzano et. al. 1997). The weight update rules have typically the form

w := w + d,

where w is the current weight for some feature and d is a small real value, whose absolute should be decreasing over time in order to ensure convergence. The sign of  d depends on the outcome of the retrieval: d > 0 if a) the retrieval was successful and the corresponding features matched in the template and the new problem b) the retrieval was unsuccessful and corresponding features did not match, and d < 0 if c) the retrieval was unsuccessful and the features matched d) the retrieval was successful and corresponding features did not match. The two first update rules aim at amplifying the importance of the features that could predict the success/failure while the two latter ones aim at pushing down the importance of the features that did not seem to have relevance to the outcome. Not all four update rules need to be implemented. For example, one can refrain from updating the matching features when the retrieval was successful - in the spirit of the saying "if it  is not broken, don't fix it" (Bonzano et. al. 1997).

Some work dealing with the causal analysis of the retrieval failures has been done by Munoz-Avila , Weberskirch & Roth-Berghofer (1997). They use the serializibility properties of the goals in detecting which feature weights in the similarity measure are to be updated in each situations; only the weights of the goals that are deemed to be responsible of the outcome are updated. In particular, if the failure/success was caused by the additional goals of the current problem, no weights of the template case are updated.

 

Adaptation: composing the solution

After a template case has been retrieved, the planner needs to consider, how it can make up for the differences - if any - in the current problem and the one represented by the template. This means that the planner needs to modify the plan somehow.

Typical of case-based reasoners is that adaptation is based on heuristic rules. For example CHEF includes a number of repair strategies, e.g. ALTER-PLAN-SIDE-EFFECT is a strategy that tell the planner to replace an action in the plan that has a negative side-effect with a step not having the side-effect but still having the constructive effects. The repair strategies in CHEF are organized with so called Thematic Organization Packets (TOPs) e.g. SIDE-EFFECT BLOCKED PRECONDITION which is associated with repair strategies that could be used. CHEF is not committed to do any kinds of adaptations to the plans. For example, CHEF never considers removing actions that contribute to the goal, i.e. have desired effects. This restriction alone is enough to make CHEF incomplete: one can devise situations where CHEF cannot find a solution even if one exists (Hanks and Weld, 1995).

One way to look as adaptation is to consider it as what it is: a planning problem. We have a template plan P that takes us from some world state I into world state F but we are currently in world state I' and want to go to the state F'. The planner needs to find ways to modify P into P' so that the initial state of P' is I' and the final state is F'. The SPA algorithm by  Hanks and Weld (1995) takes this elegant view of case-based planning: the template plan is considered as an arbitrary node in the search tree of partial plans, the empty plan being the root of the tree. A generative planner works by starting from the root and progressing towards the leafs. The case-based planner need potentially go to both directions: removing constraints from the plan results in movement towards the root.

The route planner by Haigh and Veloso (1995) is another case-based planner that integrates with more traditional planning strategies: the adaptation algorithm is given a set of cases from where useful partial routes need to be extracted. Any gaps that remain from merging the routes of the template cases need to be filled by planning from scratch. These planners do not make assumptions of the amount or complexity of adaptation that is needed; indeed making such would endanger the completeness of the planner (i.e. that the planner finds a solution if one exists). SPA has been proven to be complete and completeness of the route planner is quite clear due to the properties of the map domain.

A quite novel approach to plan modification is case-based adaptation that is used in DIAL (Leake et.al. 1995), a disaster response planner. Case-based adaptation can be seen as a method for applying case-based planning techniques to the adaptation problem; i.e. instead of resorting to first principles planning methods in plan adaptation, the planner will use case-based planning even there. In addition to storing the executed plans as cases, DIAL stores so called adaptation cases which record the adaptation episode, i.e. what were the goals of the adaptation and what was the initial plan like and what the actual adaptations were. Given a adaptation problem, DIAL will search for an adaptation case that has similar adaptation goals and tries to apply the adaptations to the current problem. The intuition behind case-based adaptation is that the planner should also learn from the adaptations that it has performed, instead of just learning from the executed plans. The idea is that the adaptation knowledge is likely to be independent on the context of the plan and, thus, more readily reusable.

Typical of case-based reasoners is that they perform case retrieval based on superficial examination of the cases. The consequence is that the adaptivity of the templates is not as good as can be. Adaptation-guided retrieval (Smyth & Keane, 1995) is a method that aims at finding easy-to adapt template cases as opposed to as similar templates as possible to the current problem. The method works by estimating the adaptability of the cases. The possible shortcoming of this approach is that the ability to estimate the adaptability seems partially to be accomplished in the expense of adaptation power: the authors estimate the adaptability in terms of "adaptation specialists" that perform local adaptations and another agents that aims at solving more global interactions. This way of adaptation resembles very much the repair strategies of CHEF, which is an incomplete planner as demonstrated by Hanks and Weld (1995).

In general it seems to be very hard to estimate adaptability without doing work that is equivalent to planning the adaptations; perhaps domain specific properties can be used there. It would be interesting to see what kind of domain properties would enable estimating adaptability more efficiently than computing adaptations and more accurately than what is accomplished by the similarity-based retrieval. 

 

Execution & Storage: memorizing the experience

An integral part of any case-based planner is the capability to learn. Learning is accomplished by observing the feed-back from execution of the plan. The planner can learn from both positive and negative experiences:

Storing the case into the casebase is not enough, one should also make sure that a successful plan is likely to be retrieved in a later similar problem and, respectively, that the failure is not repeated. Basically, two approaches are used for this problem in the literature. CHEF indexes the failures explicitly and anticipates them in the retrieval phase. Another approach, used with similarity metrics, is to update the feature weights according to the outcome, such that the template that led to failure is not picked again. The latter approach, however, cannot guarantee that the negative experience is ever taken into account: we may end up in picking a similar template to the one that led to failure and do the same inappropriate adaptations.

 

The complexity of Case-based planning

Theoretical analyses

The run-time complexity of case-based planning in STRIPS-type problems has been analyzed by Nebel and Koehler (1995). They concentrate on the plan modification part as it usually dominates the complexity. As is customary in complexity analysis, they examine the decision problem versions of planning problems:

They proved some interesting relations between worst-case complexities of the problems

In addition to these result, the authors show that the matching problem, i.e. finding the template case, can be hard, if we require finding the best template. One should note, however, that finding the provably optimal template is seldom required.

Although these results seem to be very negative, one has to note that these are worst-case results under classical planning assumptions and do not represent all practical planning situations. Nevertheless, they give an incentive to critically review the application of the principle "similar problems have similar solutions". If the complexity of the interrelations between the actions and goals is not sufficiently small, the correlation between the number of matching goals and the easiness of adaptation might not be as great as assumed.

Altogether, these results seem to suggest that using case-based planning just in the hope to save time can be futile. If the problem domain is very complex and still a sufficiently model is available to allow planning from first principles, the savings of time can vanish. Consequently, we must look elsewhere in order to find properties that make case-based approach to best other approaches. One can hypothesize that

Empirical results 

In the light of the preceding theoretical results, one could ask whether they have any bearing to performance in practical tasks. To the authors knowledge empirical comparisons of case-based and generative planning approaches are few and far between.

Based on these experimental results, it seems that case-based methods can improve also the run-time efficiency. However, the running time of a case-based method seems frequently to be in the same order of magnitude as alternative approaches. Also it seems that in a well-modeled, yet potentially complex domain, like the blocks world, efficiency benefit from plan reuse cannot be guaranteed.

Performance and casebase size

A property of learning systems as case-based planners is that the quality of the solutions they provide increases as the experience grows. However, the quality has its limit - the optima - thus the quality increase will always tend to zero as the size of the casebase grows. Learning curves of most case-based planners take the form of a negative exponential: the quality of the solutions rises first very rapidly but then the ascent gradually levels out (Smyth & Cunningham, 1996). At the same time, retrieval of templates can suffer from the size of the casebase. This phenomenon is known as the utility problem: the benefit of additional cases turns eventually to negative.

This problem has, essentially, only one "solution": one should avoid storing too many cases and rely on the adaptation algorithm as much as possible. Case generalization is one approach of achieving that, more careful storage phase is another. However, utility problem is not always a big problem; sometimes the quality of the solutions is much more important so that the efficiency can be sacrificed.

Discussion

This study reviewed the elements of case-based planning: case representation, retrieval, adaptation, and store. In addition some comparative analyses between case-based and generative methods were reviewed. The conclusion to make of these analyses seems to be that justifying case-based planning by time savings is not reasonable in all situations. However, no criticism have been presented of the quality of the solutions obtained with case-based planning; the criticism and problems stem from efficiency properties, which do not always seem to live up to the hype.

What are the situations where case-based planning approach is likely excel as compared to other planning approaches, then. The following properties seem to be important:

In the light of these hypotheses, it would be interesting to investigate what are the effects of uncertainty on case-based planner as opposed to other methods.

References

Bonzano, A., Cunningham, P., Smyth, B. (1997), Using Introspective Learning to Improve Retrieval in CBR: A case study in Air Traffic Control. In Proc 2nd International Conference on Case-Based Reasoning, Providence, NI., 1997, Springer-Verlag, pp. 291-302

Haigh, K. Z., Veloso, M. (1995), Route Planning by Analogy, In Proc 1st Intl. Conf. on Case-based Reasoning, Sesimbra, Portugal, Springer-Verlag, pp. 169-180

Hammond, K. (1990a), Case-Based Planning: A framework for Planning from Experience (1990). Journal of Cognitive Science 14, 3 (1990)

Hammond, K. (1990b), Explaining and Repairing Plans That Fail. Artificial Intelligence 45 (1990), pp. 173-228

Hanks, S., Weld, D.S. (1995), A Domain-Independent Algorithm for Plan Adaptation, journal of Artificial Intelligence Research 2 (1995), pp. 319-360

Kambhampati, S., Hendler, J.A. (1992), A validation-structure-based theory of plan modification and reuse. Artificial Intelligence 55 (1992), pp. 193-258

Kolodner, J. (1993), Case-Based Reasoning, Morgan Kaufmann.

Leake, D.B., Kinley, A. & Wilson, D. (1995), Learning to Improve Case Adaptation by Introspective Reasoning and CBR. Proc 1st Intl. Conf. on Case-Based Reasoning, Sesimbra, Portugal, 1995, Veloso, M., Aamodt, A., (eds), Springer-Verlag , pp.229-240

Miyashita, K., Sycara, K. (1995), CABINS: a framework of knowledge acquisition and iterative revision for schedule improvement and reactive repair. Artificial Intelligence 76 (1995), pp. 377-426

Munoz-Avila, H., Weberskirch, F., Roth-Berghofer, T. (1997), On the Relation Between the Context of a Feature and the Domain Theory in Case-Based Planning. In Proc 2nd International Conference on Case-Based Reasoning, Providence, NI., 1997, Springer-Verlag, pp. 337-348

Munoz-Avila, H., Hullen, J. (1996), Feature Weighting by Explaining Case-Based Planning Episodes. In Smith & Faltings (1996), pp. 280-294

Nebel, B., Koehler, J. (1995), Plan reuse versus plan generation: a theoretical and empirical analysis. Artificial Intelligence 76 (1995), pp. 427-454

Ram, A., Santamaria, J.C. (1997), Continuous case-based reasoning. Artificial Intelligence 90 (1997), pp. 25-77

Rousu, J., Aarts, R.J. (1996), Adaptation Cost as a Criterion for Solution Evaluation. In Smith & Faltings (1996), pp. 354-361

Smith, I., Faltings, B. (eds.) (1996) Advances in Case-Based Reasoning, Proc 3rd European Workshop on Case-based Reasoning, Lausanne, Switzerland, Springer-Verlag

Smyth, B., Cunninham, P. (1996), The Utility Problem Analysed: A Case-Based Reasoning Perspective. In Smith & Faltings (1996), pp. 392-399

Smyth, B., Keane, M.T. (1995), Experiments on Adaptation-Guided Retrieval In Case-Based Design. Proc 1st Intl. Conf. on Case-Based Reasoning, Sesimbra, Portugal, 1995, Veloso, M., Aamodt, A., (eds.), Springer-Verlag, pp. 313-324

Veloso, M., Carbonell, J., Perez, A., Borrajo, D., Fink, E. and Blythe, J. (1995), Integrating Planning and Learning: The PRODIGY Architecture.Journal of Theoretical and Experimental Artificial Intelligence, 7(1), 1995.