導航:首頁 > 源碼編譯 > 智能演算法期末考試

智能演算法期末考試

發布時間:2022-07-21 11:47:12

㈠ 智能演算法有哪些

模擬退火演算法,禁忌搜索,群智能演算法,遺傳演算法,量子優化演算法。

㈡ 15秋會計(余業)專業《會計電算化》期末考試a卷

試題練習可以通過高頓題庫智能做題提高做題速度.會計從業資格證考試做題,首選高頓題庫!財經題庫系統是高頓網校基於大數據的人工智慧演算法研發而成,題庫根據財經考試的考點、考頻、難度分布,並根據用戶對各個考點的掌握情況,利用人工智慧演算法實現的一對一智能出題。每次提供給用戶的15道或1套題,都來源於高頓題庫智能出題系統對用戶歷史練習數據的評估分析。
提供財經考試各科目歷年真題及精編模擬題,最新真題在考試後24小時內提供,是國內最大的財經在線題庫。每題答案和解析均由2位業界名師編審,參照圖書出版標准,經過5輪嚴格審校。
高頓題庫將根據用戶的答題情況實時生成個人能力評估報告,准確評估用戶當前對各個知識點的掌握情況,並提供測練建議。同時,高頓題庫還能通過用戶設置的財經考試以及用戶當前的能力水平,精確預測用戶參加該考試可能獲得的分數。
用戶可以通過電腦、智能手機和平板電腦進行在線練習。另外,高頓題庫還支持下載列印試卷和答題卡,手機掃描答題卡就能自動實現評分、查看答案和解析。

㈢ 什麼是智能演算法

在工程實踐中,經常會接觸到一些比較「新穎」的演算法或理論,比如模擬退火,遺傳演算法,禁忌搜索,神經網路等。這些演算法或理論都有一些共同的特性(比如模擬自然過程),通稱為「智能演算法」。

㈣ 最常見的人工智慧演算法都有哪些

神經網路演算法、蟻群演算法、混合蛙跳演算法、蜂群演算法。

㈤ 問: 40 人工智慧及其應用期末作業 用A*演算法解決下面的八數碼難題。試定義估價函數,啟發函數,

#pragma warning(disable:4786)
#include <algorithm>
#include <cstdio>
#include <set>
#include <utility>
#include <ctime>
#include <cassert>
#include <cstring>
#include <iostream>
using namespace std;

/*item記錄搜索空間中一個結點
state 記錄用整數形式表示的8數碼格局
blank 記錄當前空格位置,主要用於程序優化,
擴展時可不必在尋找空格位置
g, h 對應g(n), h(n)
pre 記錄當前結點由哪個結點擴展而來 */
struct item
{
int state;
int blank;
int g;
int h;
int pre;
};

const int MAXSTEPS = 100000;
const int MAXCHAR = 100;
char buf[MAXCHAR][MAXCHAR]; //open表
item open[MAXSTEPS];
//vector<item> open;
int steps = 0;

//closed表,已查詢狀態只要知道該狀態以及它由哪個結點擴展而來即可,用於輸出路徑
//每次只需得到對應f值最小的待擴展結點,用堆實現提高效率
pair<int, int> closed[MAXSTEPS];
//讀入,將8數碼矩陣格局轉換為整數表示

bool read(pair<int,int> &state)
{
if (!gets(buf[0]))
return false;
if (!gets(buf[1]))
return false;
if (!gets(buf[2]))
return false;

//cout << strlen(buf[0]) << ' ' << strlen(buf[1]) << ' ' << strlen(buf[2]) << endl;
assert(strlen(buf[0]) == 5 && strlen(buf[1]) == 5 && strlen(buf[2]) == 5);
// astar.in中的每行數據長度必須為5
state.first = 0;
for (int i = 0, p = 1; i < 3; ++i)
{
for (int j = 0; j < 6; j += 2)
{
if (buf[i][j] == '0')
state.second = i * 3 + j / 2; // state.second為0(空格)在節點中的位置
else
state.first += p * (buf[i][j] - '0');
p *= 10;
}
}

/* 若初試節點為:
1 2 3
8 0 4
7 6 5
則state.first為567408321,state.second為4
*/
return true;
}

