xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 7.25MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2023-10-23
  • 語(yǔ)言: Java
  • 標(biāo)簽: 八數(shù)碼??

資源簡(jiǎn)介

z1. 綜合應(yīng)用“深度優(yōu)先搜索”、“寬度優(yōu)先搜索”、“啟發(fā)式搜索”這三種人工智能搜索技術(shù)的基本知識(shí)以及程序設(shè)計(jì)的相關(guān)知識(shí)。 z2. 通過(guò)設(shè)計(jì)一個(gè)八數(shù)碼問(wèn)題求解程序,學(xué)習(xí)、了解狀態(tài)空間搜索的思想,進(jìn)一步加深對(duì)人工智能課程相關(guān)啟發(fā)式搜索的理解。 z實(shí)驗(yàn)內(nèi)容 1. 針對(duì)八數(shù)碼問(wèn)題,在Windows環(huán)境下用C/C++語(yǔ)言(Java語(yǔ)言)實(shí)現(xiàn)幾種搜索算法(最好是圖形界面): y深度優(yōu)先搜索 P23 y寬度優(yōu)先搜索 P24 y啟發(fā)式搜索算法(h1(n) =W(n) “不在位”的將牌數(shù))P28 y啟發(fā)式搜索算法(h2(n) = P(n)將牌“不在位”的距離和)P40 y啟發(fā)式搜索算法(h3(n) = h(n)=P(n)+3S(n)) P46 2. 隨機(jī)產(chǎn)生或手動(dòng)輸入初始狀態(tài),對(duì)于同一個(gè)初始狀態(tài),分別用上面的5種方法進(jìn)行求解,并對(duì)比結(jié)果

資源截圖

代碼片段和文件信息

#include“8puzzle.h“
?





//主函數(shù)
int?main(){
eightdigit?e;
e.init();
return?0;
}


//查找空格位置
int?eightdigit::findpos(int?a){
int?pos?=?9;
while?(a?%?10?!=?0){
pos--;
a?/=?10;
}
return?pos;
}

//下移操作
int?eightdigit::mDown(int?a?int?pos){
if?(pos?>=?7)?return?0;//表明空格在第三一行,不能下移,返回0
int?b?=?a?/?p[pos?+?3];
b?=?b?%?10;????????????//空格下面的數(shù)碼位置為pos+3,找出對(duì)應(yīng)位置的數(shù)碼值b
a?-=?b?*?p[pos?+?3];???//移動(dòng)空格0到位置pos+3
a?+=?b?*?p[pos];???????//移動(dòng)數(shù)碼值b到位置pos
if?(exist[a]?==?0)????
return?a;??????????//如果是新?tīng)顟B(tài),返回該狀態(tài)a,否則返回0
else?return?0;
}

//上移操作
int?eightdigit::mUp(int?a?int?pos){
if?(pos?<=?3)?return?0;//表明空格在第一行,不能上移,返回0
int?b?=?a?/?p[pos?-?3];
b?=?b?%?10;????????????//空格上面的數(shù)碼位置為pos-3,找出對(duì)應(yīng)位置的數(shù)碼值b
a?-=?b?*?p[pos?-?3];???//移動(dòng)空格0到位置pos-3
a?+=?b?*?p[pos];???????//移動(dòng)數(shù)碼值b到位置pos
if?(exist[a]?==?0)
return?a;??????????//如果是新?tīng)顟B(tài),返回該狀態(tài)a,否則返回0
else?return?0;
}

//左移
int?eightdigit::mLeft(int?a?int?pos){
if?(pos?%?3?==?1)?return?0;//表明空格在第一列,不能左移,返回0
int?b?=?a?/?p[pos?-?1];????
b?=?b?%?10;????????????????//空格左面的數(shù)碼位置為pos-1,找出對(duì)應(yīng)位置的數(shù)碼值b
a?-=?b?*?p[pos?-?1];???????//移動(dòng)空格0到位置pos-1
a?+=?b?*?p[pos];???????????//移動(dòng)數(shù)碼值b到位置pos
if?(exist[a]?==?0)?????????
return?a;??????????????//如果是新?tīng)顟B(tài),返回該狀態(tài)a,否則返回0
else?return?0;
}

//右移
int?eightdigit::mRight(int?a?int?pos){
if?(pos?%?3?==?0)?return?0;//表明空格在第三列,不能右移,返回0
int?b?=?a?/?p[pos?+?1];????
b?=?b?%?10;????????????????//空格右面的數(shù)碼位置為pos+1,找出對(duì)應(yīng)位置的數(shù)碼值b
a?-=?b?*?p[pos?+?1];???????//移動(dòng)空格0到位置pos+1
a?+=?b?*?p[pos];???????????//移動(dòng)數(shù)碼值b到位置pos
if?(exist[a]?==?0)
return?a;??????????????//如果是新?tīng)顟B(tài),返回該狀態(tài)a,否則返回0
else?return?0;
}

