You are on page 1of 12

Artificial intelligence (AI): is the intelligence of machines

and the branch of computer science that aims to create it.


General AI goal: engineering-based AI goal, science AI goal.
Uninformed search strategies
Uninformed strategies use only the information available
in the problem definition.
We look at some such strategies:
• Breadth-first search
• Uniform-cost search
• Depth-first search
----------------------------------------------------------------------
1- Depth first search : A graph search algorithm which
extends the current path as far as possible before
backtracking to the last choice point and trying the
next alternative path, Depth-first search may fail to
find a solution if it enters a cycle in the graph

Advantages of (DFS)
1- DFS is space efficient: it may store only those states
currently in the search stack.
2-DFS can be easily extended to detect cycles and thus
check live properties.

3- If depth-first search finds solution without exploring


much in a path then the time and space it takes will be very
less.
4- algorithm only needs to store a stack of nodes on the path
from the root to the current node.

Disadvantages of (DFS)
1-need cost and time and big storage.
2-And there is no guarantee to find a minimal solution, if
more than one solution exists.
3- Depth-First Search is not guaranteed to find the solution.

-----------------------------------------------------------------------
2- Breadth first search (BFS) is a graph search algorithm
that begins at the root node and explores all the
neighboring nodes. Then for each of those nearest
nodes, it explores their unexplored neighbor nodes,
and so on, until it finds the goal.
Advantages of (BFS): Breadth first search will never get
trapped exploring the useless path forever. If there is a
solution, BFS will definitely find it out. If there is more than
one solution then BFS can find the minimal one that
requires a smaller number of steps.

Disadvantage of (BFS): need cost and time and big storage.


using queue. Heavy memory requirements, the space
complexity of BFS is O(bd), If the solution is farther away
from the root.
Informed (Heuristic) Search Strategies
Informed Search : a strategy that uses problem-specific
knowledge beyond the definition of the problem itself
Methods :
1- Hill-climbing search.
2- Best-first search.
3- A*(star) search.
4- MiniMax Algorithm.
5- Alpha-beta pruning Algorithm.
6- Genetic Algorithm.
7-
1- Hill-climbing search : It’s a heuristic search algorithm ,
is an optimization technique which belongs to the
family of local search. It is relatively simple to
implement, making it a popular first choice.

Advantages : If the change produces a better solution


, repeating until no further improvements can be
found, Hill climbing is good for finding a local
optimum, It is easy to find an initial solution.

Hill climbing Disadvantages:


1- local maxima: Is a state that is better than all of its
neighbors but is not better than some other states.

2-A ridge: Is an area of the search space that is higher


than surrounding areas, but that cannot be traversed by
a single move in any one direction.
3-Plateau: Another problem with hill climbing is that
of a plateau, which occurs when we get to a “flat"
part of the search space.

2-Best-first search: its most general form is a simple


heuristic search algorithm, which is a way of combining
the advantages of both depth‐first and breadth‐first search
into a single method.

Advantages (BFS): is one search used to solve problem,


form is a simple heuristic search algorithm, better than Hill
climbing, less time, Efficient selection of the current best
candidate for extension is typically implemented using a
priority queue, here refers to a general problem-solving
rule or set of rules.

Disadvantage: Does not always find the shortest path to


the goal, that do not guarantee the best solution or even
any solution, A disadvantage of this approach is that if the
heuristic is not accurate, algorithm is O(bm) in terms of
space and time complexity.
3-A*(star) search : Is a heuristic search algorithm , if A
used with an evaluation function in which h(n) is less
than or equal to the cost of the minimal path from n to
the goal , the resulting search algorithm is called A*
Algorithm.
Advantages : used to minimize the search cost in a given
problem, find the least-cost path to the specific goal,
this may reduce the necessity to search all the possible
pathways in a search space, and result in faster solution.

Disadvantages : the main shortcoming of A* is its


memory requirement, A* is space-limited in practice
and is no more practical than breadth first search, For
large search spaces, A* will run out of memory.
Fortunately, a mass of memory could be saved with
IDA*.

4-MiniMax Algorithm : The minimax algorithm is such a


tactic, which uses the fact that 2 players are working
towards opposite goals to make predictions.

Advantages: best choice of action in a situation, determine


the best move for the current player of a game For a long
time, use, minimax search in programs for two-person, this
approach is very successful in games like chess, checkers,
Usually, it shows a dramatic improvement in playing
strength , with increasing search depth

Disadvantages : As we've shown, you can't search


everything. The search needs to be stopped at a specific
depth in the tree, that the computer has a smaller view of
the game. This limited scope has many obvious pitfalls...
the computer can commit to an branch simply because the
nasty consequences of its actions are beyond its horizon!
Properties of minMAX
Complete? - Yes(if tree is finite)
Optimal? - Yes(against an optimal opponent)
Time Complexity? O(bm )
Space Complexity? O(bm) (depth first exploration)

5-Alpha-beta pruning : is a procedure to reduce the


amount of computation and searching during minimax.
Advantages : Alpha-beta pruning is a simple algorithm
that minimizes the game-tree search for moves that are
obviously bad , lies in the fact that branches of the
search tree can be eliminated.
Disadvantages : This way, the search time can be
limited to the 'more promising' subtree , The problem
with finding a minimax solution for a turn-taking game
such as chess.

6- Genetic algorithms : are one of the best ways to solve


a problem for which little is known ,
genetic algorithm is a search technique used in
computing, to find true or approximate solutions to
optimization and search problems.
Advantages: No derivatives needed. Easy to parallelize.
Can escape local minima. Works on a wide range of
problems.

Disadvantages: Need much more function evaluations


than linearized methods. No guaranteed convergence
even to local minimum. Have to discredited parameter
space

 Fitness: Simply have the fitness of the chromosome


equal to its evaluation.
 Population: A set of solutions we have.

1- Selection

While there are many different types of selection, I will


cover the most common type - roulette wheel selection. In
roulette wheel selection, individuals are given a probability
of being selected that is directly proportionate to their
fitness. Two individuals are then chosen randomly based
on these probabilities and produce offspring. Pseudo-code
for a roulette wheel selection algorithm is shown below

2- Crossover
So now you have selected your individuals, and you know
that you are supposed to somehow produce offspring with
them, but how should you go about doing it? The most
common solution is something called crossover, and while
there are many different kinds of crossover, the most
common type is single point crossover. In single point
crossover, you choose a locus at which you swap the
remaining alleles from one parent to the other. This is
complex and is best understood visually.

3-Inverse: Implemented after, once one for specific


numbers.
4-Mutation: Its used only to obtain the goal, so its used
once and for one bit only.

You might also like