Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics.

Slides:



Advertisements
Similar presentations
Non-Binary Constraint Satisfaction Toby Walsh Cork Constraint Computation Center.
Advertisements

Heuristic Search techniques
CSC411Artificial Intelligence 1 Chapter 3 Structures and Strategies For Space State Search Contents Graph Theory Strategies for Space State Search Using.
Distributed Constraint Optimization Problems M OHSEN A FSHARCHI.
Interactive Configuration
Greedy Algorithms.
1 Constraint Satisfaction Problems A Quick Overview (based on AIMA book slides)
1 CMSC 471 Fall 2002 Class #6 – Wednesday, September 18.
1 Finite Constraint Domains. 2 u Constraint satisfaction problems (CSP) u A backtracking solver u Node and arc consistency u Bounds consistency u Generalized.
Approximation Algorithms Chapter 14: Rounding Applied to Set Cover.
Constraint Optimization Presentation by Nathan Stender Chapter 13 of Constraint Processing by Rina Dechter 3/25/20131Constraint Optimization.
Best-First Search: Agendas
4 Feb 2004CS Constraint Satisfaction1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
1 Optimisation Although Constraint Logic Programming is somehow focussed in constraint satisfaction (closer to a “logical” view), constraint optimisation.
CPSC 322, Lecture 12Slide 1 CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12 (Textbook Chpt ) January, 29, 2010.
Constraint Satisfaction Problems
Approximation Algorithms
Chapter 5 Outline Formal definition of CSP CSP Examples
Distributed Scheduling. What is Distributed Scheduling? Scheduling: –A resource allocation problem –Often very complex set of constraints –Tied directly.
1 Contents college 3 en 4 Book: Appendix A.1, A.3, A.4, §3.4, §3.5, §4.1, §4.2, §4.4, §4.6 (not: §3.6 - §3.8, §4.2 - §4.3) Extra literature on resource.
Distributed Constraint Optimization * some slides courtesy of P. Modi
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding ILPs with Branch & Bound ILP References: ‘Integer Programming’
Constraint Satisfaction Problems
1 Constraint Programming: An Introduction Adapted by Cristian OLIVA from Peter Stuckey (1998) Ho Chi Minh City.
1 Constraint Satisfaction Problems Slides by Prof WELLING.
Decision Procedures An Algorithmic Point of View
CP Summer School Modelling for Constraint Programming Barbara Smith 1.Definitions, Viewpoints, Constraints 2.Implied Constraints, Optimization,
Constraint Satisfaction Problems (CSPs) CPSC 322 – CSP 1 Poole & Mackworth textbook: Sections § Lecturer: Alan Mackworth September 28, 2012.
Constraint Satisfaction Problems Chapter 6. Review Agent, Environment, State Agent as search problem Uninformed search strategies Informed (heuristic.
Chapter 5 Section 1 – 3 1.  Constraint Satisfaction Problems (CSP)  Backtracking search for CSPs  Local search for CSPs 2.
Computer Science CPSC 322 Lecture 13 Arc Consistency (4.5, 4.6 ) Slide 1.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
Constraint Satisfaction CPSC 386 Artificial Intelligence Ellen Walker Hiram College.
Chapter 5: Constraint Satisfaction ICS 171 Fall 2006.
CSC 423 ARTIFICIAL INTELLIGENCE Constraint Satisfaction Problems.
Explorations in Artificial Intelligence Prof. Carla P. Gomes Module 6 Binary CSP.
Chapter 5 Constraint Satisfaction Problems
Constraints and Search Toby Walsh Cork Constraint Computation Centre (4C) Logic & AR Summer School, 2002.
1 Constraint Satisfaction Problems Chapter 5 Section 1 – 3 Grand Challenge:
CHAPTER 5 SECTION 1 – 3 4 Feb 2004 CS Constraint Satisfaction 1 Constraint Satisfaction Problems.
Constraint Satisfaction Problems University of Berkeley, USA
Arc Consistency CPSC 322 – CSP 3 Textbook § 4.5 February 2, 2011.
State space representations and search strategies - 2 Spring 2007, Juris Vīksna.
G51IAI Introduction to Artificial Intelligence
1. 2 Outline of Ch 4 Best-first search Greedy best-first search A * search Heuristics Functions Local search algorithms Hill-climbing search Simulated.
Optimization in Engineering Design 1 Introduction to Non-Linear Optimization.
Contents 1 Systematic Search Guided by Local Search with Conflict-based Heuristic in N-queen problem Hyoung rae Kim Debasis Mitra Ph.D Florida Institute.
Chapter 5 Team Teaching AI (created by Dewi Liliana) PTIIK Constraint Satisfaction Problems.
1 CSC 384 Lecture Slides (c) , C. Boutilier and P. Poupart CSC384: Lecture 16  Last time Searching a Graphplan for a plan, and relaxed plan heuristics.
Chapter 5 Finite Automata Finite State Automata n Capable of recognizing numerous symbol patterns, the class of regular languages n Suitable for.
Roman Barták (Charles University in Prague, Czech Republic) ACAT 2010.
Approximation Algorithms based on linear programming.
1 Constraint Satisfaction Problems (CSP). Announcements Second Test Wednesday, April 27.
Lecture 7: Constrained Conditional Models
CSC Modeling with FD Constraints
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Computer Science cpsc322, Lecture 13
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Instructor: Vincent Conitzer
CSPs: Search and Arc Consistency Computer Science cpsc322, Lecture 12
Constraint Propagation
Computer Science cpsc322, Lecture 13
Chapter 6. Large Scale Optimization
Constraint Satisfaction Problems
Constraints and Search
Major Design Strategies
Major Design Strategies
Chapter 6. Large Scale Optimization
Presentation transcript:

Chapter 2) CSP solving-An overview Overview of CSP solving techniques: problem reduction, search and solution synthesis Analyses of the characteristics of CSPs Explanation of how these characteristics could be exploited in solving CSPs Looking at features of CSPs for solving CSPs efficiently