//深度優(yōu)先搜索,遞歸調(diào)用
bool?eightdigit::dfs(int?a){
if?(a?==?aim)?return?true;//找到目標(biāo)狀態(tài),返回ture
int?b;
expand[0]?+=?1;???????????//擴(kuò)展結(jié)點(diǎn)數(shù)
int?pos?=?findpos(a);?????//查找狀態(tài)a空格所在的位置pos
b?=?mDown(a?pos);????????//當(dāng)前空格下移,得到新?tīng)顟B(tài)b
if?(b){
exist[b]?=?a;?????????//映射,狀態(tài)a生成狀態(tài)b
create[0]?+=?1;???????//生成結(jié)點(diǎn)數(shù)
if?(dfs(b))?return?true;//遞歸調(diào)用
}
b?=?mUp(a?pos);????????
if?(b){
exist[b]?=?a;
create[0]?+=?1;
if?(dfs(b))?return?true;
}
b?=?mLeft(a?pos);
if?(b){
exist[b]?=?a;
create[0]?+=?1;
if?(dfs(b))?return?true;
}
b?=?mRight(a?pos);
if?(b){
exist[b]?=?a;
create[0]?+=?1;
if?(dfs(b))?return?true;
}
return?false;
}

//寬度優(yōu)先搜索,隊(duì)列處理
bool?eightdigit::bfs(int?a){
int?b;

while?(!qopen.empty())
qopen.pop();

qopen.push(a);

while?(!qopen.empty()){
a?=?qopen.front();????//取狀態(tài)a進(jìn)行擴(kuò)展
qopen.pop();
if?(a?==?aim){
return?true;??????//找到目標(biāo)狀態(tài),返回ture
}

expand[1]++;??????????//擴(kuò)展結(jié)點(diǎn)數(shù)
int?pos?=?findpos(a);?//查找狀態(tài)a空格所在的位置pos

b?=?mDown(a?pos);????//當(dāng)前空格下移,得到新?tīng)顟B(tài)b
if?(b){
exist[b]?=?a;?????//映射,狀態(tài)a生成狀態(tài)b
create[1]?+=?1;???//生成狀態(tài)數(shù)
qopen.push(b);????//新?tīng)顟B(tài)b入棧
}

b?=?mUp(a?pos);
if?(b){
exist[b]?=?a;
create[1]?+=?1;
qopen.push(b);
}

b?=?mLeft(a?pos);
if?(b){
exist[b]?=?a;
create[1]?+=?1;
qopen.push(b);

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件????3537834??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\8?puzzle?solution?path.txt

?????文件???????8120??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\8?puzzle.cpp

?????文件???????3993??2017-05-30?17:45??【170518】8?puzzle\8?puzzle\8?puzzle.vcxproj

?????文件???????1066??2017-05-30?17:45??【170518】8?puzzle\8?puzzle\8?puzzle.vcxproj.filters

?????文件????????143??2017-05-06?22:33??【170518】8?puzzle\8?puzzle\8?puzzle.vcxproj.user

?????文件???????1815??2017-05-30?17:50??【170518】8?puzzle\8?puzzle\8puzzle.h

?????文件????????406??2017-05-18?09:02??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.exe.embed.manifest

?????文件????????472??2017-05-18?10:41??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.exe.embed.manifest.res

?????文件????????381??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.exe.intermediate.manifest

?????文件?????????69??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.lastbuildstate

?????文件???????2604??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.log

?????文件?????594806??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.obj

?????文件????????713??2017-05-27?10:51??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.vcxprojResolveAssemblyReference.cache

?????文件??????????0??2017-05-18?10:41??【170518】8?puzzle\8?puzzle\Debug\8?puzzle.write.1.tlog

?????文件????????206??2017-05-18?09:02??【170518】8?puzzle\8?puzzle\Debug\8?puzzle_manifest.rc

?????文件???????1434??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\cl.command.1.tlog

?????文件??????25358??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\CL.read.1.tlog

?????文件????????858??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\CL.write.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link-cvtres.read.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link-cvtres.write.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3024-cvtres.read.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3024-cvtres.write.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3024.read.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3024.write.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3512-cvtres.read.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3512-cvtres.write.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3512.read.1.tlog

?????文件??????????2??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.3512.write.1.tlog

?????文件???????3266??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.command.1.tlog

?????文件???????6128??2017-05-31?11:06??【170518】8?puzzle\8?puzzle\Debug\link.read.1.tlog

............此處省略25個(gè)文件信息

評(píng)論

共有 條評(píng)論