//計算當前結點距目標的距離
int calculate(int current, int target) // return h=the sum of distances each block have to move to the right position,這里的each block不包括空格
{
int c[9], t[9];
int i, cnt = 0;
for (i = 0; i < 9; ++i)
{
c[current % 10] = t[target % 10] = i;
current /= 10;
target /= 10;
}

for (i = 1; i < 9; ++i)
cnt += abs(c[i] / 3 - t[i] / 3) + abs(c[i] % 3 - t[i] % 3);

return cnt;
}

//open表中結點間選擇時的規則 f(n) = g(n) + h(n)

class cmp
{
public: inline bool operator()(item a, item b)
{
return a.g + a.h > b.g + b.h;
}
};

//將整數形式表示轉換為矩陣表示輸出
void pr(int state)
{
memset(buf, ' ', sizeof(buf));
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 6; j += 2)
{
if (state % 10)
buf[i][j] = state % 10 + '0';
state /= 10;
}

buf[i][5] = '\0';
puts(buf[i]);
}
}

//用於判斷當前空格是否可以向對應方向移動
inline bool suit(int a, int b) //空格移動後的坐標為(a,b)
{
return (a >= 0 && a < 3 && b >= 0 && b < 3);
}

//遞歸輸出搜索路徑
void path(int index)
{
if (index == 0)
{
pr(closed[index].first);
puts("");
return;
}
path(closed[index].second);
pr(closed[index].first); //將整數形式表示轉換為矩陣表示輸出
puts("");
++steps;
}

int getNixuNum( int state ) //求節點的逆序對數
{
int sum = 0;
int result[9];
memset( result, 0, sizeof(result) );
//cout << result[8] << result[7] << endl;

char buf[10];
itoa( state, buf, 10 );
//cout << buf << endl;
int k = 0;
while( buf[k] != '\0' )
{
result[9-k-1] = buf[k] - '0';
k++;
}

for( int i = 0; i < 9; i++ )
{
for( int j = i + 1; j < 9; j++ )
{
if( result[i] && result[j] && result[i] > result[j] )
{
sum++;
}
}
}
return sum; //返回3*3方格數組的逆序對數
}

