Báo cáo đồ án trí tuệ nhân tạo: xây dựng chương trình giải quyết bài toán chiếc ba lô loại 1 theo giải thuật gen và phương pháp chọn là bánh xe roulette - Pdf 12

HỌC VIỆN KỸ THUẬT QUÂN SỰ
KHOA CÔNG NGHỆ THÔNG TIN
BÁO CÁO MÔN HỌC
TRÍ TUỆ NHÂN TẠO


BÁO CÁO BÀI TẬP LN
Đ! T"i !"#$"%&'"()*+*",+!))$ /01
2"#3(40,"+*""5("6"5*72778)*+
.5#)5""59
:;"(+*"
<$='>"?@6"'*+$="AB'"5"#0,)C
 ;D6"='>""#8)&*'>""#C9
 E='>""$"#8)&+$=",B'"59
 ;D6"F%&8"@%!)B9
 <$'@B'6"'!"5'!."#C9
 GH6" IJKL
 "#C JMLNI
 O9)& LMIIKI
 @)&"@%!="A'!)*%2C9
 P,7%H6"%A="#C)Q"R
277(40,"Q%ST("6"5*72778
#)5""59
9P/01
<;U=!
 ;U=!C7/V<!#05:)*WA"XQ"
Y%B"S"6""5?ZXWA'U=!*0*+[3=
%2(
 O#'U=!C7/-'8\'?]"A)*D+"?^_9
 E"AVE#'?'5:`
E"AVE#'?'5:<

'="#C"@"2*%$"%&W,"4('*"!"3'W,'9
O#2"#3*0-"!?ZX7277?)5v7"#??5#-"rv7"
*`#"'5"v#??5#%A)!g7"A!9
III)Xây d1ng chương tr7nh
!f
P/01'(%A)"#C-W@)&6"9
public int[,] knapsack = new int[7, 2] { { 5, 7 }, { 8, 8 }, { 3, 4 }, { 2, 10
}, { 7, 4 }, { 9, 6 }, { 4,4} };
private string[] str_dt = new string[30];
private string[] str_p = new string[30];
private string[] str_f = new string[30];
W["$"#C4B"A+!%B
;U)f"1"
private void button1_Click(object sender, EventArgs e)
{
//int dem = 0;
lb.Items.Clear();
for (int i = 0; i < 30; i++)
{
gen_str: string str_ = Random_ks();
if (i==0)
str_dt[i] = str_;
else
for (int j = 0; j < i; j++)
{
if (str_dt[j] == str_)
goto gen_str;
else
str_dt[i] = str_;
}

return str_[index];

 "$4B"A'+u#??5#_'"!"-="A)*''Q""A
"@"Q"9
 277Elitism7g770"A"@"V_'>"*"A
"@":?!4B"A'9
 O*7Bs)$b!4B"A%&"$"oW9
 277Elitism="A"a"@+*"-3=aW)*''Q"
"A"@"9
P/01*';"!""$%>"+,"#'>""A%A",7"X)!g79
private void Mutation(string[] str)
{
Random rnd = new Random();
int index_str = rnd.Next(0,30);
string tmp = str[index_str];
int num = rnd.Next(1, 3);
for (int i = 0; i < num; i++)
{
int index = rnd.Next(0,6);
if (tmp[index].Equals("0"))
{
tmp.Remove(index, 1);
tmp.Insert(index, "1");
}
else
{
tmp.Remove(index, 1);
tmp.Insert(index, "0");
}
}

if (Convert.ToInt16(tmp[j]) == 49)
{
sum3 += knapsack[j, 1];
}
}
sum4 += sum3;
sum3 = 0;
if (sum4 > r)
{
ret = i;
goto end;
}
}
end: return ret;
}
O,*)!g7*W,"4(4B"A"%&?!)!g7
,"4("!?t"3'%)e("@"Wd)*"@Q"b!+*"3
72778!"1?1"@""#\+,"1",9
p:E"*)f"!'W(
!9 q)5+*('`b!"B0
+9O#!r5+)59'9*"#!W
Em cảm ơn thầy vì đã dạy em môn Trí tuệ nhân tạo.


Nhờ tải bản gốc

Tài liệu, ebook tham khảo khác

Music ♫

Copyright: Tài liệu đại học © DMCA.com Protection Status