E约束满足人工智能(AI)课件.ppt
- 【下载声明】
1. 本站全部试题类文档,若标题没写含答案,则无答案;标题注明含答案的文档,主观题也可能无答案。请谨慎下单,一旦售出,不予退换。
2. 本站全部PPT文档均不含视频和音频,PPT中出现的音频或视频标识(或文字)仅表示流程,实际无音频或视频文件。请谨慎下单,一旦售出,不予退换。
3. 本页资料《E约束满足人工智能(AI)课件.ppt》由用户(晟晟文业)主动上传,其收益全归该用户。163文库仅提供信息存储空间,仅对该用户上传内容的表现方式做保护处理,对上传内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(点击联系客服),我们立即给予删除!
4. 请根据预览情况,自愿下载本文。本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
5. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007及以上版本和PDF阅读器,压缩文件请下载最新的WinRAR软件解压。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 约束 满足 人工智能 AI 课件
- 资源描述:
-
1、约束满足问题约束满足问题 (CSP)Constraint Satisfaction Problems(CSP)(对于困难的决策,我们将推迟到它变得容易的时候再做决定)R&N:Chap.5我们想做些什么?我们想做些什么?搜索技术通常按照一个任意的次序对可能进行选择,一般很少有效的信息能够帮助如何进行选择 在许多问题中,状态的到达与进行选择的次序无关(“可交换”),即采取不同的次序进行选择也一样可以到达同一个状态 那能否通过选定某种适合的选择次序能够更有效的解决这些问题呢?甚至可以避免进行选择?约束传播约束传播Constraint Propagation 将一个皇后放入到一个方格里 移去所有可能攻
2、击到的方格66555565 5 5 5 5 6 7Constraint Propagation 计算每一行、每一列不会受到攻击的方格数 将一个皇后放置在有着最小数目的行或列上 再次移去可能受到攻击的所有方格3443354 3 3 3 4 5 重复前述过程Constraint Propagation432343 3 3 4 3Constraint Propagation422133 3 3 1Constraint Propagation2212 2 1Constraint PropagationConstraint Propagation211 2Constraint Propagation11
3、 Constraint Propagation我们需要些什么?我们需要些什么?后继函数与目标测试 还需要:通过约束传播(propagate the constraints)信息,比如通过对一个皇后位置的约束来影响其他皇后的位置 提前的失败测试(failure test)约束的清晰表示 约束传播算法约束满足问题约束满足问题(CSP)Constraint Satisfaction Problem(CSP)变量的集合 variables X1,X2,Xn 每一个变量Xi所有可能的取值,构成该变量的值域Di;通常Di是有限的 约束的集合 constraints C1,C2,Cp 每个约束描述了一个变量
4、子集与特定的某些值合法的结合对应关系 目标:每一个变量都得到了一个赋值,且所有的约束得到满足地图着色问题地图着色问题 7 个变量 WA,NT,SA,Q,NSW,V,T 每个变量的值域是一样的:red,green,blue 两个相邻的变量不能取相同的值:WA NT,WA SA,NT SA,NT Q,SA Q,SA NSW,SA V,Q NSW,NSW VWANTSAQNSWVTWANTSAQNSWVT8-皇后问题皇后问题 8 个变量 Xi,i=1 to 8 每个变量的值域均为:1,2,8 约束表示为如下形式:Xi=k Xj k for all j=1 to 8,j i 对角线也是相同的约束所有的
5、约束都是二进制表示Street Puzzle(课本习题课本习题5.13)12345Ni=English,Spaniard,Japanese,Italian,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,WaterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red houseThe Spaniard has a DogThe Japanese
6、is a PainterThe Italian drinks TeaThe Norwegian lives in the first house on the leftThe owner of the Green house drinks CoffeeThe Green house is on the right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks MilkThe Norwegian lives
7、 next door to the Blue houseThe Violinist drinks Fruit juiceThe Fox is in the house next to the DoctorsThe Horse is next to the DiplomatsWho owns the Zebra?Who drinks Water?Street Puzzle12345Ni=English,Spaniard,Japanese,Italian,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,W
8、aterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red houseThe Spaniard has a DogThe Japanese is a PainterThe Italian drinks TeaThe Norwegian lives in the first house on the leftThe owner of the Green house drinks CoffeeThe Green house is on th
9、e right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks MilkThe Norwegian lives next door to the Blue houseThe Violinist drinks Fruit juiceThe Fox is in the house next to the DoctorsThe Horse is next to the Diplomats i,j1,5,ij,Ni
10、 Nj i,j1,5,ij,Ci Cj.Street Puzzle12345Ni=English,Spaniard,Japanese,Italian,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,WaterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red houseThe Spaniard has a DogThe Japanese is
11、a PainterThe Italian drinks TeaThe Norwegian lives in the first house on the leftThe owner of the Green house drinks CoffeeThe Green house is on the right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks MilkThe Norwegian lives ne
12、xt door to the Blue houseThe Violinist drinks Fruit juiceThe Fox is in the house next to the DoctorsThe Horse is next to the Diplomats(Ni=English)(Ci=Red)(Ni=Japanese)(Ji=Painter)(N1=Norwegian)其余的类似,留给同学们思考(Ci=White)(Ci+1=Green)(C5 White)(C1 Green)Street Puzzle12345Ni=English,Spaniard,Japanese,Itali
13、an,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,WaterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red houseThe Spaniard has a DogThe Japanese is a PainterThe Italian drinks TeaThe Norwegian lives in the first house on
14、 the leftThe owner of the Green house drinks CoffeeThe Green house is on the right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks MilkThe Norwegian lives next door to the Blue houseThe Violinist drinks Fruit juiceThe Fox is in t
15、he house next to the DoctorsThe Horse is next to the Diplomats(Ni=English)(Ci=Red)(Ni=Japanese)(Ji=Painter)(N1=Norwegian)(Ci=White)(Ci+1=Green)(C5 White)(C1 Green)一元(unary)约束Street Puzzle12345Ni=English,Spaniard,Japanese,Italian,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,
16、WaterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red houseThe Spaniard has a DogThe Japanese is a PainterThe Italian drinks TeaThe Norwegian lives in the first house on the left N1=NorwegianThe owner of the Green house drinks CoffeeThe Green
17、house is on the right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks Milk D3=MilkThe Norwegian lives next door to the Blue houseThe Violinist drinks Fruit juiceThe Fox is in the house next to the DoctorsThe Horse is next to the
18、DiplomatsStreet Puzzle12345Ni=English,Spaniard,Japanese,Italian,NorwegianCi =Red,Green,White,Yellow,BlueDi=Tea,Coffee,Milk,Fruit-juice,WaterJi=Painter,Sculptor,Diplomat,Violinist,DoctorAi=Dog,Snails,Fox,Horse,ZebraThe Englishman lives in the Red house C1 RedThe Spaniard has a Dog A1 DogThe Japanese
19、is a PainterThe Italian drinks TeaThe Norwegian lives in the first house on the left N1=NorwegianThe owner of the Green house drinks CoffeeThe Green house is on the right of the White houseThe Sculptor breeds SnailsThe Diplomat lives in the Yellow houseThe owner of the middle house drinks Milk D3=Mi
20、lkThe Norwegian lives next door to the Blue houseThe Violinist drinks Fruit juice J3 ViolinistThe Fox is in the house next to the DoctorsThe Horse is next to the Diplomats有限有限CSP vs.无限无限CSPFinite vs.Infinite CSP 有限CSP:每个变量的值域有有限个值 无限CSP:一些或所有的变量的值域是无限的E.g.,实数线性规划:本课程只讨论有限CSPni,ni,11i,22i,0nj,nj,11j,
21、22j,0for i=1,2,.,p:a x+a x+.+a x afor j=1,2,.,q:b x+b x+.+b x bCSP 描述为搜索问题描述为搜索问题 n个变量 X1,.,Xn 合法赋值:Xi1 vi1,.,Xik vik,0 k n,即取值vi1,.,vik满足所有与变量Xi1,.,Xik有关的约束 完全赋值:k由0到n,每个变量都得到了赋值 变量值域大小为d,则有O(dn)种完全赋值 状态:合法赋值 初始状态:空赋值,即 k=0,也就是还没有变量得到赋值 状态的后继:Xi1vi1,.,Xikvik Xi1vi1,.,Xikvik,Xik+1vik+1 目标测试:k=n,即n个变
22、量都得到了赋值 4 变量 X1,.,X4 令节点N的合法赋值为:A=X1 v1,X3 v3 以为变量X4取值为例 令X4 的值域为 v4,1,v4,2,v4,3 A的后继为以下赋值中的合法赋值:X1 v1,X3 v3,X4 v4,1 X1 v1,X3 v3,X4 v4,2 X1 v1,X3 v3,X4 v4,3 回溯搜索回溯搜索Backtracking Search本质即使用递归的简化深度优先算法回溯搜索回溯搜索(3 变量变量)赋值 Assignment=赋值 Assignment=(X1,v11)X1v11回溯搜索回溯搜索(3 变量变量)赋值 Assignment=(X1,v11),(X3,
23、v31)X1v11v31X3回溯搜索回溯搜索(3 变量变量)赋值 Assignment=(X1,v11),(X3,v31)X1v11v31X3X2假设没有一个X2的取值能构成合法赋值于是,搜索算法回溯到前一个变量(X3)并尝试另外的赋值回溯搜索回溯搜索(3 变量变量)赋值 Assignment=(X1,v11),(X3,v32)X1v11X3v32v31X2回溯搜索回溯搜索(3 变量变量)赋值 Assignment=(X1,v11),(X3,v32)X1v11X3v32X2假设仍然没有一个X2的取值能构成合法赋值搜索算法回溯到前一个变量(X3)并尝试另外的赋值。但假设X3只有两个可能的取值。于
展开阅读全文