| OCR Text |
Show CHAPTER 7 BREADTH FIRST CONSTRAINT SATISFACTION. Constraint satisfaction needs to be invoked whenever a set of constraints may be unsatisfied. A constraint can be unsatisfied because It is a new constraint, or some set of its constrained objects have been modified. The Constraint Kernels does not assume any particular method of satisfying constraints. But it is assumed that the constraint system will find all of the possible solutions for an underconstrained system. Gosling used a breadth first search to find 'good' constraint satisfaction plans which modify a minimal number of objects In the model. He did not develop a system which found all of the solutions to underconstrained systems, but adding that ability is very straightforward. Breadth first search Is presented here In detail because It provides Insights Into finding satisfaction plans and detecting cycles in constraint graphs which can be applied to the development of the depth first satisfaction plan search algorithm presented in chapter 8. Breadth first satisfaction works by constructing all constraint firing sequences of length one. Then these are extended to sequences of length two and so on until a constraint firing sequence is found which satisfies all of the constraints. This is taken as the first solution. If another solution is required, the search resumes where the first solution was found. Constraint firing sequences are maintained in a tendril data structure. A tendril of length N contains a list of unsatisfied constraints, a list of N satisfied constraints, and a list of assignment statements or bindings which are to be used to satisfy the constraints. The bind-lngs list Is a list of binding pairs of the form (Object, bpreaaion). The constraints in the list of satisfied constraints can be satisfied by applying the bindings on the binding list. - ' The initial tendril contains an en1)ty list of satisfied constraints and bindings. The unsatisfied constraints list is composed of any constraints recently added to the model and any constraints invalidated by changes to the model. The tendril is enqueued on an empty queue |