Constraintbased problem solving n Model problem n specify
Constraint-based problem solving n Model problem ä ä ä n specify in terms of constraints on acceptable solutions define variables (denotations) and domains define constraints in some language Solve model ä define search space / choose algorithm – incremental assignment / backtracking search – complete assignments / stochastic search ä n design/choose heuristics Verify and analyze solution
Constraint-based problem solving n Model problem ä ä ä n specify in terms of constraints on acceptable solutions define variables (denotations) and domains define constraints in some language Solve model ä define search space / choose algorithm – incremental assignment / backtracking search – complete assignments / stochastic search ä n design/choose heuristics Verify and analyze solution Constraint Satisfaction Problem
Constraint satisfaction problem n A CSP is defined by äa set of variables ä a domain of values for each variable ä a set of constraints between variables n A solution is ä an assignment of a value to each variable that satisfies the constraints
Example: Crossword puzzles
Options CSP, binary CSP, SAT, 3 -SAT, ILP, . . . Model and solve in one of these languages n Model in one language, translate into another to solve n
Article of faith “Constraints arise naturally in most areas of human endeavor. They are the natural medium of expression formalizing regularities that underlie the computational and physical worlds and their mathematical abstractions. ” P. Van Hentenryck and V. Saraswat Constraint Programming: Strategic Directions
Reducibility NP-Complete 3 -SAT CSP binary CSP ILP (0, 1)-ILP
Options CSP, binary CSP, SAT, 3 -SAT, ILP, . . . Model and solve in one of these languages n Model in one language, translate into another to solve n
Importance of the model “In integer programming, formulating a ‘good’ model is of crucial importance to solving the model. ” G. L. Nemhauser and L. A. Wolsey Handbook in OR & MS, 1989 “Same for constraint programming. ” Folk Wisdom, CP practitioners
Measures for comparing models How easy is it to – write down, – understand, – modify, debug, – communicate? n How computationally difficult is it to solve? n
Constraint systems/languages
Abstractions n Capture commonly occurring constraints ä special propagation algorithms ä e. g. alldifferent, cardinality, cumulative, . . . n User-defined constraints ä full power of host language
CSP versus ILP OO databases versus Relational databases n C++ versus C n C++ versus Fortran n C++ versus Assembly language n
Computational difficulty? What is a good model depends on algorithm n Choice of variables defines search space n Choice of constraints defines n ä how search space can be reduced ä how search can be guided
Improving model efficiency Given a model: n Add/remove variables, values, constraints (keep the denotation of the variables) n Use/translate to a different representation (change the denotation of the variables)
Adding redundant constraints n Improve computational efficiency of model by adding “right” constraints ä symmetries removed ä dead-ends encountered earlier in search process n Three methods: ä add hand-crafted constraints during modeling ä apply a consistency algorithm before solving ä learn constraints while solving
Examples: n Adding hand-crafted constraints: ä n crossword puzzles Applying a consistency algorithm: ä dual representation
Adding redundant variables n Variables that are abstractions of other variables ä e. g, n decision variables Suppose x has domain {1, …, 10} Add Boolean variable to represent decisions (x < 5), (x 5) Variables that represent constraints
Translations between models n Improve computational efficiency by completely changing the model ä change denotation of variables – e. g, convert from non-binary to binary ä aggregate variables – e. g, timetabling multiple sections of a course n Not much as has been done on either theory or the practice side
Conversion to binary Any CSP can be converted into one with only binary constraints n Two techniques known n ä dual graph method (Dechter & Pearl, 1989) ä hidden variable method (Peirce, 1933; Dechter 1990) n Translations are polynomial if constraints are represented extensionally
3 -SAT example (x 1 x 2 x 6) ( x 1 x 3 x 4) ( x 4 x 5 x 6) (x 2 x 5 x 6) n Non-binary CSP: ä Boolean variables: x 1, …, x 6 ä constraints: one for each clause C 1(x 1, x 2, x 6) = {(0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)} C 2(x 1, x 3, x 4) =. . .
Dual graph representation y 1 = (x 1, x 2, x 6) x 2, x 6 x 1 y 2 = (x 1, x 3, x 4) x 4 y 4 = (x 2, x 5, x 6) x 5, x 6 y 3 = (x 4, x 5, x 6)
Hidden variable representation h 1 x 2 h 4 x 3 h 2 x 4 x 5 h 3 x 6
Hidden variable representation n Non-binary constraint: C 1(x 1, x 2, x 6) = {(0, 0, 1), (0, 1, 0), (0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1)} n Augmented constraint: C 1(x 1, x 2, x 6, h 1) = {(0, 0, 1, 0), (0, 1, 0, 1), (0, 1, 1, 2), (1, 0, 0, 3), (1, 0, 1, 4), (1, 1, 0, 5), (1, 1, 1, 6)} n Binary constraints: R 1(x 1, h 1) = {(0, 0), (0, 1), (0, 2), (1, 3), (1, 4), (1, 5), (1, 6)} R 2(x 2, h 1) = {(0, 0), (1, 1), (1, 2), (0, 3), (0, 4), (1, 5), (1, 6)} R 3(x 6, h 1) = {(1, 0), (0, 1), (1, 2), (0, 3), (1, 4), (0, 5), (1, 6)}
Dual exponentially worse x 1, x 1 x 2 x 3, . . . , x 1 … xn-1 xn FC on non-binary: consistency checks O(n) FC on dual: O(2 n) consistency checks x 1 h 1 x 2 h 2 x 3 h 3
Dual exponentially better x 1 … xn-1, x 1 … xn-2 xn, …, x 2 … xn FC on non-binary: O(n 2 n) consistency checks FC on dual: O(n 2) consistency checks x 1 h 1 x 2 h 2 x 3 h 3
Bounds on performance n Worst case: FC(non-binary) FC+(hidden) dk n Best case: FC+(hidden) FC (non-binary) dn
Crossword puzzles 1 2 3 6 7 8 10 11 12 13 14 16 17 18 21 22 2 3 15 19 20 4 5 9 a aardvark abacus abaft abalone abandon. . . Mona Lisa monarchy monarda. . . zymurgy zyrian zythum
Crossword puzzles
Crossword puzzles
Model of random non-binary CSP n n variables ä each n with domain size d m constraints ä each with k variables, chosen at random ä each with t tuples, chosen at random
(number of constraints) / (number of variables) Order of magnitude curves n = 20 d=2 k=3 n = 20 d = 10 k=3 n = 20 d=2 k=5 n = 20 d = 10 k=5 (number of tuples in constraints) / (maximum tuples)
Random 3 -SAT
Project: Planning Box 1 Box 2 n Given start state, goal state, and actions: determine a plan (a sequence of actions)
Contrasts n CP philosophy/methodology ä emphasis on modeling, domain knowledge ä general purpose search algorithm – backtracking with constraint propagation n Successful ä e. g. , can solve practical scheduling problems
Contrasts n Planning philosophy/methodology ä emphasis on minimal model – just representation of actions ä special-purpose n search algorithms Not as successful ä has not solved many practical problems
Tradeoffs n Robust CSP model needed for each new domain ä can n require much intellectual effort Less work needs to be done on algorithms ä many general purpose constraint solvers available
CSP model of planning n State-based model ä model each state by a collection of variables ä constraints enforce valid transitions between states n Example: logistics world ä variable for each package, truck, plane ä domains of packages: all locations, trucks, planes ä domains of trucks, planes: all locations
CSP model: constraints (I) n Action constraints ä model the effects of actions ä patterned after explanation closure axioms n State constraints ä variables within a state must be consistent
Improving model efficiency n Can add/remove/aggregate/decompose ä variables ä domain values ä constraints n Here: ä added hidden variables ä added redundant & symmetry-breaking constraints
CSP model: constraints (II) n Symmetric values constraints ä break symmetries on values variables can be assigned n Action choice constraints ä break symmetries on equivalent permutations of actions
CSP model: constraints (III) n Domain constraints ä restrictions n Capacity constraints ä bounds n on original domains of variables on resources Distance constraints ä bounds on steps needed for a variable to change from one value to another
Solving the CSP model n Given an instance of a planning problem ä generate a model with one step in it ä instantiate variables in the initial and goal states ä search for a solution (GAC+CBJ) ä repeat, incrementing number of steps, until plan is found n Properties: ä forwards, backwards, or middle out planner ä sound, complete, guaranteed to terminate
Experiments Five test domains from AIPS’ 98 n Five planners: n ä ä ä n CPlan Blackbox (Kautz & Selman) HSP (Bonet & Geffner) IPP (Koehler & Nebel) TLPlan (Bacchus & Kabanza) Setup: ä ä machines: 400 MHz Pentium II’s resources: 1 hour CPU time, 256 Mb memory
Gripper problems
Logistics problems
Mystery problems
Mystery. Prime problems
Grid problems
Related work n n Planning as a CSP ä satisfiability (Kautz & Selman) ä ILP (e. g. , Bockmayr & Dimopoulos) Adding declarative knowledge to improve efficiency ä hand-coded (e. g, Kautz & Selman, Bacchus & Kabanza) ä automatically derived (e. g. , Fox & Long, Nebel et al. )
Project: Resource-constrained instruction scheduling (I) a: j i + h b: k i + g c: l j + 1 n Modern architectures (VLIW) allow instruction level parallelism ä multiple n 1: a, b 2: c functional units Compiler to generate code that takes advantage of parallelism ä resource-constrained scheduling task
Project: Resource-constrained instruction scheduling (II) n Current methods: ä heuristic ä recent: n integer linear programming approach Project: ä investigate constraint programming approach ä GNU compiler, MERCED chip
Project: Theoretical analysis of alternative models n Improve computational efficiency by completely changing the model ä change denotation of variables – e. g, convert from non-binary to binary ä aggregate variables – e. g, timetabling multiple sections of a course n Not much as has been done on either theory or the practice side
Conclusions n Importance of the model ä ease of modeling is important ä form of model is important n Constraint programming advantages ä succinctness, declarativeness of models ä flexibility in specifying model ä on some classes of problems: speed
Conclusions n Advantages shared with CSP-like approaches ä expressiveness of modeling language ä declarativeness of models ä independence of model and solving algorithm n Advantages over other CSP-like approaches ä succinctness of models ä robustness: scales well, not as brittle ä speed
Future Work n Approximate planning ä heuristic CSP models ä solve same CSP models using local search n Alternative CSP models ä action-based models vs state-based models ä finding the right model can be key to solving difficult combinatorial problems
- Slides: 56