AI基础 L15 Constraint Satisfaction Problems III约束满足问题

news2024/9/25 15:27:07

Local Search for CSPs

Local search algorithms use a complete-state formulation where:
— each state assigns a value to every variable, and
— the search changes the value of one variable at a time

• Min-conflicts heuristic: value that results in the minimum number of conflicts with
other variables that brings us closer to a solution.
— Usually has a series of plateaus
• Plateau search: allowing sideways moves to another state with the same score.
— can help local search find its way off the plateau.
• Constraint weighting aims to concentrate the search on the important constraints
— Each constraint is given a numeric weight, initially all 1.
— weights adjusted by incrementing when it is violated by the current assignment

• Min-conflicts heuristic: value that results in the minimum number of conflicts with
other variables that brings us closer to a solution.c

通过选择冲突最少的变量值来逐步接近解决方案
— Usually has a series of plateaus

“plateaus” 指的是解空间中的一片区域,在这片区域内,目标函数(例如冲突数量)的变化非常小或者没有变化。可能会导致算法收敛到一个局部最优解而不是全局最优解。

Problem structure

• Tasmania and mainland are independent subproblems
• Identifiable as connected components of constraint graph

• Suppose each subproblem has c variables out of n total
• Worst-case solution cost is n/c · dc, linear in n
E.g. n = 80, d = 2, c = 20
280 = 4 billion years at 10 million nodes/sec
4 · 220 = 0.4 seconds at 10 million nodes/sec

Tree-structured CSPs

• Theorem: if the constraint graph has no loops, the CSP can be solved in O(nd**2) time

即约束图是一个树 CSP    O(nd**2)
• Compare to general CSPs, where worst-case time is O(d**n)
• This property also applies to logical and probabilistic reasoning: an important example of the relation between syntactic restrictions and the complexity of reasoning.

  • 句法限制:在树状结构的CSP中,句法限制是指约束图没有环。这种结构限制了变量之间约束的方式。
  • 推理复杂性:句法限制可以显著降低推理的复杂性。在树状结构中,由于没有环,我们可以从树的叶子节点开始,向上逐层解决约束,而不需要考虑变量之间的循环依赖。

 Algorithm for tree-structured CSPs

1 Choose a variable as root, order variables from root to leaves such that every node’s parent precedes it in the ordering 选择一个变量为root 排序时父节点要在子节点之前

 2 For j from n down to 2, apply RemoveInconsistent(Parent(Xj ), Xj )

  • 从n递减到2:从最后一个变量开始,向上遍历到第二个变量。
  • RemoveInconsistent:这个操作会移除变量Xj的域中所有与它的父节点Parent(Xj)不一致的值。也就是说,如果某个值与Parent(Xj)的当前值冲突,那么这个值就不会被考虑为Xj的可能值。

3 For j from 1 to n, assign Xj consistently with Parent(Xj )

  • 在修剪完域之后,开始为每个变量分配值。
  • 从1到n:从第一个变量开始,向下遍历到最后一个变量。
  • 按一致的方式分配:对于每个变量Xj,选择一个值(如果可能的话),这个值与它的父节点Parent(Xj)的值是一致的。这意味着选择的值不会违反与父节点的约束。

Nearly tree-structured CSPs 

Conditioning: instantiate a variable, prune its neighbous’ domains

Cutset conditioning: instantiate (in all ways) a set of variables such that the remaining
constraint graph is a tree
Cutset size c ⇒ runtime , very fast for small c

  • 条件化(Conditioning)

  • 实例化一个变量

    • 在CSP中选择一个变量,并为其分配一个具体的值(实例化)。
  • 修剪其邻居的域

    • 一旦一个变量被实例化,就需要更新与该变量有约束关系的其他变量(邻居)的域。具体来说,就是移除那些与已实例化变量值冲突的值。
    • 割集条件化(Cutset Conditioning)

    • 实例化一组变量

      • 选择CSP中的一组变量,并为这些变量分配所有可能的值组合(即穷举所有可能的实例化方式)。
    • 使得剩余的约束图成为一棵树

      • 通过实例化这组变量,目的是移除约束图中的所有环,使得剩余的变量形成一个树状结构。
  • 割集大小 c

    • 割集是指为了将图转换为树而被实例化的变量集合的大小。

