资源简介
人工智能.zip

代码片段和文件信息
#include
#include
#include
#include
#include
using namespace std;
struct Node{ //定义搜索树节点
int node[3][3];
int h g f;
int father;
};
vector open;
int minOpenEvaluate = 100;
vector close;
int minCloseEvaluate = 100;
stack solutionPath;
vector::iterator itor;
vector test;
int dx[4] = {0 0 1 -1};
int dy[4] = {1 -1 0 0};
const int METHOD = 1;
void inputNode(Node *n);
void outputNode(Node n);
int getEvaluate(Node n);
int evaluate(Node n);
int evaluate1(Node n);
int evaluate2(Node n);
int evaluate3(Node n);
bool compare(Node a Node b);
int ifInOpen(Node n);
int ifInClose(Node n);
bool comp(const Node &a const Node &b);
bool ifNoSolution(Node n);
int getFatherStatus(int fatherIndex);
int main()
{
Node start;
int nodesCount = 1;
inputNode(&start);
if(ifNoSolution(start)){
cout << “This status has no solution.\n“;
return 0;
}
start.father = -1;
start.h = getEvaluate(start);
start.g = 0;
start.f = start.g + start.h;
if(start.f < minOpenEvaluate){
minOpenEvaluate = start.f;
}
open.push_back(start);
int terminateStatus = -2;
while(!open.empty()){
Node current = open[0];
cout<<“---------------------------\n“;
outputNode(current);
cout << “g:“ << current.g << “ --- h:“ << current.h << endl;
cout << “sum:“ << evaluate3(current) << endl;
if(current.h == 0){
terminateStatus = current.father;
break;
}
itor = open.begin();
open.erase(itor);
close.push_back(current);
if(current.f < minCloseEvaluate){
minCloseEvaluate = current.f;
}
int zeroX zeroY;
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
if(!current.node[i][j]){
zeroX = i;
zeroY = j;
break;
}
}
}
int fatherStatus = getFatherStatus(current.father);
int fatherX = fatherStatus / 10;
int fatherY = fatherStatus % 10;
for(int i = 0; i < 4; i++){
Node tmp;
int nextZeroX = zeroX + dx[i] nextZeroY = zeroY + dy[i];
if(fatherStatus >= 0 && nextZeroX == fatherX && nextZeroY == fatherY){
continue;
}
if(nextZeroX < 0 || nextZeroX > 2 || nextZeroY < 0 || nextZeroY > 2){
continue;
}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 3; j++){
if (i == zeroX && j == zeroY){
tmp.node[i][j] = current.node[nextZeroX][nextZeroY];
}
else if(i == nextZeroX && j == nextZeroY){
tmp.node
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2019-09-18 14:20 人工智能\
文件 51712 2019-01-07 19:31 人工智能\2007AI (1).doc
文件 107408 2019-01-07 19:31 人工智能\2009试卷人工智能 (1).pdf
目录 0 2019-01-25 19:56 人工智能\大作业\
目录 0 2019-03-02 21:41 人工智能\大作业\3016216046-柳鹏凯-课程实践\
文件 345509 2018-12-15 20:17 人工智能\大作业\3016216046-柳鹏凯-课程实践\3016216046-柳鹏凯.docx
文件 99984 2018-12-17 20:33 人工智能\大作业\3016216046-柳鹏凯-课程实践\system.pl
文件 1986 2018-12-14 22:54 人工智能\大作业\3016216046-柳鹏凯-课程实践\wolf_goat.pl
文件 725842 2019-01-08 10:13 人工智能\大作业\3016216046-柳鹏凯-课程实践\课程实践-3016216046-柳鹏凯.pdf
文件 168212 2018-12-11 20:12 人工智能\大作业\Prolog语言的开发与研究.pdf
文件 554464 2018-12-11 19:48 人工智能\大作业\Prolog语言的特点及其编程技术.pdf
文件 194524 2018-12-11 19:45 人工智能\大作业\人工智能语言——PROLOG.pdf
目录 0 2018-12-15 20:18 人工智能\大作业\八数码资料\
文件 9595 2018-12-15 19:31 人工智能\大作业\八数码资料\eight_puzzle.cpp
文件 71913 2018-12-15 20:16 人工智能\大作业\八数码资料\人工智能实践.docx
文件 536839 2018-12-11 19:49 人工智能\大作业\基于VC_和Prolog语言混合编程的专家系统框架_陈慧萍.pdf
文件 827773 2018-12-11 19:52 人工智能\大作业\新颖的人工智能语言_PROLOG_高全泉.pdf
文件 725842 2019-01-06 20:34 人工智能\大作业\课程实践-3016216046-柳鹏凯.pdf
目录 0 2019-01-25 19:56 人工智能\大作业\过河问题资料\
文件 99538 2018-12-14 19:18 人工智能\大作业\过河问题资料\AI_lab2_part2_文档.docx
文件 131607 2018-12-14 19:30 人工智能\大作业\过河问题资料\Lab2 Symbolism.pdf
文件 297272 2018-12-14 23:03 人工智能\大作业\过河问题资料\Part1 文档.docx
文件 67072 2018-12-12 22:32 人工智能\大作业\过河问题资料\人工智能实验报告.doc
文件 2859380 2018-12-15 20:19 人工智能\大作业.zip
文件 160 2019-09-18 14:21 人工智能\注意.txt
目录 0 2019-01-25 19:56 人工智能\知识表示作业\
文件 417419 2018-12-09 17:36 人工智能\知识表示作业\关于知识表示的讨论.pdf
文件 34936 2018-12-10 01:36 人工智能\知识表示作业\未命名文件(1).png
文件 4386 2018-12-09 23:42 人工智能\知识表示作业\未命名文件.png
文件 284522 2018-12-10 01:41 人工智能\知识表示作业\知识表示-3016216046-柳鹏凯.docx
文件 336066 2018-12-10 01:41 人工智能\知识表示作业\知识表示-3016216046-柳鹏凯.pdf
............此处省略3个文件信息
- 上一篇:数据恢复破解版电脑U盘
- 下一篇:电磁场与电磁波 第四版 谢处方.pdf
相关资源
- SpringMVC文件上传与的实现.rar
- PID_AutoTune_v0.rar
- vspd7.2.308.zip
- 价值2k的H漫画小说系统
- Pythonamp;课堂amp;笔记(高淇amp;400;集第
- ddos压力测试工具99657
- UML建模大全
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- FTP课程设计(服务端+客户端)
- 计算机图形学 边填充算法实现代码
- 电力系统潮流计算程序集合
- oracle数据迁移项目实施方案
- Web Api 通过文件流 文件到本地
- Visio图标-最新最全的网络通信图标库
- Spire API文档
- OpenGL参考手册
- Python中Numpy库最新教程
- SPD博士V5.3.exe
- 直流无刷电机方波驱动 stm32 例程代码
- layui后台管理模板
- 仿知乎界面小程序源代码
- 云平台-阿里云详细介绍
- photoshop经典1000例
- scratch垃圾分类源码(最终版本).sb
- IAR ARM 7.8破解
- TI CCS V5.4 安装步骤及破解文件
- 松下plc FP-XH的驱动
- 局域网硬件信息收集工具
评论
共有 条评论