1. Trang chủ
  2. » Luận Văn - Báo Cáo

Topic- Problem Solving By Searching And Algorithm In Artificial Intelligence Major- Software Engineering.pdf

15 1 0
Tài liệu được quét OCR, nội dung có thể không chính xác
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Problem solving by searching and algorithm in artificial intelligence
Tác giả Nguyen Phuc Toan, Tran Tan Loc, Hong Dai Nghia, La Tan Phat
Người hướng dẫn TS. Tran Quang Huy
Trường học Saigon International University
Chuyên ngành Software Engineering
Thể loại Báo cáo
Năm xuất bản 2023
Thành phố Ho Chi Minh City
Định dạng
Số trang 15
Dung lượng 1,95 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Problem-solving In this section we will discuss some game, and small problems that we can apply some searching for finding a path from a start state to a goal state.. The Traveling Sale

Trang 1

MINISTRY OF EDUCATION AND

TRAINING THE SAIGON INTERNATIONAL UNIVERSITY

ESSAY REPORT ARTIFICIAL INTELLIGENCE COURSE

TOPIC: PROBLEM SOLVING BY SEARCHING AND

ALGORITHM IN ARTIFICIAL INTELLIGENCE

MAJOR: SOFTWARE ENGINEERING

LECTURER:

TS TRAN QUANG HUY STUDENTS:

81012202519 — NGUYEN PHUC TOAN

81012202503 — TRAN TAN LỘC

81012202505 — HONG DAI NGHIA

81012202485 - LÊ TẤN PHÁT

TP HCM - 10, 2023

Trang 2

Contents

i0sss001 0 Ố.ố.ồ .- 3 Problem-SỌVITB - 1 1n Tnhh TH Hà TT Hà 3 01-04: TỐ ea 3 WAI€T JUB Là HH HH HH TH HH HH kh TH HH TH TT TH Thư 4 2x11 6 W0 -soi023 8 7

or 080/123 i10 Ð00n nh .e 8 Uniformed (Blind search) & Informed (Heuristic search) sss+< xxx se vrree 8 Blind search - BFS s2 HT nh HT HT nh kh KT kh như 9 Blind search - ID ES HH Hàng HH nh TH HH Hà HH II Heuristic - Hill Climbing eee 12 [00105 171ẼẺ8 4 13

®›2i19 1777 ỐỐ 15

Trang 3

Introduction

Nowaday, it can be said that AI has played a significant role Taking some specific examples, you often see drivers using Google Maps for navigation while running Grab

Furthermore, in games like chess, AI can find the best moves to win the game These everyday examples illustrate how important searching algorithms are to the development of AI

In this essay, we will explore some examples such as playing chess, the water jug problem, the

traveling salesperson problem, and the 8 Puzzle game

We'll read about how AI employs various search methods to find solutions for games or the shortest path We will divide the discussion into three main sections:

After reading, you will grasp some of the ways AI searches and some algorithms used in the process Let's dive in!

Problem-solving

In this section we will discuss some game, and small problems that we can apply some searching for finding a path from a start state to a goal state

Playing chess

First, we need to determine: status of the chess game, initial state, goal state, valid transition: current

state — next state

About status of the chess game, define the state space Observe the problem and draw out important information that needs to be presented

In this game, we can present as structures, such as integers, real numbers, and combining them to form numbers to make a new structure It depends on the problem We will have our own definition here:

For white army: white pawn is 1; white rook is 2; white knight is 3; white bishop is 4; white queen is 5; white king is 6

For black army: black pawn is 7; black rook is 8; black knight is 9; black bishop is 10; black queen

is 11; black king is 12

In addition, there will be a number of ways to represent other states, such as: use vectors to define;

use negative numbers to represent the status of each piece

Trang 4

list: type, color, location Use lists to define pieces Each element is a chess piece (chess piece: type, color, position)

To put it more clearly: The state of the chess problem is expressed through the way we arrange the pieces on the chessboard at a particular time Each square on the chessboard can always contain an empty piece or a move

Nex we move to initial state, For example, we have the starting state like this:

The initial state of the chessboard is the arrangement of the pieces when the game begins And it always includes 32 pieces (16 white pieces and 16 black pieces)

Next we move to the goal State Specifically, we will look for it: Goals are represented by constraints

or the target knows the specific situation

Checkmate or occupy the opponent's king: use reasonable rules, tactics and strategies to protect your own pieces while also checking the enemy's pieces

Finally in a ¥alid MO6Ve to get to goal state Depending on the rules of the problem: it may be available; it may also be that we have to deduce it ourselves

Legal status is the move that the player has made legally A legal move is a move in which the player will make moves to move or attack the opponent's pieces according to the rules of chess

And for some problems, the rule can be found immediately For some problems, the conclusion must

be deduced through the solution process

Water Jug

We have two jugs in total, a 4-liter one and a 3-liter one However, the water level markings on both jugs have been erased There is a pump that can be used to fill the jugs with water How can you make the 4liter jug contain exactly 2 liters?

Trang 5

ita ODO

a

We will present as a state (x.y): we will let x represent the amount of water in the 4-liter jug, and y represent the amount of water in the 3-liter jug

In reality, both x and y can be real numbers, but considering them as real numbers would make the problem space very large Here, our goal state is an integer, so we should consider x and y as non- negative integers

About initial state, we will assign 0 to both x and y as the initial state

About goal state (2) Since our goal is to pour 2 liters into the 4-liter jug, and the problem does not specify the amount of water in the 3-liter jug, we can consider it as an arbitrary number, denoted as 'n', withO<n<3

Continue reading Legal Moves: Current State — Next State We have some rules here:

1 (x,y) > (4, y) if x <4: Fill the 4-liter jug, but with the condition that the 4-liter jug has not been filled previously, as it would be meaningless to perform this action if the 4-liter jug is already full

Fill the 3-liter jug, but with the condition that the 3-liter jug has not been filled previously, as it would be meaningless to perform this action if the 3-liter jug is already full

Pour all the water from the 4-liter jug out, with the condition that there is water in the jug before performing this action, as there is no need to pour it out if the jug is already empty

Pour all the water from the 3-liter jug out, with the condition that there is water in the jug before performing this action, as there is no need to pour it out if the jug is already empty

Pour a certain amount of water from the 3-liter jug into the 4-liter jug to fill the 4-liter jug (4 - x) represents the amount of water needed to fill the 4-liter jug, so it should not exceed 4 The 3-liter jug must have water in it, and after pouring, it may still contain water

Pour a certain amount of water from the 4-liter jug into the 3-liter jug to fill the 3-liter jug 3 - y) represents the amount of water needed to fill the 3-liter jug, so it should not exceed 3 The 4-liter jug must have water in it, and after pouring, it may still contain water

