并行博弈树搜索算法-第2篇 博弈过程的抽象:MinMax方法

博弈论中的MinMax搜索算法 阅读详情

2.1   Min-Max方法

假设在博弈过程中,对抗者1总是选择使得博弈值最小的移动,那么作为对手的对抗者2则总会选择是的博弈值最大的移动,对抗者1称为min,对抗者2称为max.由于博弈双方是交替移动的,所以博弈树的结点及其父结点分属于两个对抗者中的一个,他们的种类(type)分属max和min.博弈树上的每个结点对应于一个深度(depth),叶结点的深度为0.因此,在任意的结点node,对博弈双方均最优的博弈值为[3]:


由此,很自然地得出Min-Max算法,用来求出满足一些条件的二人零和博弈问题的博弈值:

MiniMax(node)
1:	if node.depth = 0 then
2:		return Evaluate(node)
3:	if node.type = max then
4:		score ← -∞
5:	else
6:		score ← +∞
7:	for i ← 1 to node.branch.length
8:		new_node ← Traverse(node, node.branch[i])
9:		value ← MiniMax(new_node)
10:		if node.type = max then
11:			if value > score then
12:				score ← value
13:		else
14:			if value < score then
15:				score ← value
16:	return score
 上述伪代码中,结点node各自的有种类(max或者min结点),分支(branch).Evaluate()函数就是叶结点的估值函数.Traverse()函数用于产生node的第i个分支(node.branch[i]).

Min

3.2 博弈树与极小化极大算法(Minimax) 博弈树是描述博弈过程中所有可能状态的树形结构,包含以下要素:根节点(Root):初始游戏状态(如棋盘的初始布局)。内部节点(Internal Node):中间决策点,表示玩家需要选择动作的位置。边(Edge):玩家的动作(如移动棋子、落子)。叶子节点(Leaf):终局状态,标注每个玩家的收益值(Utility)。 3. 博弈树的特性 完全性:覆盖所有可能的动作路径。对称性:若多个路径导致相同状态,可合并节点(但通常不合并以简化实现)。深度:树的层数等于最大动作步数(如井字棋最多9步)。对抗性 阅读详情

相关推荐

Python实现博弈树minmax补全与α-β剪枝算法脚本简介

使用Python编程实现博弈树的构建,实现利用MinMax方法补全博弈树缺失值,并结合α-β剪枝算法,实现博弈树的剪枝。实现了整体算法与博弈树的可视化。利用Python编程实现了α-β剪枝算法,并利用matplotlib实现了博弈树的可视化。

qq_50838982的博客 3487

别再死记硬背了!通过三子棋MinMax算法,彻底搞懂博弈树与递归

本文通过三子棋MinMax算法深入解析博弈树与递归的设计原理,帮助读者理解AI决策过程。从构建博弈树到实现MinMax算法,再到优化技术如Alpha-Beta剪枝,全面展示了如何将理论应用于实践,打造智能棋类AI。

weixin_42561040的博客 209

用游戏学AI:从Pong到Connect 4的实战教学架构

机器学习入门常陷于概念抽象与反馈延迟的双重困境,而游戏化学习通过目标明确、即时反馈、适度挑战的闭环机制,显著提升认知效率与知识留存率。其核心在于将强化学习、搜索算法等原理具象为可调试、可对战、可量化的代码实践,如Pong中的状态-动作-奖励建模,或Connect 4里的位图表示与Alpha-Beta剪枝优化。这种‘先跑通、再优化、后拆解’的路径,天然融合工程思维与理论理解,支撑学员快速迁移至推荐系统、机器人控制等真实场景。本文聚焦Delta Academy验证的四层教学架构,详解如何以游戏为沙盒,构建扎实、

cunbei2644的博客 671

计算机博弈 基本算法 极大极小算法

计算机博弈大赛中最基础的算法就是极大极小算法,下面总结MaxMin算法 预备知识: 广度优先搜索(BFS) 深度优先搜索(DFS) 介绍 MaxMin算法在有限深度的范围内进行搜索,假定博弈双方都是聪明的,也就是每次都会选择可能获胜的最大值。那么对于我方来说,对方每次都会选取使我方获胜的最小值MIN;我方会选择使我方获胜的最大值MAX。 “值”的数字,由最后一层状态的评估函数f§确定,评估函数。 定义: MAX与MIN分别代表博弈双方。 p代表一个棋局状态 f§表示评估函数 过程: 当父状态为MIN时,那么

