Constraint-based problem solving Model problem 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 design/choose heuristics Verify and analyze solution
Constraint-based problem solving. Model problem 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 - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Constraint-based problem solving
Model problem 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
design/choose heuristics
Verify and analyze solution
Model problem 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
design/choose heuristics
Verify and analyze solution
Constraint-based problem solving
ConstraintSatisfactionProblem
Constraint satisfaction problem
A CSP is defined by a set of variables a domain of values for each variable a set of constraints between variables
A solution is an assignment of a value to each variable that
satisfies the constraints
Example: Crossword puzzles
CSP, binary CSP, SAT, 3-SAT, ILP, ...
Model and solve in one of these languages Model in one language, translate into
another to solve
Options
Article of faith
“Constraints arise naturally in most areas of human endeavor. They are the natural medium of expression for 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
ILP
CSP binary CSP
(0,1)-ILP
CSP, binary CSP, SAT, 3-SAT, ILP, ...
Model and solve in one of these languages Model in one language, translate into
another to solve
Options
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? How computationally difficult is it to solve?
Constraint systems/languages
System LanguageILOG Solver C++ libraryCosytec CHIP C++ libraryEclipse Logic programmingOz Functional programming
Abstractions
Capture commonly occurring constraints special propagation algorithms e.g. alldifferent,
cardinality,
cumulative, ... User-defined constraints
full power of host language
CSP versus ILP
OO databases versus Relational databases C++ versus C C++ versus Fortran C++ versus Assembly language
Computational difficulty?
What is a good model depends on algorithm Choice of variables defines search space Choice of constraints defines
how search space can be reduced how search can be guided
Improving model efficiency
Given a model:
Add/remove variables, values, constraints (keep the denotation of the variables)
Use/translate to a different representation(change the denotation of the variables)
Adding redundant constraints
Improve computational efficiency of model by adding “right” constraints symmetries removed dead-ends encountered earlier in search process
Three methods: add hand-crafted constraints during modeling apply a consistency algorithm before solving learn constraints while solving
m constraints each with k variables, chosen at random each with t tuples, chosen at random
Order of magnitude curves(n
um
ber
of
const
rain
ts)
/ (n
um
ber
of
vari
able
s)
(number of tuples in constraints) / (maximum tuples)
n = 20d = 2k = 3
n = 20d = 10k = 3
n = 20d = 10k = 5
n = 20d = 2k = 5
Random 3-SAT
clauses/variables
costratio
0.25 0.9
0.5 1.5
1 2.5
2 4.2
4 31
8 33
16 38
Given start state, goal state, and actions: determine a plan (a sequence of actions)
Box1
Project: Planning
Box2Box2
Contrasts
CP philosophy/methodology emphasis on modeling, domain knowledge general purpose search algorithm
– backtracking with constraint propagation
Successful e.g., can solve practical scheduling problems
Contrasts
Planning philosophy/methodology emphasis on minimal model
– just representation of actions
special-purpose search algorithms Not as successful
has not solved many practical problems
Tradeoffs
Robust CSP model needed for each new domain can require much intellectual effort
Less work needs to be done on algorithms many general purpose constraint solvers available
CSP model of planning
State-based model model each state by a collection of variables constraints enforce valid transitions between states
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)
Action constraints model the effects of actions patterned after explanation closure axioms
State constraints variables within a state must be consistent
Improving model efficiency
Can add/remove/aggregate/decompose variables domain values constraints
Symmetric values constraints break symmetries on values variables can be
assigned Action choice constraints
break symmetries on equivalent permutations of actions
CSP model: constraints (III)
Domain constraints restrictions on original domains of variables
Capacity constraints bounds on resources
Distance constraints bounds on steps needed for a variable to change
from one value to another
Solving the CSP model
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 Properties:
forwards, backwards, or middle out planner sound, complete, guaranteed to terminate