Pour all the water from the 3-liter jug into the 4-liter jug, but ensure that the total amount of water in both jugs does not exceed 4, and the 3-liter jug must have water in it before pouring

Trang 6

8 (x.y) > (0.x + y),ifx+ys3;x>0

Pour all the water from the 4-liter jug into the 3-liter jug, but ensure that the total amount of water in both jugs does not exceed 3, and the 4 liter jug must have water in it before pouring This is a specific rule known as the Law of 7, which is necessary as it can accelerate the problem-solving process Additionally, you can create additional specific rules to further enhance the speed of problem-solving

Here is one possible solution to this problem:

The amount of water in | The amount of water in The rule applied the 4-liter jug the 3-liter jug

0 0

4 0 1

1 3 6

1 0 4

0 1 8

4 1 1

2 3 6

SPuzzle

We will take an example of the 8 Puzzle game as shown in the figure below:

Stary -

SIN 3

6

8 a

We need to arrange the puzzle in such a way that the configuration on the left, the Start) can be transformed into the configuration on the right, the G6al, Here, we can move the tiles around the

blank tile, which is adjacent to tiles 1,4, and 7 We start the movement as follows:

Starr

A]2]>

asi! Gog |

COTS

2

4

s h N 74 Shik

112] 3 2/3 Zs

4| |5 HIS ^a|4|S

^l5E S18 [Sle

We will move according to the board with the lowest difference with the Goal (denoted as h) and not move through all the boards Thus, we move in the direction where h=2

Trang 7

1l2|2 Z6] 3| 2

ae ho _2

CES 4|s|c 416 4|2|6

bas Ds xì

⁄¡| lG 4|5|<

So, once we complete this process, we continue with h=1, h=0, choosing the path with the least difference from the lowest goal

This is an example of the 8 Puzzle game, where we search for the path to the goal by choosing the next steps with the lowest difference This might not be the most optimal way, but it can significantly reduce complexity

Furthermore, you can know much more detail about these searching way in the section Heuristic searching

Traveling salesperson problem

One of the classic examples of a searching problem in computer science is the Traveling Salesperson Problem (TSP) This is a challenging problem, known as an NP-Hard Problem, that requires finding the most efficient way for a salesperson to visit a set of cities and returm to the starting point, all while minimizing the total distance traveled

The Traveling Salesman Problem

Starting from city 1, the salesman 2 i

must travel to all cities once — =——==

before returning home