Iterative algorithms for CSPs

 • Hill-climbing, simulated annealing typically work with “complete” states, i.e., all variables assigned
• To apply to CSPs:
— allow states with unsatisfied constraints
— operators reassign variable values
• Variable selection: randomly select any conflicted variable
• Value selection by min-conflicts heuristic:
— choose value that violates the fewest constraints
— i.e., hillclimb with h(n) = total number of violated constraints

CSP Summary

• CSPs are a special kind of problem:
— states defined by values of a fixed set of variables
— goal test defined by constraints on variable values
• Backtracking = depth-first search with one variable assigned per node
• Variable ordering and value selection heuristics help significantly
• Forward checking prevents assignments that guarantee later failure
• Constraint propagation (e.g., arc consistency) does additional work to constrain
values and detect inconsistencies
• Local search using the min-conflicts heuristic has also been applied to constraint
satisfaction problems with great success
• The CSP representation allows analysis of problem structure
• Tree-structured CSPs can be solved in linear time
• CSPs still beat the most advanced ML methods for most optimization tasks
 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2121415.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

IEC103设备数据 转 IEC61850项目案例

目录 1 案例说明 1 2 VFBOX网关工作原理 1 3 准备工作 2 4 配置VFBOX网关采集103设备数是 2 5 用IEC61850协议转发数据 4 6 网关使用多个逻辑设备和逻辑节点的方法 6 7 IEC103协议说明 8 8 案例总结 9 1 案例说明 设置网关采集IEC103设备数据把采集的数据转成IEC61850协议转发…

三.海量数据实时分析-FlinkCDC实现Mysql数据同步到Doris

FlinkCDC 同步Mysql到Doris 参考:https://nightlies.apache.org/flink/flink-cdc-docs-release-3.0/zh/docs/get-started/quickstart/mysql-to-doris/ 1.安装Flink 下载 Flink 1.18.0,下载后把压缩包上传到服务器,使用tar -zxvf flink-xxx…

华为认证 vs 红帽认证 怎么选?有什么区别?

随着技术的日新月异,IT认证成为衡量个人技能和专业知识的重要标准。在众多认证中,华为认证和红帽认证以其权威性和实用性,成为业界颇具含金量的标杆。华为认证,作为华为推出的认证,是网络技术领域的权威认证之一&#…

vscode 中使用 yarn 出错

问题 vscode 中使用 yarn 爆红,类似下图的错误: 原因 由于vscode中的集成终端使用的是powershell,所以需要设置下该权限才能正常使用yarn 解决 找到 powershell,以管理身份运行 输入:set-ExecutionPolicy Remot…

MySQL系列—8.物理结构

目录 1.系统表空间 ibdata 2.通用表空间 .ibd 3.独立表空间 4.Undo 表空间 5.临时表空间 6.Redo Log File 1.系统表空间 ibdata 系统表空间由参数innodb_data_file_path定义路径、初始化大小、自动扩展策略 如: innodb_data_file_path/dayta/mysql/ibdata1:…

感恩 各位老师们!和滋养你的人在一起,确实很重要——早读(逆天打工人爬取热门微信文章解读)

感恩 各位老师们 引言Python 代码第一篇 洞见 和滋养你的人在一起,确实很重要第二篇 一天 风云突变结尾 (不是 现在网上在呢么各种图都有 哈哈哈) 引言 今天是什么特殊的日子吗? 没错 教师节 说起这个教师节 我觉得大家更要记住…

【北京迅为】《STM32MP157开发板使用手册》-第十九章 Yocto系统开发

iTOP-STM32MP157开发板采用ST推出的双核cortex-A7单核cortex-M4异构处理器,既可用Linux、又可以用于STM32单片机开发。开发板采用核心板底板结构,主频650M、1G内存、8G存储,核心板采用工业级板对板连接器,高可靠,牢固耐…

C++——list的实现