刘文凯的博客 3315

Math tricks-min max的顺序问题

min /max的顺序问题,常见的都是 诺伊曼的min max或者是 Simon 的minimax theroem 这里只是标记一下,并不详细推导, 主要解释 https://blog.youkuaiyun.com/qq_30074301/article/details/98727110 中 的推导问题 简化为: max⁡t{ϕ1(t)−max⁡kmin⁡tϕ(k,t)}=max⁡t{ϕ1(t)−max⁡kϕ...

qq_30074301的博客 966

Minimax博弈算法设计井字棋AI(Golang)

minimax井字棋Go语言

qq_22328011的博客 3748

第1关:AlphaBeta剪枝算法求解博弈树最优选择

第1关:AlphaBeta剪枝算法求解博弈树最优选择

Martin-share的博客 1654

BCM-BCP-DRP-运维管理之故障管理——故障的分类与处理流程

ITSM Business Continuity Manage(BCM) BusinessContinuityPlan(BCP) 偏业务 DisasterRecoveryPlan(DRP) 偏IT 天塌了,考虑在天塌了的状态下做什么,怎么开展业务就是BCP; 天塌了,考虑怎么把天撑回去,就是DRP。 DRP+BCP+供应链管理+危机管理等就是BCM (业务连续性管...

mmgithub123的博客 2722

UG NX与PLC-1500的在环虚拟测试

TIA、PLCSIM、NetToPLCsim、KEPServerEX以及UG NX的在环虚拟测试

lvtlvtlvtlvt的博客 4220

SAP数据导入工具(LSMW) 超级详细教程(批量导入内部订单)

用户提了个需求,让我批量导入内部订单几百个内部订单。我本打算用写段ABAP 代码来调用 BAPI (BAPI_INTERNALORDER_CREATE)就可以了。但想到我很久没有用过LSMW 了,都快要忘记了。于是我采用LSMW的方式,完成了任务。并把过程记录下来,形成教程方便我以后回头查看,分享出来也希望对大家有帮助。

IT小职员 2万+

Transformer时序预测避坑指南:TFT在风电场的5个实战经验

本文分享了Temporal Fusion Transformer在风电场功率预测中的五个实战经验,涵盖数据预处理、模型调优、显存优化、注意力机制解读及在线部署。针对风电数据噪声大、概念漂移等挑战,提供了从构建数据质量标签到高效超参调优的具体方案,并强调利用Transformer架构的可解释性进行业务洞察,助力实现稳健的工业级时序预测。

bert9linguist的博客 462

DCM07-诊断服务EcuReset ($11 )的配置和实现

文章目录1 诊断服务EcuReset ($11 )1.1 概述1.2 诊断模式声明组1.3 代码实现1.4 配置参数 传送门 ==>> AutoSAR实战系列300讲「糖果Autosar」总目录 1 诊断服务EcuReset ($11 ) 1.1 概述 该服务实现了 ECU 内的复位功能,协议的具体理论讲解请参考「FlashBootloader03【电控单元复位服务($11)】」。在接收到UDS 服务 0x11 的请求时,DCM 模块应触发 ModeDeclarationGroupPrototy

2064

Pytorch CIFAR10图像分类 EfficientNet v1篇

EfficientNet源自Google Brain的论文EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks. 从标题也可以看出,这篇论文最主要的创新点是. 论文提出了,混合缩放,把网络缩放的三种方式:深度、宽度、分辨率,组合起来按照一定规则缩放,从而提高网络的效果。EfficientNet在网络变大时效果提升明显,把精度上限进一步提升,成为了当前最强网络。

风信子的猫Redamancy的快乐星球 1852

高级数据库--作业及答案

中科大金培权老师的高级数据库课程作业及答案

一杯水果茶!足矣~ 1658

【2026最新版】python点云处理算法汇总(长期更新版)

python点云处理算法整理。博客长期更新,最近一次更新时间为:2026年10月4日。

点云侠的博客 42万+

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

上一篇: 并行博弈树搜索算法-第1篇 什么是博弈树搜索算法
下一篇: 并行博弈树搜索算法-第4篇 更上一层楼:Alpha-Beta算法的改进
存储李希
博客等级 码龄15年 418粉丝 69原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值