The distance between each city is \ \ \

given, and is assumed to be the _ 11 19

same in both directions oT SS

ay | Only the links shown are to be start 7 9 | \ | >> 1

used \ / %6)

distance to be travelled

The role of Heuristic Search is extremely important in TSP, as it enhances the efficiency of search algorithms by providing essential information and guidance in finding approximate solutions for these challenging search problems For example:

Trang 8

distance) for a potential route, making the algorithm more efficient

@ Guiding the search: It provides directions on how to move within the search space of TSP Instead of exhaustively exploring all possible routes, heuristics suggest which states to try first

e Eliminating inferior choices: If a potential route is deemed unable to improve upon the current solution, the algorithm can discard it, thus speeding up the search process

e Initial solution setup: Heuristics can be used to create an initial solution for TSP A good starting point significantly aids the search algorithm

e@ Comparison and evaluation: Heuristics enable the evaluation and comparison of potential solutions, ultimately helping refine the route or eliminate it

To solve the problem, we use Nearest Neighbor Algorithm by following these steps:

1 Select a starting city

2 Select the one closest to the current city

3 Repeat step 2 until all cities have been visited

Regarding complexity: O (n42) vs O (n!)

We can delve deeper into the mentioned problem and other algorithms in the section detail methods (algo)

Detail Methods (algo)

In this section we will discuss in detail some algorithms that we usually use for searching Start with understanding the uniform and inform searching

Uniformed (Blind search) & Informed (Heuristic search)

About uniformed (Blind search): Not hard to understand that uniformed is a type of algorithm without information to guide them to get to a goal They will do all state that the problem may have That will lead to exponential growth in complexity

But these types of algorithms are basic and easy to implement Let’s take an example:

Arhtcoel krìcfigence al Intelligence `——<

Trang 9

uniformed test because it will test all possible states without knowledge of which pouring case is better

And on the left is playing chess, the algo will consider all possible moves without any strategy or playing style

About informed (heuristic search): Easy to understand, this is a type of algorithm that already has information So the algorithm uses information to make decisions optimally in search

To take an example, we use heuristics as informed algorithms Because heuristic has the function to know wich state is better

For example, the images above on the left are a traveling salesperson, and on the right is 8Puzzle These problems are solved using an informed algorithm

Because with traveling salesperson we choose the path with the less distances, and in 8Puzzle we choose the path with the less different with goal So this information will guide the algorithm to make decision

Blind search - BFS

As we can see, in the field of Artificial Intelligence, search plays an extremely important role

It is considered the core work in solving many problems, used to schedule the search for the shortest path in complex networks In the search system, one of the quite important algorithms, which can also

be considered the most important, is Breadth-First Search (BFS), or breadth-first search

It is considered the core work in solving many problems, used to schedule the search for the shortest path in complex networks In the search system, one of the quite important algorithms, which can also

be considered the most important, is Breadth-First Search (BFS), or breadth-first search

BFS is a non-intelligent and highly efficient search algorithm among the remaining search algorithms

It is used to find a path from a root vertex to a destination vertex in a graph or tree

The special thing about BFS is that it will first traverse all the vertices of the same level and then

move down to the child vertices, i.e it will search breadth-first This ensures that the BFS will search

for the first shortest path it encounters

Trang 10

An example of how BFS works can be seen in finding the shortest path on a street map When we want to go from one point to another, we will use google maps to do that It will select and choose for

us which path is the shortest and most optimal We can use BFS to do that, and then move the destination we want to

BFS can also be widely applied in the field of Artificial Intelligence not only in route finding, but also includes text analysis and in optimization algorithms, keyword searching in databases Searches the state space of issues

In addition, the BFS algorithm is also used to increase search performance in specific problems For example, Dijkstra's algorithm and A* algorithm are two examples of extensions of BFS, which are widely applied in shortest path search and optimization in artificial intelligence models

The Breadth-First Search (BFS) algorithm works as follows:

e Start from the root vertex (starting point), mark it as visited and put it in the queue

e Repeat the following steps until the queue is empty: Retrieve the first vertex from the queue, check all unvisited neighbors (adjacent vertices) of this vertex and then mark and add adjacent vertices then enter the queue

This process will continue until the desired result is returned or vertices have been visited BFS ensures that vertices near the root vertex are visited first, followed by vertices further away, which helps find the shortest path first in the case of searching for distant paths

In short, BFS is not just an algorithm used for search and optimization in Artificial Intelligence, the flexibility and efficiency of BFS has helped it become an indispensable part in solving many problems complexity in this area

10

Ngày đăng: 16/03/2025, 21:28

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w