来源:F.Rossi, P.Van Beek, T. Walsh. Handbook of Constraints Programming. Elsevier, 2006.

There are three main algorithmic techniques for solving constraint satisfaction problems: backtracking search, local search, and dynamic programming. In this chapter, I survey backtracking search algorithms. Algorithms based on dynamic programming [15]—sometimes referred to in the literature as variable elimination, synthesis, or inference algorithms—are the topic of Chapter 7. Local or stochastic search algorithms are the topic of Chapter 5.

An algorithm for solving a constraint satisfaction problem(CSP) can be either complete or incomplete. Complete, or systematic algorithms, come with a guarantee that a solution will be found if one exists, and can be used to show that a CSP does not have a solution and to find a provably optimal solution. Backtracking search algorithms and dynamic programming algorithms are, in general, examples of complete algorithms. Incomplete, or non-systematic algorithms, cannot be used to show a CSP does not have a solution or to find a provably optimal solution. However, such algorithms are often effective at finding a solution if one exists and can be used to find an approximation to an optimal solution. Local or stochastic search algorithms are examples of incomplete algorithms.

Of the two classes of algorithms that are complete—backtracking search and dynamic programming—backtracking search algorithms are currently the most important in practice. The drawbacks of dynamic programming approaches are that they often require an exponential amount of time and space, and they do unnecessary work by finding, or making it possible to easily generate, all solutions to a CSP. However, one rarely wishes to find all solutions to a CSP in practice. In contrast, backtracking search algorithms work on only one solution at a time and thus need only a polynomial amount of space.

Since the first formal statements of backtracking algorithms over 40 years ago [30, 57], many techniques for improving the efficiency of a backtracking search algorithm have been suggested and evaluated. In this chapter, I survey some of the most important techniques including branching strategies, constraint propagation, nogood recording, backjumping, heuristics for variable and value ordering, randomization and restart strategies, and alternatives to depth-first search. The techniques are not always orthogonal and sometimes combining two or more techniques into one algorithm has a multiplicative effect (such as combining restarts with nogood recording) and sometimes it has a degradation effect (such as increased constraint propagation versus backjumping). Given the many possible ways that these techniques can be combined together into one algorithm, I also survey work on comparing backtracking algorithms. The best combinations of these techniques result in robust backtracking algorithms that can now routinely solve large, hard instances that are of practical importance.

4.1 Preliminaries

In this section, I first define the constraint satisfaction problem followed by a brief review of the needed background on backtracking search.

Definition 4.1 (CSP). A constraint satisfaction problem (CSP) consists of a set of variables, X = {x1, . . . , xn}; a set of values, D = {a1, . . . , ad}, where each variable xi ∈ X has an associated finite domain dom(xi) ⊆ D of possible values; and a collection of constraints.

Each constraint C is a relation—a set of tuples—over some set of variables, denoted by vars(C). The size of the set vars(C) is called the arity of the constraint. A unary constraint is a constraint of arity one, a binary constraint is a constraint of arity two, a non-binary constraint is a constraint of arity greater than two, and a global constraint is a constraint that can be over arbitrary subsets of the variables. A constraint can be specified intensionally by specifying a formula that tuples in the constraint must satisfy, or extensionally by explicitly listing the tuples in the constraint. A solution to a CSP is an assignment of a value to each variable that satisfies all the constraints. If no solution exists, the CSP is said to be inconsistent or unsatisfiable.

As a running example in this survey, I will use the 6-queens problem: how can we place 6 queens on a 6 × 6 chess board so that no two queens attack each other. As one possible CSP model, let there be a variable for each column of the board {x1, . . . , x6}, each with domain dom(xi) = {1, . . . , 6}. Assigning a value j to a variable xi means placing a queen in row j, column i. Between each pair of variables xi and xj, 1≤i < j≤ 6, there is a constraint C(xi, xj), given by (xi ≠ xj) ∧ (|i − j| ≠ |xi − xj |). One possible solution is given by {x1 = 4, x2 = 1, x3 = 5, x4 = 2, x5 = 6, x6 = 3}.

The satisfiability problem (SAT) is a CSP where the domains of the variables are the Boolean values and the constraints are Boolean formulas. I will assume that the constraints are in conjunctive normal form and are thus written as clauses. A literal is a Boolean variable or its negation and a clause is a disjunction of literals. For example, the formula ¬x1∨x2∨x3 is a clause. A clause with one literal is called a unit clause; a clause with no literals is called the empty clause. The empty clause is unsatisfiable.

A backtracking search for a solution to a CSP can be seen as performing a depth-first traversal of a search tree. The search tree is generated as the search progresses and represents alternative choices that may have to be examined in order to find a solution. The method of extending a node in the search tree is often called a branching strategy, and several alternatives have been proposed and examined in the literature (see Section 4.2). A backtracking algorithm visits a node if, at some point in the algorithm’s execution, the node is generated. Constraints are used to check whether a node may possibly lead to a solution of the CSP and to prune subtrees containing no solutions. A node in the search tree is a dead end if it does not lead to a solution.

The naive backtracking algorithm (BT) is the starting point for all of the more sophisticated backtracking algorithms (see Table 4.1). In the BT search tree, the root node at level 0 is the empty set of assignments and a node at level j is a set of assignments {x1 = a1, . . . , xj = aj}. At each node in the search tree, an uninstantiated variable is selected and the branches out of this node consist of all possible ways of extending the node by instantiating the variable with a value from its domain. The branches represent the different choices that can be made for that variable. In BT, only constraints with no uninstantiated variables are checked at a node. If a constraint check fails—a constraint is not satisfied—the next domain value of the current variable is tried. If there are no more domain values left, BT backtracks to the most recently instantiated variable. A solution is found if all constraint checks succeed after the last variable has been instantiated.