int main()
{
//cout << getNixuNum(87654321);
//open.resize(MAXSTEPS);
unsigned int t1 = clock();
//cout << open.size() << endl;
if( freopen("astar.in", "r", stdin) == NULL )
{
cout << "file not find\n";
exit(0);
};

freopen("astar2.out", "w", stdout);
set<int>states;
char tmp[100];
int i, x, y, a, b, nx, ny, end, next, index, kase = 0;
pair<int,int> start, target;
item head; //4個方向移動時的偏移量
const int xtran[4] = {-1, 0, 1, 0};
const int ytran[4] = {0, 1, 0, -1};
const int p[] = {1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000};

while (read(start)) // 讀取初試狀態節點
{
unsigned int t2 = clock();
printf("Case %d:\n\n", ++kase);
gets(tmp);
read(target); // 讀取目標狀態節點
gets(tmp);

int targetNixuNum = getNixuNum(target.first);
//若兩者的逆序對數不是同為奇數或同為偶數,則無解
if( !(getNixuNum(start.first)&1 && targetNixuNum&1 || !(getNixuNum(start.first)&1) && !(targetNixuNum&1)) )
{
cout << "無法從初始節點到終態節點\n";
exit(0);
}
//初始化open表,將初始狀態加入
open[0].state = start.first;
open[0].h = calculate(start.first, target.first); // 計算當前節點到目標節點的估計距離
open[0].blank = start.second;
open[0].pre = -1; // 初始節點無父節點
open[0].g = 0; // 初始節點的g為0
index = 0;
states.insert(start.first); // 擴展過節點保存在states中,即出現過的狀態保存在states中,states為set<int>類型,其中的states中的元素唯一

//提取open表中f值最小元素放入closed表,並對該結點進行擴展
for (end = 1; end > 0; ++index) // end為open表中的元素個數,一直循環到open表為空
{
assert(index < MAXSTEPS);
//臨時存儲
head = open[0]; // 由於使用pop_heap函數和push_heap函數,所以open[0]為g+h最小的元素

//放入closed表記錄當前格局和由哪個結點擴展而來(該結點肯定已在closed表中)
closed[index].first = open[0].state; //放入close表中,表示已經擴展完的節點,下面的for循環會擴展其節點
closed[index].second = open[0].pre; // index表示當前close表中當前擴展節點的下標
//從open表中刪除該結點
pop_heap(open, open + end, cmp());//為algorithm文件中的函數,第一個參數指定開始位置,第二個指定結束,第三個指定比較函數
--end;

//得到結果,遞歸輸出路徑
if (head.state == target.first)
{
path(index);
break;
}

x = head.blank / 3;
y = head.blank % 3; //空格在3*3方格中的x,y坐標
/*
|2 0 3|
A = |1 8 4|
|7 6 5| // 看成3*3的數組
則head.blank=1
x=0,y=1,即空格的在3*3的數組中下標為(0,1)
*/
for (i = 0; i < 4; ++i)
{
nx = x + xtran[i];
ny = y + ytran[i];
/*
i=0時:(nx,ny)為當前空格向上移動一格後的坐標
i=1時:(nx,ny)為當前空格向右移動一格後的坐標
i=2時:(nx,ny)為當前空格向下移動一格後的坐標
i=3時:(nx,ny)為當前空格向左移動一格後的坐標
*/
if (suit(nx, ny)) // 判斷是否能夠移動
{
a = head.blank; // 空格當前位置,以上面矩陣A為例,a=1
b = nx * 3 + ny; // 空格移動後的新位置,開始是能夠向右邊移動,故b=0*3+2=2
//調換十進製表示整數對應兩個數字位
next = head.state + ((head.state % p[a + 1]) / p[a] - (head.state % p[b + 1]) / p[b]) * p[b] + ((head.state % p[b + 1]) / p[b] - (head.state % p[a + 1]) / p[a]) * p[a];
// 如head.state=567481302,空格向右移動一次後,next=567481032,即為移動後的節點

// 判斷能否由當前節點到達目標節點
if( ( getNixuNum(next)&1 && targetNixuNum&1 ) || ( !(getNixuNum(next)&1) && !(targetNixuNum&1) ) )
{
//判斷是否已經擴展過,即已經出現過
if (states.find(next) == states.end()) //沒出現就保存一下,也存入open表
{
states.insert(next);
open[end].pre = index; //擴展後的子節點,其父節點為當前擴展節點
open[end].blank = b;
open[end].state = next;
open[end].h = calculate(next,target.first);
open[end].g = head.g + 1;
++end; //open表中元素加1
push_heap(open, open + end, cmp()); //壓入堆中
}
}

}
}
}

if (end <= 0)
puts("No solution");
else
{
printf("Num of steps: %d\n", steps);
printf("Num of expanded: %d\n", index);
printf("Num of generated: %d\n", index + end);
printf("Time consumed: %d\n\n", clock() - t2);
}

states.clear();
steps = 0;
}
printf("Total time consumed: %d\n", clock() - t1);
return 0;
}

閱讀全文

與智能演算法期末考試相關的資料

熱點內容
nc編程軟體下載 瀏覽:382
如何限制手機app的使用 瀏覽:307
安卓華為手機怎麼恢復桌面圖標 瀏覽:956
我的世界電腦版伺服器地址在哪找 瀏覽:533
違抗了命令 瀏覽:256
安卓如何實現拖拽放置 瀏覽:91
凈資產收益率選股指標源碼 瀏覽:599
血壓力感測器計算公式單片機 瀏覽:466
全網介面vip影視解析源碼 瀏覽:916
如何破解伺服器遠程密碼錯誤 瀏覽:377
平安深圳app如何實名認證 瀏覽:500
linux網路監控軟體 瀏覽:889
內網伺服器如何上傳文件 瀏覽:140
程序員在你心中是什麼 瀏覽:1
蘋果手機怎麼找回app賬號 瀏覽:466
房屋中介網站源碼 瀏覽:29
命運格數演算法 瀏覽:852
ets3編程 瀏覽:730
怎麼製作音樂相冊的文件夾 瀏覽:566
寧夏重加密硅灰用法 瀏覽:231