Soundness and completeness Definition 2-1: An algorithms is sound if every result that is returned by it is indeed a solution; in CSPs, that means any compound label which is returned by it contains labels for every variable, and this compound label satisfies all the constraints in the problem. Definition 2-2: An algorithm is complete if every solution can be found by it.

Domain specific vs. general algorithm Efficiency can be gained by encoding domain specific knowledge into the problem solver. (ex. One can find algorithms which solve N-queens problem more efficiently) Good reasons for studying general algorithms –Tailor made algorithms are costly –Tailored algorithms are limited to the problems for which they are designed –General algorithms can often form the basis for the development of specialized algorithms

Types of algorithms in CSP Three types of algorithms –Problem reduction (filtering or pre-processing) –Search (to find solutions) –Solution synthesis (bottom up building of solutions)

Problem reduction A class of techniques for transforming a CSP into problems which are hopefully easier to solve or recognizable by reducing the size of the domains and constraints. Useful when used together with search or problem synthesis methods. Definition 2-3: We call two CSPs equivalent if they have identical sets of variables and identical sets of solution tuples. Definition 2-4: A problem P=(Z,D,C) is reduced to P´=(Z´,D´,C´) if (a) P and P´ are equivalent; (b) every variable’s domain in D´ is a subset of its domain in D; and (c ) C´ is more restrictive than, or as restrictive as, C (i.e. all compound labels that satisfies C´ will satisfy C). We write the relationship between P and P´ as reduced(P,P´).

Problem reduction If constraints are seen as sets of compound labels Reducing a problem = removing elements from the constraints If constraints are seen as functions Reducing a problem = modifying the constraint functions Definition 2-5: A value in a domain is redundant if it is not part of any solution tuple.  Because the removal of them from their corresponding domains does not affect the set of solution tuples in the problem Definition 2-6: A compound label in a constraint is redundant if it is not a projection of any solution tuple.

