... problems in declarative modeling, a recent approach consists in using constraint satisfaction tech- .... an effective trade-off between exploration and propagation. ..... modeling. We provided some arguments and results to show that this approach is ... In proceedings of CISST'97, Las Vegas, Nevada, p120-129,. July 1997.
Constraint Satisfaction Techniques for the Generation Phase in Declarative Modeling O. Le Roux, V. Gaildrat, R. Caubet Department of Computer Science (IRIT), University of Paul Sabatier, 118 route de Narbonne, 31062 Toulouse cedex, France. Declarative modeling is an emergent research domain in computer-aided geometric design. To deal with the generation problems in declarative modeling, a recent approach consists in using constraint satisfaction techniques. After an introduction to constraint satisfaction and an overview of related works in declarative modeling, this chapter presents an object-oriented constraint solver. This generic tool is based on constraint propagation and domain reduction and supports heterogeneous parameters. It can be used in many generation systems. As an application, a declarative modeler for virtual 3D-environments planning is briefly presented.
1 Introduction Declarative modeling is a recent and emergent paradigm in the world of computer-aided design systems. A declarative modeler allows designers to produce geometric or architectural data (for example 2Dground plans, 3D-scenes or shapes, etc.) giving a high-level and natural description. Opposite the imperative geometric modeling, it requires neither a complete knowledge of the final result at start time nor to specify all numeric details. Furthermore, consistency of the description can be automatically and continuously maintained by the system. For example, logical relationships between entities resulting from the description can be preserved without additional user’s work. A declarative modeler is usually the combination of three modules [8]: • The first one is the description module. It defines the interaction language and offers the user an interface to supply its description. An intermediate layer translates the high-level description into a well-suited internal format (for example a primitive constraint graph). • The second module, called the generation module, can be considered as the kernel of the system. Its role is to produce mod-
els that match the description given by the user. The generation module must be able to generate one, several or even all the solutions if required and possible. If no solution meets the description, it can either return an error or free some constraints to give a partial solution. • The third part of a declarative modeling system is the insight module. It allows presentation, navigation and refinement of valid models to help the user choose a solution. These three main components interact in a spiral design process to progressively converge towards the expected solution [9]. Note: we only focus on the generation phase in the following of this chapter. There are mainly four approaches to deal with the generation phase problem in declarative modeling [20]: • Specific procedural approach: designed for a particular application, it can be very efficient but is not flexible and difficult to extend. • Deductive approach: it is either a rules-based system or an expert system based on an inference engine [25][26] The difficulties to build rules and their dependencies in relation to the application are the main drawbacks. • Stochastic approach: it mainly leans on genetic algorithms [15] or local search (tabu search, simulated annealing [16]), also known as metaheuristics. It is a powerful and very flexible approach but it suffers from incompleteness of related algorithms. However, when the search space is very large, it is the only available approach. See [11][23]. • Search tree approach [5][9][19]: it is a general and flexible approach, which allows a systematic exploration of search space. It can generate all the solutions either at once or in several times. Moreover, the user can control the search process by giving tree branches to prefer or to prune. For all those reasons, it is a well-suited approach to the generation problems. Search tree approach frequently leans on constraint satisfaction techniques because of expressivity of this formalism and efficiency of related algorithms.
In this chapter we only focus on the search tree approach based on constraint satisfaction because we consider it as one of the most appropriate to build a powerful and efficient generic generation tool. The chapter is organized as follows: section 2 introduces constraint satisfaction problems and classical solving techniques. Section 3 surveys constraint satisfaction-based declarative modeling systems. Section 4 describes the architecture and the main algorithms of a generic constraint solver based on constraint propagation and domain reduction. This part also insists on hotspots to make generation process efficient, like domain modeling and filtering algorithms. Finally, section 5 briefly presents an application: a 3D declarative modeler dedicated to space planning in virtual environments. Section 6 summarizes and concludes this chapter.
2 Constraint Satisfaction Problems (CSP) in a few words This section introduces basic terminology and fundamental notions about CSP. The origins of constraint satisfaction come from research in AI (search, combinatorial problems [24]) and Computer Graphics (Waltz line labeling [27]). This is now a topic of growing importance in many disciplines. Definition 1: a CSP A CSP is a tuple P = defined by: • a finite set of variables V = { v1,…vn } • a set of domains D = { D1,…Dn }, where Di is the domain associated with vi; i.e. the only authorized assignment of vi are values of Di. • a set of constraints C = { C1,… Ce }; each c∈C is a subset of the cartesian product ∏i∈V Di where Vc⊂V is the set of variables of c. Constraints restrict the combination of values that a set of variables can take. c
Each constraint can be defined:
•
extensionally, for example giving sets of authorized tuples in the case of finite domains; • intentionally, giving either a mathematical equation or a procedural method. Note: the previous definition does not involve any restriction neither on constraints arity nor on reference sets of domains (each domain of D can be finite or continuous, ordered or not, etc.). If each constraint is either unary or binary, then the CSP is said binary. A binary CSP can be depicted by a constraint graph (usually referred as a constraint network). In such a graph, each node represents a variable, and each arc represents a constraint between variables. Example 1: a very simple constraint network with four variables {v1, v2, v3, v4}. Constraints are given extensionally; i.e. the authorized tuples are enumerated. For example, (v1, v2) can take the values (0; 0) or (1; 1).
≠
V4:
{ ( 0 ; 1) ; ( 1; 0 ) }
V1:
≠
{ 0 ; 1}
V2:
= { ( 0; 0 ) ; ( 1; 1 ) }
≠
{ 0 ; 1}
{ 0 ; 1}
{ ( 0 ; 1 ); ( 1; 0 ) }
{ { 0 ; 1 }; { 1; 0 } }
V3:
{ 0 ; 1}
Fig. 1. A simple constraint network (example 1). In this example, we can notice two important points about CSP: constraints are bi-directional (arcs are not oriented) and cycles are supported ({v2, v3, v4} forms a 3-vertices cycle). Example 2: another simple CSP where constraints are given intentionally (mathematical equations). Variables: x, y Domains: x, y: integer in [-5..5] Constraints: y