Figure 4.1 shows a fragment of the backtrack tree generated by the naive backtracking algorithm (BT) for the 6-queens problem. The labels on the nodes are shorthands for the set of assignments at that node. For example, the node labeled 25 consists of the set of assignments {x1 = 2, x2 = 5}. White dots denote nodes where all the constraints with no uninstantiated variables are satisfied (no pair of queens attacks each other). Black dots denote nodes where one or more constraint checks fail. (The reasons for the shading and dashed arrows are explained in Section 4.5.) For simplicity, I have assumed a static order of instantiation in which variable xi is always chosen at level i in the search tree and values are assigned to variables in the order 1, . . . , 6.

转载于:https://www.cnblogs.com/6DAN_HUST/archive/2012/04/25/2469323.html

Handbook of Constraints Programming——Chapter4 Backtracking Search Algorithms-Preliminaries相关推荐

  1. Handbook of Constraints Programming——Chapter 22 Constraint-Based Scheduling and Planning

    转载于:https://www.cnblogs.com/6DAN_HUST/archive/2012/05/03/2480154.html

  2. Linear Programming线性规划(Introduction to Algorithms, 算法导论,CLRS)学习笔记

    Linear Programming 1. Fundamentals objective function and constraints: min/max3x1+24x2+13x3+9x4...s. ...

  3. 5.4 Penalty-Based Local Search Algorithms基于惩罚的局部搜索算法

    另一种扩展迭代改进策略的方法是,当搜索过程即将停滞在一个局部极小值时,修改该评估函数[71].这种方法也称为动态本地搜索(Dynamic Local Search, DLS)[52]. 基于惩罚的算法 ...

  4. [转载] Handbook of Constraint Programming——Chapter1 Introduction

    转载于:https://www.cnblogs.com/6DAN_HUST/archive/2012/07/13/2590716.html

  5. Beam Search 及5种优化方法

    文章目录 Beam Search 及优化 1. Review Beam Search 2. Beam Search Refinement 2.1 Hypothesis filtering 2.2 No ...

  6. 【CV-Paper 14】Selective Search for Object Recognition

    论文原文:LINK 论文年份:2013 论文被引:4498(2020/07/09) 6221(2022/03/26) 文章目录 Selective Search for Object Recognit ...

  7. COMP0037 Coursework Investigating Path Planning Algorithms

    COMP0037 Coursework 1 Term 2, 2019 "Path Planning in a Known World" Investigating Path Pla ...

  8. 集束搜索(Beam Search Algorithm )

    看计算机科学中最重要的32个算法,其中有个是集束搜索(又名定向搜索,Beam Search)--最佳优先搜索算法的优化.使用启发式函数评估它检查的每个节点的能力.不过,集束搜索只能在每个深度中发现前m ...

  9. 改进集束搜索(Refinements to Beam Search)

    来源:Coursera吴恩达深度学习课程 上篇文章介绍了基本的集束搜索(Beam Search),这篇文章我们进一步学习一些技巧,能够使算法运行的更好. 如上图,长度归一化(Length normal ...

最新文章

  1. 静态成员函数不能采用const修饰的原因
  2. 端到端训练 联合训练_曲靖两家银行举行联合军事拓展训练 献礼祖国71周年华诞...
  3. 在Linux平台上部署open***
  4. 工业用微型计算机笔记(4)~编码,寄存器,引脚
  5. 信息论-Shannon entropy-Kullback-Leibler (KL) divergence-cross-entropy
  6. CentOS7通过yum安装MySQL5.7
  7. 旅游后台管理系列——使用maven构建工程
  8. IPTV系统视频直播点播软硬件一体化方案OEM盒子
  9. 全国计算机等级考试三级网络技术知识点考点
  10. RuntimeError: Expected 4-dimensional input for 4-dimensional weight [32, 1, 5, 5]
  11. oracle 波浪号不识别,键盘波浪号“~”打不出,一直打成±,但安全模式却正常打出...
  12. 内网通过代理服务器访问高德地图服务的方法
  13. 把单元格一分为二_excel如何把一个单元格分成两个 excel单元格拆分为二行
  14. Linux rm -rf * 文件恢复记
  15. Cheapest Flights Within K Stops
  16. VUE 项目中引入外部js文件(CND引入)
  17. less与sass的区别
  18. (转)美国FBI的变态心理学测试
  19. 文本/图像截图工具hypersnap
  20. java的简单网络爬虫(爬取花瓣网的图片)

热门文章

  1. html元素垂直水平居中显示,关于css:html-元素垂直水平居中
  2. Python爬虫编程实践 Task02
  3. 我的模型有多快?——深度学习网络模型的运算复杂度、空间占用和内存访问情况计算...
  4. 常见面试算法:回归、岭回归、局部加权回归
  5. 下拉词(浏览器下拉)及手机APP端下拉联想推荐词的展示规则
  6. css3之 谜灯卡片_纯css3灯泡开关特效代码
  7. qt的qfiledialog怎么判断打开的是不是一张图片_花瓣网画板图片一键导出 设计师速来围观...
  8. java css是什么_【狂神说JAVA】CSS(通俗易懂版)
  9. java8编程开发入门 李兴华_李兴华系列--JAVA详解视频(jdk1.8)及项目实战教程
  10. Python学习入门基础教程(learning Python)--4.2.3 Python的for实现递归,(0629学习笔记)我研究出来了!...