Reduction of a problem Reason of the possibility – because the domains and constraints are specified in the problems, and that constraints can be propagated. Involvement of two possible tasks (1) removing redundant values from the domains of the variables; (2) tightening the constraints so that fewer compound labels satisfy them. Reduced problems are possibly easier for the following reasons (1) the domains of the variables in the reduced problem are no larger than the domains in the original problem. (2) the constraints of the reduced problem are at least as tight as those in the original problem.

Minimal problems Definition 2-7: A graph which is associated to a binary CSP is called a minimal graph if no domain contains any redundant values and no constraint contains any redundant compound labels. In other words, every compound label in every binary constraint appears in some solution tuples. Definition 2-8: A CSP is called a minimal problem if no domain contains any redundant values and no constraint contains any redundant compound labels. Reducing a problem to its minimal problem can be done by creating dummy constraints for all combinations of variables, and tightening each constraint to the set of compound labels. However, doing so is in general NP-hard, so most problem reduction algorithms limit their efforts to removing only those redundant values and compound labels which can be recognized relatively easily.

Simple backtracking Z: variables* time complexity= O(|D| |Z| * |C|) D: domain* space complexity= ??O(|Z| * |D|) or O(|Z|) if CompLabl is global, or O(|Z|^2) if Copied on each recursion C: constraints COMPOUND_LABEL: all the sets of variable that is marked Backtracking(Z, COMPOUND_LABEL, D, C) {if Z ={} return; pick one variable x from Z; repeat { pick one value v from Dx; Delete v from Dx; if (COMPOUND_LABEL + { } violates no constraints { Result = Backtracking(Z-{x}, COMPOUND_LABEL+{ }, D, C); if (Result  NIL) {return(Result)}; } } until (Dx  {}) return(NIL); }

Characteristics of CSP’s search space There are properties of CSPs which differentiate them from general search problems, which makes problem reduction possible in CSPs. 1)The size of the search space is finite – if we assume that the variables are ordered as x1, x2,…,xn, the number of nodes follows the formula in page 41. If the variables were ordered by their domain sizes in descending order, then the number of nodes in the search space would be maximal, upper bound. If the variables were ordered by their domain sizes in ascending order, then the number of nodes in the search space would be minimal. 2)The depth of the tree is fixed (ordered var: n, unordered: 2n) 3)Subtrees are similar – experiences in searching one subtree may be useful in searching its siblings

Problem reduction and search Characteristics of problem reduction –Pruning off search spaces that contain no solution –Reducing the size of domains of the variables * Tightening constraints potentially reduce the search space at a later stage of the search –Pruning off branches in the search space –It can be performed at any stage of the search Search –Various search strategies combine problem reduction and search in various way One often has to find a balance between the efforts made and the potential gains in problem reduction.

Figure 2.2) Search space of BT in a CSP {Z,D,C} when the variables are not ordered; Z={x,y,z}, Dx={a,b,c,d}, Dy={e,f,g}, and Dz={p,q}

Figure 2.3) Search space for a CSP {Z,D,C}, given the ordering {x,y,z}, where Z={x,y,z}, Dx={a,b,c,d}, Dy={e,f,g} and Dz={p,q}

Figure 2.4) Alternative organization of the search space for the CSP{Z,D,C} in Figure Ex2, given the ordering {z,y,x}, where Z={x,y,z}, Dx={a,b,c,d}, Dy={e,f,g} and Dz={p,q}

Choice points in searching Which variable to look at next? Which value to look at next? Which constraint to examine next? Different search space will be explored under different ordering among the variables and values. Since constraints can be propagated, the different orderings could affect the efficiency of a search algorithm. This is especially significant when a search is combined with problem reduction. For problems in which a single solution is required, search efficiency could be improved by the use of heuristics.