目录 0.前言 1.节点类 2.迭代器类 ①普通迭代器 ②const迭代器 ③模板迭代器 3.list类 3.1 clear、析构函数、swap ①clear ② 析构函数 ③ swap 3.2构造函数 ①无参构造 ②赋值构造 3.3 迭代器 3.4插入函数 ①insert插入 ②头插 ③尾插 3.5 删除函数…

【分治】归并排序

【分治】归并排序 1. 排序数组1. 1题目来源1.2 题目描述1.3 题目解析 2. LCR 170. 交易逆序对的总数2. 1题目来源2.2 题目描述2.3 题目解析 3. 计算右侧小于当前元素的个数3. 1题目来源3.2 题目描述3.3 题目解析 1. 排序数组 1. 1题目来源 912. 排序数组 1.2 题目描述 给你…

JAVA毕业设计171—基于Java+Springboot+vue3+小程序的宠物店小程序系统(源代码+数据库)

毕设所有选题: https://blog.csdn.net/2303_76227485/article/details/131104075 基于JavaSpringbootvue3小程序的宠物店小程序系统(源代码数据库)171 一、系统介绍 本项目前后端分离(可以改为ssm版本),分为用户、店员、管理员三种角色 1、用户&…

存储课程学习笔记1_访问scsi磁盘读写测试(struct sg_io_hdr,ioctl,mmap)

创建虚拟机时,可以选择SCSI,STAT,NVME不同类型的磁盘。 0:总结 》了解内核提供的访问scsi的结构和方法 (主要是sg_io_hdr_t 结构体和ioctl函数)。 》需要读scsi协议文档,了解相关指令,只演示了16字节固定…

华为eNSP :WLAN的配置

一、WLAN的知识点: VLAN配置: VLAN:可以想象成一个大房子(网络)里划分的不同房间(VLAN)。每个房间可以有自己的功能,比如一个用于睡觉(管理),另一…

软件工程知识点总结(5):详细设计

面向对象详细设计举例:接口描述、算法描述、数据描述 类的详细描述,内含数据、 方法及方法的参数返回值 public class User { private String userId; private String userName; private String password; private int type; public User(String userId…

基于APISIX实现API网关案例分享

一、APISIX介绍 1、定义 Apache APISIX 是一个动态、实时、高性能的云原生 API 网关。它构建于 NGINX + ngx_lua 的技术基础之上,充分利用了 LuaJIT 所提供的强大性能。 2、软件架构 2.1、架构图 APISIX 主要分为两个部分: APISIX 核心:包括 Lua 插件、多语言插件运行时…

ICM20948 DMP代码详解(12)

接前一篇文章:ICM20948 DMP代码详解(11) 上一回开始解析icm20948_sensor_setup函数的第2段代码也即inv_icm20948_init_matrix函数: /* Setup accel and gyro mounting matrix and associated angle for current board */inv_icm20…

前端技术(七)——less 教程

一、less简介 1. less是什么? less是一种动态样式语言,属于css预处理器的范畴,它扩展了CSS语言,增加了变量、Mixin、函数等特性,使CSS 更易维护和扩展LESS 既可以在 客户端 上运行 ,也可以借助Node.js在服…

关于武汉芯景科技有限公司的IIC缓冲器芯片XJ4307开发指南(兼容LTC4307)

一、芯片引脚介绍 1.芯片引脚 2.引脚描述 二、系统结构图 三、功能描述 1.总线超时,自动断开连接 当 SDAOUT 或 SCLOUT 为低电平时,将启动内部定时器。定时器仅在相应输入变为高电平时重置。如果在 30ms (典型值) 内没有变为高…

社交媒体的未来:Facebook如何通过AI技术引领潮流

在数字化时代的浪潮中,社交媒体平台不断演变,以适应用户需求和技术发展的变化。作为全球领先的社交媒体平台,Facebook在这一进程中扮演了重要角色。尤其是人工智能(AI)技术的应用,正在深刻地改变Facebook的…

Docker零基础入门

参考课程https://www.bilibili.com/video/BV1VC4y177re/?vd_source=b15169a302bee35f484245aecc69d4dd 参考书籍Docker 实践 - 面向 AI 开发人员的 Docker 实践 (dockerpractice.readthedocs.io) 1. 什么是Docker 1.1. Docker起源 随着计算机的发展,计算机上已经可以运行多…