Simple Algorithms of AI
Content:
- About the problem
- English Version (way to solve)
- Vietnamese Version (way to solve)
Install following Algorithms:
- Heuristic
- A* Example: from Arad to Bucharest
Find the number of islands using algorithms as follows:
- Save the starting point to O
- If O is empty -> search failed, end search
- If O is not empty -> take the first point in O and call it rs. Put rs in C
- If rs is the endpoint -> search is successful, end search
- Find all subpoints of rs given O in ascending order of h(x) - estimated distance to the destination
- Go back to step 2 and continue
- Save the starting point to O
- If O is empty -> search failed, end search
- If O is not empty -> take the first point in O and call it rs. Put rs in C
- If rs == endpoint successful search, end search
- Find all subpoints of rs given in O in ascending order for the formula g(x) + h(x)
- Go back to step 2 and continue
in which:
- g(x) is the distance from the starting point to x
- h(x) is the estimated distance from x to the destination
- Make 2 loops to run in rows and columns
- Check position [row][column], if equal to 1 and that position is not checked (False) -> count += 1 and save that position to queue, assign True to that position that has been checked
- Get the first position saved in the queue -> Check around that position, if == 1 and haven't checked (False), then assign True to that position
- Repeat step 2
- Lưu điểm xuất phát vào O
- Nếu O rỗng -> tìm kiếm thất bại, kết thúc tìm kiếm
- Nếu O không rỗng -> lấy điểm đầu trong O và gọi nó là rs. Cho rs vào C
- Nếu rs là điểm cuối -> tìm kiếm thành công, kết thúc tìm kiếm
- Tìm tất cả cá điểm con của rs cho vào O theo thứ tự tăng dần về h(x) - khoảng cách ước lượng đến đích
- Trở lại về bước 2 và thực hiện tiếp
- Lưu điểm xuất phát vào O
- Nếu O rỗng -> tìm kiếm thất bại, kết thúc tìm kiếm
- Nếu O không rỗng -> lấy điểm đầu trong O và gọi nó là rs. Cho rs vào C
- Nếu rs == điểm cuối tìm kiếm thành công, kết thúc tìm kiếm
- Tìm tất cả cá điểm con của rs cho vào O theo thứ tự tăng dần đối với công thức g(x) + h(x)
- Trở lại về bước 2 và thực hiện tiếp
trong đó:
- g(x) là khoảng cách từ điểm xuất phát đến x
- h(x) là khoảng cách ước lượng từ x đến đích
- Thực hiện 2 vòng lặp để chạy theo hàng và cột
- Kiểm tra vị trí [hàng][cột], nếu bằng 1 và vị trí đó chưa check (False) -> count += 1 và lưu vị trí đó vào queue, gán True cho vị trí đó đã check qua
- Lấy vị trí đầu đã lưu trong queue -> Kiểm tra xung quanh vị trí đó, nếu == 1 và chưa check qua (False) thì gán True vào vị trí đó
- Thực hiện lại bước 2
This Assignment is created by Lecturer: Bui Thanh Hung
Director of Data Analytics & Artificial Intelligence Laboratory - DAAI Lab Director of Artificial Intelligence & Information System Programme
Institute of Engineering -Technology
Thu Dau Mot University
I'm finished At Ton Duc Thang university - Year: 2021
But it is not perfect so there are many problems. Be careful if you take it




