Chapter 2) CSP solving-An overview.ppt

上传人:progressking105 文档编号:379652 上传时间:2018-10-09 格式:PPT 页数:25 大小:382.50KB
下载 相关 举报
Chapter 2) CSP solving-An overview.ppt_第1页
第1页 / 共25页
Chapter 2) CSP solving-An overview.ppt_第2页
第2页 / 共25页
Chapter 2) CSP solving-An overview.ppt_第3页
第3页 / 共25页
Chapter 2) CSP solving-An overview.ppt_第4页
第4页 / 共25页
Chapter 2) CSP solving-An overview.ppt_第5页
第5页 / 共25页
亲,该文档总共25页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

1、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,Soundne

2、ss 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

3、-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 gener

4、al 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 p

5、re-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 togeth

6、er 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 variables domain in D is a subs

7、et 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 = removin

8、g elements from the constraints If constraints are seen as functions Reducing a problem = modifying the constraint functionsDefinition 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

9、 solution tuples in the problemDefinition 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.Inv

10、olvement 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 larg

11、er 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 con

12、straint 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.Reduc

13、ing 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 red

14、undant 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|) orO(|Z|) if CompLabl is global, orO(|Z|2) if Copied on each recursion C: constraints COMPOUND_LABEL: all the set

15、s 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 constraintsResult = Backtracking(Z-x, COMPOUND_LABEL+, D, C);if (Result NIL) return(Result); until (Dx)return(

16、NIL); ,Characteristics of CSPs search space,There are properties of CSPs which differentiate them from general search problems, which makes problem reduction possible in CSPs. 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

17、 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

18、minimal. The depth of the tree is fixed (ordered var: n, unordered: 2n) 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

19、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 On

20、e 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

21、=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 CSPZ,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 cons

22、traint 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 proble

23、m 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 la

24、beled, 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 con

25、straint 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 constr

26、aints 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

27、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,

28、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 x1, x2,xn;partial_solution0 = ;for i = 1 to npartial_solutioni=cl + | cl partial_solutionI-1 vi Dxi cl+ satisfies all the constraints o

29、n variables_of(cl) + xi;return (partial_solutionn); ,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

30、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

31、 are normally used to generate all solution. Problem size The number of leaves in the search tree, |Dx|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 t

32、echniques 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 com

33、plete graph is a graph in which an edge exists between every two nodes.Definition 2-14: The tightness of a constraint Cs is measured by the number of compound labels satisfying Cs over the number of all compound labels on S. Definition 2-15: The tightness of a CSP is measured by the number of soluti

34、on 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 generate

35、d 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.,Partial solutions,When no solution exists, there are basically two things that one can do: One is to relax the constraints, and the

36、 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

37、as possible.Furthermore, weights could be added to the labelling of each variable or each constraint violation. To maximize the number of variables labelled, where the variables are possibly weighted by their importance; To minimize the number of constraints violated, where the constraints are possibly weighted by their costs.,

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 教学课件 > 大学教育

copyright@ 2008-2019 麦多课文库(www.mydoc123.com)网站版权所有
备案/许可证编号:苏ICP备17064731号-1