Backtrack-free search Definition 2-12: A search in a CSP is backtrack-free in a depth first search under an ordering of its variables if for every variable that is to be labeled, one can always find for it a value which is compatible with all the labels committed to so far.

Solution synthesis Definition 2-9: A constraint expression on a set of variables S, which we denote by CE(S), is a collection of constraints on S and its subset of variables. Definition 2-10: A constraint expression on a subset of variables S in a CSP P, denoted CE(S,P), is the collection of all the relevant constraints in P on S and its subset of variables. Ex) (Z,D,C) = (Z,D,CE(Z,(Z,D,C))) Definition 2-11: A compound label CL satisfies a constraint expression CE if CL satisfies all the constraints in CE.

Solution synthesis Search algorithms which explore multiple branches simultaneously. Problems reduction in which the constraint for the set of all variables is created, and reduced to such a set that contains all the solution tuples, and solution tuples only. The basic idea of solution synthesis is to collect the sets of all legal labels for the larger and larger sets of variables, until this is done for the set of all variables. To ensure soundness, a solution synthesis algorithm has to make sure that all illegal compound labels are removed from this set. To ensure completeness, the algorithm has to make sure that no legal compound label is removed from this set.

Naive synthesis algorithm Naive_synthesis(Z, D, C) { order the variables in Z as x 1, x 2,…,x n ; partial_solution[0] = {}; for i = 1 to n { partial_solution[i]={cl + | cl ∈ partial_solution[I-1] ⋀ vi ∈ D xi ⋀ cl+ satisfies all the constraints on variables_of(cl) + x i }; } return (partial_solution[n]); }

Characteristics of individual CSPs Problems which require single solutions are scene labelling in vision, scheduling jobs to meet deadlines, and constructive proof of the consistency of a temporal constraints network. Problems where all solutions are required are logic programming where all variable bindings are to be returned, and scheduling where all possible schedules are to be returned for comparison. Heuristics for ordering variables and values could play an important role in solving single solution problem Solution synthesis techniques are normally used to generate all solution. Problem size – The number of leaves in the search tree, |D x |^|Z|, dominates the size of the search tree. This is the most commonly used criteria for measuring the size of a problem. The type of variable affects the techniques that one can apply. Most of the techniques described in this book focus on symbolic variables. If all the variables in a problem are numbers and all the constraints are conjunctive linear inequalities, then integer programming or linear programming are appropriate tools for handling it.

Tightness of a problem Definition 2-13: A complete graph is a graph in which an edge exists between every two nodes. Definition 2-14: The tightness of a constraint C s is measured by the number of compound labels satisfying C s over the number of all compound labels on S. Definition 2-15: The tightness of a CSP is measured by the number of solution tuples over the number of all distinct compound labels for all variables.

Solutions If the environment changes dynamically (e.g. machines may break down from time to time) under such situations, near-optimal solutions are often sufficient because optimal solutions at the point when it is generated my became suboptimal very soon. Whether a problems is easier or harder to solve depends on the tightness of the problem combined with the number of solutions required. Solutions required Tightness of the problem Loosely constrainedTightly constrained Single solution required Solutions can easily be found by simple backtracking, hence such problems are easy Simple backtracking may require a lot of backtracking, hence harder compared with loose problems All solutions required More space needs to be searched, hence such problems could be harder than tightly constrained problems Less space needs to be searched, hence, given the right tools, could be easier than loosely constrained problems

Partial solutions When no solution exists, there are basically two things that one can do: –One is to relax the constraints, and –the other is to satisfy as many of the requirements as possible. The latter solution could take different meanings. It could mean labelling as many variables as possible without violating any constraints. It could also mean labelling all the variables in such a way that as few constraints are violated as possible. Furthermore, weights could be added to the labelling of each variable or each constraint violation. (1)To maximize the number of variables labelled, where the variables are possibly weighted by their importance; (2)To minimize the number of constraints violated, where the constraints are possibly weighted by their costs.